GradTabConGradTabControl: Added Style-Support for the Left-/Right-Navigation Buttons

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@865 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
eugene1
2009-06-26 18:43:15 +00:00
parent 2ac2f77e12
commit 8ce72fb2cd
7 changed files with 136 additions and 67 deletions

View File

@ -40,6 +40,7 @@ type
procedure TabButtonBorder(Sender: TCustomControl; AIndex: Integer;
Button: TGradButton; TargetCanvas: TCanvas; R: TRect; BState : TButtonState); virtual; abstract;
procedure TabLeftRightButton(Sender: TGradButton; TargetCanvas: TCanvas; R: TRect; BState : TButtonState); virtual; abstract;
procedure TabLeftRightBorderButton(Sender: TGradButton; TargetCanvas: TCanvas; R: TRect; BState : TButtonState); virtual; abstract;
procedure PrepareButton(Button: TGradButton); virtual;
property TheTabControl : TCustomControl read FTheTabControl write FTheTabControl;
property HasTabButtonPaint : Boolean read GetHasTabButtonPaint;
@ -82,6 +83,10 @@ type
Button: TGradButton; TargetCanvas: TCanvas; R: TRect; BState: TButtonState); override;
procedure TabButtonBorder(Sender: TCustomControl; AIndex: Integer;
Button: TGradButton; TargetCanvas: TCanvas; R: TRect; BState : TButtonState); override;
procedure TabLeftRightButton(Sender: TGradButton; TargetCanvas: TCanvas;
R: TRect; BState: TButtonState); override;
procedure TabLeftRightBorderButton(Sender: TGradButton; TargetCanvas: TCanvas;
R: TRect; BState: TButtonState); override;
procedure PrepareButton(Button: TGradButton); override;
end;
@ -146,7 +151,7 @@ constructor TGradTabVistaStyle.Create;
begin
inherited Create;
FOptions:=[sbTabButton, sbBorderButton, sbCloseButton];
FOptions:=[sbTabButton, sbBorderButton, sbCloseButton, sbLeftRightButton];
with Normal do
begin
@ -203,8 +208,13 @@ var
FGradTabControl : TGradTabControl;
FGradientDirection : TGradientDirection;
begin
FGradTabControl := Sender as TGradTabControl;
if AIndex = FGradTabControl.PageIndex then
FGradTabControl := nil;
if Sender <> nil then
FGradTabControl := Sender as TGradTabControl;
if (FGradTabControl <> nil)
and (AIndex = FGradTabControl.PageIndex) then
BState := bsDown;
case BState of
@ -313,6 +323,24 @@ begin
end;
end;
procedure TGradTabVistaStyle.TabLeftRightButton(Sender: TGradButton;
TargetCanvas: TCanvas; R: TRect; BState: TButtonState);
begin
if BState = bsDown then
BState := bsHot;
TabButton(Sender.Owner as TCustomControl, 0, Sender, TargetCanvas, R, BState);
end;
procedure TGradTabVistaStyle.TabLeftRightBorderButton(Sender: TGradButton;
TargetCanvas: TCanvas; R: TRect; BState: TButtonState);
begin
if BState = bsDown then
BState := bsHot;
TabButtonBorder(Sender.Owner as TCustomControl, 0, Sender, TargetCanvas, R, BState);
end;
procedure TGradTabVistaStyle.PrepareButton(Button: TGradButton);
begin
Button.Font.Color:=clBlack;