📄 advofficetabset.pas
字号:
{***************************************************************************}
{ TAdvOfficeTabSet component }
{ for Delphi & C++Builder }
{ version 1.0 }
{ }
{ written by TMS Software }
{ copyright ?2006 }
{ Email : info@tmssoftware.com }
{ Web : http://www.tmssoftware.com }
{ }
{ The source code is given as is. The author is not responsible }
{ for any possible damage done due to the use of this code. }
{ The component can be freely used in any application. The complete }
{ source code remains property of the author and may not be distributed, }
{ published, given or sold in any form as such. No parts of the source }
{ code can be included in any other component or application without }
{ written authorization of the author. }
{***************************************************************************}
unit AdvOfficeTabSet;
{$I TMSDEFS.INC}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Math, Menus,
Dialogs, Forms, ImgList, CommCtrl, ExtCtrls, ComCtrls, AdvGDIP, GDIPicture,
AdvHintInfo, AdvGlowButton;
{$R ADVOFFICETABSET.RES}
const
GLOWSPEED = 50;
IMG_SPACE = 2;
DEFAULT_TABHEIGHT = 26;
ADVPAGE_OFFSET = 1;
SCROLLER_SIZE = 32;
TabBUTTON_SIZE = 18;
MAJ_VER = 1; // Major version nr.
MIN_VER = 0; // Minor version nr.
REL_VER = 0; // Release nr.
BLD_VER = 1; // Build nr.
// version history
// 1.0.0.1 : Fixed issue with hidden tabs & scrolling
type
TAdvOfficeTabSet = class;
TGradientDirection = (gdHorizontal, gdVertical);
TGlowState = (gsHover, gsPush, gsNone);
TButtonLayout = (blGlyphLeft, blGlyphTop, blGlyphRight, blGlyphBottom);
TDropDownPosition = (dpRight, dpBottom);
//TGDIPGradient = (ggRadial, ggVertical, ggDiagonalForward, ggDiagonalBackward);
//TAntiAlias = (aaNone, aaClearType, aaAntiAlias);
TTabSetTabSettings = class(TPersistent)
private
FLeftMargin: Integer;
FRightMargin: Integer;
FOnChange: TNotifyEvent;
FHeight: Integer;
FStartMargin: Integer;
FEndMargin: Integer;
FSpacing: Integer;
procedure SetLeftMargin(const Value: Integer);
procedure SetRightMargin(const Value: Integer);
procedure SetHeight(const Value: Integer);
procedure SetStartMargin(const Value: Integer);
procedure SetEndMargin(const Value: Integer);
procedure SetSpacing(const Value: Integer);
protected
procedure Changed;
property EndMargin: Integer read FEndMargin write SetEndMargin;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
published
property LeftMargin: Integer read FLeftMargin write SetLeftMargin default 4;
property RightMargin: Integer read FRightMargin write SetRightMargin default 4;
property StartMargin: Integer read FStartMargin write SetStartMargin default 60;
property Height: Integer read FHeight write SetHeight default 26;
property Spacing: Integer read FSpacing write SetSpacing default 4;
end;
TGradientBackground = class(TPersistent)
private
FSteps: Integer;
FColor: TColor;
FColorTo: TColor;
FDirection: TGradientDirection;
FOnChange: TNotifyEvent;
procedure SetColor(const Value: TColor);
procedure SetColorTo(const Value: TColor);
procedure SetDirection(const Value: TGradientDirection);
procedure SetSteps(const Value: Integer);
procedure Changed;
protected
public
constructor Create;
procedure Assign(Source: TPersistent); override;
published
property Color: TColor read FColor write SetColor;
property ColorTo: TColor read FColorTo write SetColorTo;
property Direction: TGradientDirection read FDirection write SetDirection;
property Steps: Integer read FSteps write SetSteps default 64;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
TVistaBackground = class(TPersistent)
private
FSteps: Integer;
FColor: TColor;
FColorTo: TColor;
FOnChange: TNotifyEvent;
FColorMirror: TColor;
FColorMirrorTo: TColor;
FBorderColor: TColor;
FGradientMirror: TGDIPGradient;
FGradient: TGDIPGradient;
procedure SetColor(const Value: TColor);
procedure SetColorTo(const Value: TColor);
procedure SetSteps(const Value: Integer);
procedure Changed;
procedure SetBorderColor(const Value: TColor);
procedure SetColorMirror(const Value: TColor);
procedure SetColorMirrorTo(const Value: TColor);
procedure SetGradient(const Value: TGDIPGradient);
procedure SetGradientMirror(const Value: TGDIPGradient);
protected
public
constructor Create;
procedure Assign(Source: TPersistent); override;
published
property BorderColor: TColor read FBorderColor write SetBorderColor;
property Color: TColor read FColor write SetColor;
property ColorTo: TColor read FColorTo write SetColorTo;
property ColorMirror: TColor read FColorMirror write SetColorMirror;
property ColorMirrorTo: TColor read FColorMirrorTo write SetColorMirrorTo;
property Gradient: TGDIPGradient read FGradient write SetGradient;
property GradientMirror: TGDIPGradient read FGradientMirror write SetGradientMirror;
property Steps: Integer read FSteps write SetSteps default 64;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
TCustomTabAppearance = class(TPersistent)
private
FOnChange: TNotifyEvent;
FBorderColor: TColor;
FBorderColorHot: TColor;
FColor: TColor;
FColorTo: TColor;
FColorHot: TColor;
FColorHotTo: TColor;
FColorSelectedTo: TColor;
FBorderColorDisabled: TColor;
FBorderColorSelected: TColor;
FColorDisabled: TColor;
FColorDisabledTo: TColor;
FColorSelected: TColor;
FColorMirror: TColor;
FColorMirrorTo: TColor;
FColorMirrorHot: TColor;
FColorMirrorHotTo: TColor;
FGradientMirror: TGDIPGradient;
FGradientMirrorHot: TGDIPGradient;
FGradient: TGDIPGradient;
FGradientHot: TGDIPGradient;
FColorMirrorDisabledTo: TColor;
FColorMirrorDisabled: TColor;
FColorMirrorSelectedTo: TColor;
FColorMirrorSelected: TColor;
FGradientSelected: TGDIPGradient;
FGradientDisabled: TGDIPGradient;
FGradientMirrorSelected: TGDIPGradient;
FGradientMirrorDisabled: TGDIPGradient;
FTextColorDisabled: TColor;
FTextColorSelected: TColor;
FTextColor: TColor;
FTextColorHot: TColor;
FBackGround: TGradientBackground;
FBorderColorSelectedHot: TColor;
FBorderColorDown: TColor;
FFont: TFont;
procedure OnBackGroundChanged(Sender: TObject);
procedure SetBackGround(const Value: TGradientBackground);
procedure SetBorderColor(const Value: TColor);
procedure SetBorderColorDisabled(const Value: TColor);
procedure SetBorderColorSelected(const Value: TColor);
procedure SetBorderColorSelectedHot(const Value: TColor);
procedure SetColor(const Value: TColor);
procedure SetColorDisabled(const Value: TColor);
procedure SetColorDisabledTo(const Value: TColor);
procedure SetColorHot(const Value: TColor);
procedure SetColorHotTo(const Value: TColor);
procedure SetColorMirror(const Value: TColor);
procedure SetColorMirrorDisabled(const Value: TColor);
procedure SetColorMirrorDisabledTo(const Value: TColor);
procedure SetColorMirrorHot(const Value: TColor);
procedure SetColorMirrorHotTo(const Value: TColor);
procedure SetColorMirrorSelected(const Value: TColor);
procedure SetColorMirrorSelectedTo(const Value: TColor);
procedure SetColorMirrorTo(const Value: TColor);
procedure SetColorSelected(const Value: TColor);
procedure SetColorSelectedTo(const Value: TColor);
procedure SetColorTo(const Value: TColor);
procedure SetGradient(const Value: TGDIPGradient);
procedure SetGradientDisabled(const Value: TGDIPGradient);
procedure SetGradientHot(const Value: TGDIPGradient);
procedure SetGradientMirror(const Value: TGDIPGradient);
procedure SetGradientMirrorDisabled(const Value: TGDIPGradient);
procedure SetGradientMirrorHot(const Value: TGDIPGradient);
procedure SetGradientMirrorSelected(const Value: TGDIPGradient);
procedure SetGradientSelected(const Value: TGDIPGradient);
procedure SetTextColor(const Value: TColor);
procedure SetTextColorDisabled(const Value: TColor);
procedure SetTextColorHot(const Value: TColor);
procedure SetTextColorSelected(const Value: TColor);
procedure SetBorderColorDown(const Value: TColor);
procedure SetFont(const Value: TFont);
protected
procedure Changed;
property BackGround: TGradientBackground read FBackGround write SetBackGround;
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
published
property BorderColor: TColor read FBorderColor write SetBorderColor;
property BorderColorHot: TColor read FBorderColorHot write FBorderColorHot;
property BorderColorSelected: TColor read FBorderColorSelected write SetBorderColorSelected;
property BorderColorSelectedHot: TColor read FBorderColorSelectedHot write SetBorderColorSelectedHot;
property BorderColorDisabled: TColor read FBorderColorDisabled write SetBorderColorDisabled;
property BorderColorDown: TColor read FBorderColorDown write SetBorderColorDown;
property Color: TColor read FColor write SetColor;
property ColorTo: TColor read FColorTo write SetColorTo;
property ColorSelected: TColor read FColorSelected write SetColorSelected;
property ColorSelectedTo: TColor read FColorSelectedTo write SetColorSelectedTo;
property ColorDisabled: TColor read FColorDisabled write SetColorDisabled;
property ColorDisabledTo: TColor read FColorDisabledTo write SetColorDisabledTo;
property ColorHot: TColor read FColorHot write SetColorHot;
property ColorHotTo: TColor read FColorHotTo write SetColorHotTo;
property ColorMirror: TColor read FColorMirror write SetColorMirror;
property ColorMirrorTo: TColor read FColorMirrorTo write SetColorMirrorTo;
property ColorMirrorHot: TColor read FColorMirrorHot write SetColorMirrorHot;
property ColorMirrorHotTo: TColor read FColorMirrorHotTo write SetColorMirrorHotTo;
property ColorMirrorSelected: TColor read FColorMirrorSelected write SetColorMirrorSelected;
property ColorMirrorSelectedTo: TColor read FColorMirrorSelectedTo write SetColorMirrorSelectedTo;
property ColorMirrorDisabled: TColor read FColorMirrorDisabled write SetColorMirrorDisabled;
property ColorMirrorDisabledTo: TColor read FColorMirrorDisabledTo write SetColorMirrorDisabledTo;
property Font: TFont read FFont write SetFont;
property Gradient: TGDIPGradient read FGradient write SetGradient;
property GradientMirror: TGDIPGradient read FGradientMirror write SetGradientMirror;
property GradientHot: TGDIPGradient read FGradientHot write SetGradientHot;
property GradientMirrorHot: TGDIPGradient read FGradientMirrorHot write SetGradientMirrorHot;
property GradientSelected: TGDIPGradient read FGradientSelected write SetGradientSelected;
property GradientMirrorSelected: TGDIPGradient read FGradientMirrorSelected write SetGradientMirrorSelected;
property GradientDisabled: TGDIPGradient read FGradientDisabled write SetGradientDisabled;
property GradientMirrorDisabled: TGDIPGradient read FGradientMirrorDisabled write SetGradientMirrorDisabled;
property TextColor: TColor read FTextColor write SetTextColor;
property TextColorHot: TColor read FTextColorHot write SetTextColorHot;
property TextColorSelected: TColor read FTextColorSelected write SetTextColorSelected;
property TextColorDisabled: TColor read FTextColorDisabled write SetTextColorDisabled;
end;
TTabAppearance = class(TCustomTabAppearance)
private
protected
public
published
property BackGround;
end;
TTabSetTabScroller = class(TObject)
private
FMin: integer;
FMax: integer;
FPosition: integer;
FVisible: Boolean;
procedure SetMax(const Value: integer);
procedure SetMin(const Value: integer);
procedure SetPosition(const Value: integer);
procedure SetVisible(const Value: Boolean);
protected
public
constructor Create;
function CanGoForward: Boolean;
function CanGoBack: Boolean;
property Min: integer read FMin write SetMin;
property Max: integer read FMax write SetMax;
property Position: integer read FPosition write SetPosition;
property Visible: Boolean read FVisible write SetVisible;
end;
TDbgList = class(TList)
private
function GetItemsEx(Index: Integer): Pointer;
procedure SetItemsEx(Index: Integer; const Value: Pointer);
public
property Items[Index: Integer]: Pointer read GetItemsEx write SetItemsEx; default;
end;
TTabSetButtonSettings = class(TPersistent)
private
FOnChange: TNotifyEvent;
FTabListButton: boolean;
FCloseButton: Boolean;
FScrollButtonNextPicture: TGDIPPicture;
FScrollButtonPrevPicture: TGDIPPicture;
FTabListButtonPicture: TGDIPPicture;
FCloseButtonPicture: TGDIPPicture;
FScrollButtonPrevHint: String;
FScrollButtonNextHint: String;
FCloseButtonHint: String;
FTabListButtonHint: String;
procedure Changed;
procedure OnPictureChanged(Sender: TObject);
procedure SetCloseButton(const Value: Boolean);
procedure SetCloseButtonPicture(const Value: TGDIPPicture);
procedure SetTabListButton(const Value: boolean);
procedure SetTabListButtonPicture(const Value: TGDIPPicture);
procedure SetScrollButtonNextPicture(const Value: TGDIPPicture);
procedure SetScrollButtonPrevPicture(const Value: TGDIPPicture);
protected
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
published
property CloseButton: Boolean read FCloseButton write SetCloseButton default false;
property TabListButton: boolean read FTabListButton write SetTabListButton default false;
property CloseButtonPicture: TGDIPPicture read FCloseButtonPicture write SetCloseButtonPicture;
property TabListButtonPicture: TGDIPPicture read FTabListButtonPicture write SetTabListButtonPicture;
property ScrollButtonPrevPicture: TGDIPPicture read FScrollButtonPrevPicture write SetScrollButtonPrevPicture;
property ScrollButtonNextPicture: TGDIPPicture read FScrollButtonNextPicture write SetScrollButtonNextPicture;
property CloseButtonHint: String read FCloseButtonHint write FCloseButtonHint;
property TabListButtonHint: String read FTabListButtonHint write FTabListButtonHint;
property ScrollButtonNextHint: String read FScrollButtonNextHint write FScrollButtonNextHint;
property ScrollButtonPrevHint: String read FScrollButtonPrevHint write FScrollButtonPrevHint;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
TCustomAdvOfficeTabSetStyler = class(TComponent)
private
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -