jvcllaz: Improved themed painting in JvOutlookBar.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6340 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-04-22 22:41:18 +00:00
parent 6122b61b25
commit 6f73d6d007
5 changed files with 287 additions and 182 deletions

View File

@ -13,7 +13,6 @@
<XPManifest> <XPManifest>
<DpiAware Value="True"/> <DpiAware Value="True"/>
</XPManifest> </XPManifest>
<Icon Value="0"/>
</General> </General>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>

View File

@ -24,7 +24,7 @@ object OLBarMainForm: TOLBarMainForm
Width = 5 Width = 5
AutoSnap = False AutoSnap = False
end end
object StatusBar1: TStatusBar object StatusBar: TStatusBar
Left = 0 Left = 0
Height = 23 Height = 23
Top = 365 Top = 365
@ -81,11 +81,9 @@ object OLBarMainForm: TOLBarMainForm
Caption = 'Standard Shortcuts' Caption = 'Standard Shortcuts'
Color = 4210816 Color = 4210816
DownFont.Color = clWindowText DownFont.Color = clWindowText
DownFont.Height = -11 DownFont.Height = -12
DownFont.Name = 'MS Sans Serif'
Font.Color = clWhite Font.Color = clWhite
Font.Height = -11 Font.Height = -12
Font.Name = 'Tahoma'
ParentColor = False ParentColor = False
TopButtonIndex = 0 TopButtonIndex = 0
end end
@ -118,15 +116,14 @@ object OLBarMainForm: TOLBarMainForm
ButtonSize = olbsLarge ButtonSize = olbsLarge
Caption = 'My Shortcuts' Caption = 'My Shortcuts'
DownFont.Color = clWindowText DownFont.Color = clWindowText
DownFont.Height = -11 DownFont.Height = -12
DownFont.Name = 'MS Sans Serif'
Font.Color = clWhite Font.Color = clWhite
Font.Height = -11 Font.Height = -12
Font.Name = 'Tahoma'
ParentColor = False ParentColor = False
TopButtonIndex = 0 TopButtonIndex = 0
end end
item item
Alignment = taRightJustify
Buttons = < Buttons = <
item item
Caption = 'My Computer' Caption = 'My Computer'
@ -150,21 +147,22 @@ object OLBarMainForm: TOLBarMainForm
Caption = 'Other Shortcuts' Caption = 'Other Shortcuts'
Color = clInactiveCaption Color = clInactiveCaption
DownFont.Color = clWindowText DownFont.Color = clWindowText
DownFont.Height = -11 DownFont.Height = -12
DownFont.Name = 'MS Sans Serif' Font.Color = clWindowText
Font.Color = clWhite Font.Height = -12
Font.Height = -11
Font.Name = 'Tahoma'
ParentColor = False ParentColor = False
TopButtonIndex = 0 TopButtonIndex = 0
end> end>
LargeImages = ImageList1 LargeImages = ImageList1
SmallImages = ImageList2 SmallImages = ImageList2
ActivePageIndex = 1 ActivePageIndex = 1
ThemedBackground = False
OnButtonClick = JvOutlookBar1ButtonClick OnButtonClick = JvOutlookBar1ButtonClick
OnPageChange = JvOutlookBar1PageChange OnPageChange = JvOutlookBar1PageChange
OnPageChanging = JvOutlookBar1PageChanging OnPageChanging = JvOutlookBar1PageChanging
BorderStyle = bsNone
Font.Color = clWindowText
Font.Height = -12
ParentFont = False
PopupMenu = popOL PopupMenu = popOL
TabOrder = 1 TabOrder = 1
OnContextPopup = JvOutlookBar1ContextPopup OnContextPopup = JvOutlookBar1ContextPopup
@ -180,84 +178,132 @@ object OLBarMainForm: TOLBarMainForm
ClientWidth = 557 ClientWidth = 557
TabOrder = 2 TabOrder = 2
object Panel2: TPanel object Panel2: TPanel
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 63 Height = 56
Top = 302 Top = 309
Width = 557 Width = 557
Align = alBottom Align = alBottom
Anchors = [akLeft, akRight]
AutoSize = True
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 63 ClientHeight = 56
ClientWidth = 557 ClientWidth = 557
TabOrder = 0 TabOrder = 0
object Button1: TButton object Button1: TButton
Left = 3 AnchorSideLeft.Control = Panel2
AnchorSideTop.Control = Panel2
Left = 0
Height = 25 Height = 25
Top = 11 Top = 4
Width = 102 Width = 102
AutoSize = True AutoSize = True
BorderSpacing.Top = 4
Caption = 'Assign images' Caption = 'Assign images'
OnClick = Button1Click OnClick = Button1Click
TabOrder = 0 TabOrder = 0
end end
object chkSmallImages: TCheckBox object chkSmallImages: TCheckBox
Left = 8 AnchorSideLeft.Control = Panel2
AnchorSideTop.Control = Button1
AnchorSideTop.Side = asrBottom
Left = 0
Height = 19 Height = 19
Top = 41 Top = 33
Width = 93 Width = 93
Action = acSmallButtons Action = acSmallButtons
BorderSpacing.Top = 4
BorderSpacing.Bottom = 4
TabOrder = 1 TabOrder = 1
end end
object Button2: TButton object Button2: TButton
Left = 109 AnchorSideLeft.Control = Button1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Button1
Left = 106
Height = 25 Height = 25
Top = 11 Top = 4
Width = 110 Width = 110
AutoSize = True AutoSize = True
BorderSpacing.Left = 4
Caption = 'Remove images' Caption = 'Remove images'
OnClick = Button2Click OnClick = Button2Click
TabOrder = 2 TabOrder = 2
end end
object Button3: TButton object Button3: TButton
Left = 224 AnchorSideLeft.Control = Button2
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Button1
Left = 220
Height = 25 Height = 25
Top = 11 Top = 4
Width = 91 Width = 59
AutoSize = True
BorderSpacing.Left = 4
Caption = 'Font...' Caption = 'Font...'
OnClick = Button3Click OnClick = Button3Click
TabOrder = 3 TabOrder = 3
end end
object chkButtonFont: TCheckBox object chkButtonFont: TCheckBox
Left = 224 AnchorSideLeft.Control = chkFlat
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = chkSmallImages
Left = 180
Height = 19 Height = 19
Top = 41 Top = 33
Width = 125 Width = 125
BorderSpacing.Left = 24
Caption = 'Change button font' Caption = 'Change button font'
TabOrder = 4 TabOrder = 4
end end
object chkFlat: TCheckBox object chkFlat: TCheckBox
Left = 112 AnchorSideLeft.Control = chkSmallImages
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = chkSmallImages
Left = 117
Height = 19 Height = 19
Top = 40 Top = 33
Width = 39 Width = 39
BorderSpacing.Left = 24
Caption = 'Flat' Caption = 'Flat'
OnClick = chkFlatClick OnClick = chkFlatClick
TabOrder = 5 TabOrder = 5
end end
object chkThemed: TCheckBox object chkThemed: TCheckBox
Left = 378 AnchorSideLeft.Control = chkButtonFont
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = chkSmallImages
Left = 329
Height = 19 Height = 19
Top = 40 Top = 33
Width = 64 Width = 64
BorderSpacing.Left = 24
Caption = 'Themed' Caption = 'Themed'
Checked = True Checked = True
OnChange = chkThemedChange OnChange = chkThemedChange
State = cbChecked State = cbChecked
TabOrder = 6 TabOrder = 6
end end
object ChkThemedBackground: TCheckBox
AnchorSideLeft.Control = chkThemed
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = chkSmallImages
Left = 417
Height = 19
Top = 33
Width = 131
BorderSpacing.Left = 24
Caption = 'Themed background'
Checked = True
OnChange = ChkThemedBackgroundChange
State = cbChecked
TabOrder = 7
end
end end
object Memo1: TMemo object Memo1: TMemo
Left = 0 Left = 0
Height = 302 Height = 309
Top = 0 Top = 0
Width = 557 Width = 557
Align = alClient Align = alClient

View File

@ -40,6 +40,7 @@ type
{ TOLBarMainForm } { TOLBarMainForm }
TOLBarMainForm = class(TForm) TOLBarMainForm = class(TForm)
ChkThemedBackground: TCheckBox;
chkThemed: TCheckBox; chkThemed: TCheckBox;
popOL: TPopupMenu; popOL: TPopupMenu;
Splitter1: TSplitter; Splitter1: TSplitter;
@ -50,7 +51,7 @@ type
popPage: TPopupMenu; popPage: TPopupMenu;
Editbuttoncaption1: TMenuItem; Editbuttoncaption1: TMenuItem;
Editpagecaption1: TMenuItem; Editpagecaption1: TMenuItem;
StatusBar1: TStatusBar; StatusBar: TStatusBar;
JvOutlookBar1: TJvOutlookBar; JvOutlookBar1: TJvOutlookBar;
Panel1: TPanel; Panel1: TPanel;
Panel2: TPanel; Panel2: TPanel;
@ -71,6 +72,7 @@ type
procedure Button2Click(Sender: TObject); procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject); procedure Button3Click(Sender: TObject);
procedure chkThemedChange(Sender: TObject); procedure chkThemedChange(Sender: TObject);
procedure ChkThemedBackgroundChange(Sender: TObject);
procedure JvOutlookBar1ButtonClick(Sender: TObject; Index: Integer); procedure JvOutlookBar1ButtonClick(Sender: TObject; Index: Integer);
procedure JvOutlookBar1PageChanging(Sender: TObject; Index: Integer; procedure JvOutlookBar1PageChanging(Sender: TObject; Index: Integer;
var AllowChange: Boolean); var AllowChange: Boolean);
@ -138,7 +140,8 @@ begin
with JvOutlookBar1 do with JvOutlookBar1 do
begin begin
P := Pages[ActivePageIndex]; P := Pages[ActivePageIndex];
Caption := Format('Clicked button "%s" on page "%s"',[P.Buttons[Index].Caption,P.Caption]); Statusbar.SimpleText := Format('Clicked button "%s" on page "%s"',
[P.Buttons[Index].Caption,P.Caption]);
end; end;
end; end;
@ -147,7 +150,7 @@ procedure TOLBarMainForm.JvOutlookBar1PageChanging(Sender: TObject;
begin begin
with JvOutlookBar1 do with JvOutlookBar1 do
if (ActivePageIndex > -1) and (Index > -1) then if (ActivePageIndex > -1) and (Index > -1) then
Caption := Format('Page changing from "%s" to "%s"', Statusbar.SimpleText := Format('Page changing from "%s" to "%s"',
[Pages[ActivePageIndex].Caption, Pages[Index].Caption]); [Pages[ActivePageIndex].Caption, Pages[Index].Caption]);
end; end;
@ -155,7 +158,8 @@ procedure TOLBarMainForm.JvOutlookBar1PageChange(Sender: TObject;
Index: Integer); Index: Integer);
begin begin
if Index > -1 then if Index > -1 then
Caption := Format('Page changed to "%s"',[JvOutlookBar1.Pages[Index].Caption]); Statusbar.SimpleText := Format('Page changed to "%s"',
[JvOutlookBar1.Pages[Index].Caption]);
end; end;
procedure TOLBarMainForm.JvOutlookBar1ContextPopup(Sender: TObject; procedure TOLBarMainForm.JvOutlookBar1ContextPopup(Sender: TObject;
@ -202,6 +206,11 @@ begin
JvOutlookbar1.Themed := chkThemed.Checked; JvOutlookbar1.Themed := chkThemed.Checked;
end; end;
procedure TOLBarMainForm.ChkThemedBackgroundChange(Sender: TObject);
begin
JvOutlookbar1.ThemedBackground := ChkThemedBackground.Checked;
end;
procedure TOLBarMainForm.FormCreate(Sender: TObject); procedure TOLBarMainForm.FormCreate(Sender: TObject);
begin begin
Memo1.Wordwrap := True; Memo1.Wordwrap := True;

View File

@ -67,7 +67,9 @@ type
function DoGetElementSize(DC: HDC; Details: TThemedElementDetails; Rect: PRect; function DoGetElementSize(DC: HDC; Details: TThemedElementDetails; Rect: PRect;
ElementSize: TElementSize; out Size: TSize): Boolean; ElementSize: TElementSize; out Size: TSize): Boolean;
{$ENDIF ~COMPILER16_UP} {$ENDIF ~COMPILER16_UP}
*******************)
public public
(****************
{$IFNDEF COMPILER7_UP} {$IFNDEF COMPILER7_UP}
procedure ApplyThemeChange; procedure ApplyThemeChange;
{$ENDIF ~COMPILER7_UP} {$ENDIF ~COMPILER7_UP}
@ -79,8 +81,10 @@ type
function GetElementSize(DC: HDC; Details: TThemedElementDetails; const Rect: TRect; function GetElementSize(DC: HDC; Details: TThemedElementDetails; const Rect: TRect;
ElementSize: TElementSize; out Size: TSize): Boolean; overload; ElementSize: TElementSize; out Size: TSize): Boolean; overload;
function IsSystemStyle: Boolean; function IsSystemStyle: Boolean;
********************)
function Enabled: Boolean; function Enabled: Boolean;
function Available: Boolean; function Available: Boolean;
(********************
function GetSystemColor(Color: TColor): TColor; function GetSystemColor(Color: TColor): TColor;
{$ENDIF ~COMPILER16_UP} {$ENDIF ~COMPILER16_UP}
****************) ****************)
@ -842,6 +846,7 @@ function TThemeServicesEx.IsSystemStyle: Boolean;
begin begin
Result := True; Result := True;
end; end;
**********************)
function TThemeServicesEx.Enabled: Boolean; function TThemeServicesEx.Enabled: Boolean;
begin begin
@ -852,6 +857,8 @@ function TThemeServicesEx.Available: Boolean;
begin begin
Result := ThemesAvailable; Result := ThemesAvailable;
end; end;
(******************************
{$ENDIF ~COMPILER16_UP} {$ENDIF ~COMPILER16_UP}
*******************) *******************)

View File

@ -41,6 +41,7 @@ Known Issues:
unit JvOutlookBar; unit JvOutlookBar;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{.$DEFINE JVCLThemesEnabled}
interface interface
@ -299,7 +300,7 @@ type
procedure SetSmallImages(const Value: TCustomImageList); procedure SetSmallImages(const Value: TCustomImageList);
procedure SetPageImages(const Value: TCustomImageList); procedure SetPageImages(const Value: TCustomImageList);
procedure SetPageButtonHeight(const Value: Integer); procedure SetPageButtonHeight(const Value: Integer);
procedure SetThemedBackground(const Value: Boolean);
function DrawTopPages: Integer; function DrawTopPages: Integer;
procedure DrawCurrentPage(PageIndex: Integer); procedure DrawCurrentPage(PageIndex: Integer);
procedure DrawPageButton(R: TRect; Index: Integer; Pressed: Boolean); procedure DrawPageButton(R: TRect; Index: Integer; Pressed: Boolean);
@ -308,6 +309,7 @@ type
procedure DrawArrowButtons(Index: Integer); procedure DrawArrowButtons(Index: Integer);
procedure DrawButtonFrame(PageIndex, ButtonIndex, PressedIndex: Integer); procedure DrawButtonFrame(PageIndex, ButtonIndex, PressedIndex: Integer);
function DrawPicture(R: TRect; Picture: TPicture): Boolean; function DrawPicture(R: TRect; Picture: TPicture): Boolean;
procedure DoDwnClick(Sender: TObject); procedure DoDwnClick(Sender: TObject);
procedure DoUpClick(Sender: TObject); procedure DoUpClick(Sender: TObject);
procedure RedrawRect(R: TRect; Erase: Boolean = False); procedure RedrawRect(R: TRect; Erase: Boolean = False);
@ -322,6 +324,7 @@ type
procedure SetDisabledFontColor1(const Value: TColor); procedure SetDisabledFontColor1(const Value: TColor);
procedure SetDisabledFontColor2(const Value: TColor); procedure SetDisabledFontColor2(const Value: TColor);
procedure SetThemed(const Value: Boolean); procedure SetThemed(const Value: Boolean);
procedure SetThemedBackground(const Value: Boolean);
procedure SetWordWrap(const Value: Boolean); procedure SetWordWrap(const Value: Boolean);
protected protected
(* (*
@ -329,6 +332,7 @@ type
function DoEraseBackground(ACanvas: TCanvas; Param: LPARAM): Boolean; override; function DoEraseBackground(ACanvas: TCanvas; Param: LPARAM): Boolean; override;
{$ENDIF} {$ENDIF}
*) *)
procedure CreateHandle; override;
procedure FontChanged; override; procedure FontChanged; override;
function GetButtonHeight(PageIndex, ButtonIndex: Integer): Integer; function GetButtonHeight(PageIndex, ButtonIndex: Integer): Integer;
function GetButtonTopHeight(PageIndex, ButtonIndex: Integer): Integer; function GetButtonTopHeight(PageIndex, ButtonIndex: Integer): Integer;
@ -339,6 +343,7 @@ type
function GetPageTextRect(Index: Integer): TRect; function GetPageTextRect(Index: Integer): TRect;
function GetPageRect(Index: Integer): TRect; function GetPageRect(Index: Integer): TRect;
function GetTextSize(PageIndex, ButtonIndex: Integer): TSize; function GetTextSize(PageIndex, ButtonIndex: Integer): TSize;
function IsThemedStored: Boolean;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure Paint; override; procedure Paint; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
@ -356,13 +361,9 @@ type
function DoDrawPageButton(ARect: TRect; Index: Integer; Down: Boolean): Boolean; function DoDrawPageButton(ARect: TRect; Index: Integer; Down: Boolean): Boolean;
function DoDrawButton(ARect: TRect; Index: Integer; Down, Inside: Boolean): Boolean; function DoDrawButton(ARect: TRect; Index: Integer; Down, Inside: Boolean): Boolean;
function DoDrawButtonFrame(ARect: TRect; Index: Integer; Down, Inside: Boolean): Boolean; function DoDrawButtonFrame(ARect: TRect; Index: Integer; Down, Inside: Boolean): Boolean;
function DoCustomDraw(ARect: TRect; Stage: TJvOutlookBarCustomDrawStage; Index: Integer; Down, Inside: Boolean): Boolean; virtual; function DoCustomDraw(ARect: TRect; Stage: TJvOutlookBarCustomDrawStage;
public Index: Integer; Down, Inside: Boolean): Boolean; virtual;
constructor Create(AOwner: TComponent); override; procedure Resize; override;
destructor Destroy; override;
procedure InitiateAction; override;
function GetButtonAtPos(P: TPoint): TJvOutlookBarButton;
function GetPageButtonAtPos(P: TPoint): TJvOutlookBarPage;
protected protected
property PopUpObject: TObject read FPopUpObject write FPopUpObject; property PopUpObject: TObject read FPopUpObject write FPopUpObject;
property Width default 100; property Width default 100;
@ -379,6 +380,7 @@ type
property ButtonSize: TJvBarButtonSize read FButtonSize write SetButtonSize default olbsLarge; property ButtonSize: TJvBarButtonSize read FButtonSize write SetButtonSize default olbsLarge;
property PageButtonHeight: Integer read FPageButtonHeight write SetPageButtonHeight default 19; property PageButtonHeight: Integer read FPageButtonHeight write SetPageButtonHeight default 19;
property ActivePageIndex: Integer read GetActivePageIndex write SetActivePageIndex default 0; property ActivePageIndex: Integer read GetActivePageIndex write SetActivePageIndex default 0;
property Themed: Boolean read FThemed write SetThemed stored IsThemedStored;
property ThemedBackground: Boolean read FThemedBackGround write SetThemedBackground default True; property ThemedBackground: Boolean read FThemedBackGround write SetThemedBackground default True;
property OnPageChanging: TOutlookBarPageChanging read FOnPageChanging write FOnPageChanging; property OnPageChanging: TOutlookBarPageChanging read FOnPageChanging write FOnPageChanging;
property OnPageChange: TOutlookBarPageChange read FOnPageChange write FOnPageChange; property OnPageChange: TOutlookBarPageChange read FOnPageChange write FOnPageChange;
@ -386,11 +388,16 @@ type
property OnEditButton: TOutlookBarEditCaption read FOnEditButton write FOnEditButton; property OnEditButton: TOutlookBarEditCaption read FOnEditButton write FOnEditButton;
property OnEditPage: TOutlookBarEditCaption read FOnEditPage write FOnEditPage; property OnEditPage: TOutlookBarEditCaption read FOnEditPage write FOnEditPage;
property OnCustomDraw: TJvOutlookBarCustomDrawEvent read FOnCustomDraw write FOnCustomDraw; property OnCustomDraw: TJvOutlookBarCustomDrawEvent read FOnCustomDraw write FOnCustomDraw;
property Themed:Boolean read FThemed write SetThemed;
property PageBtnProps:TJvPageBtnProps read FPageBtnProps; property PageBtnProps:TJvPageBtnProps read FPageBtnProps;
property DisabledFontColor1:TColor read FDisabledFontColor1 write SetDisabledFontColor1; //clWhite; property DisabledFontColor1:TColor read FDisabledFontColor1 write SetDisabledFontColor1; //clWhite;
property DisabledFontColor2:TColor read FDisabledFontColor2 write SetDisabledFontColor2; //clGrayText; property DisabledFontColor2:TColor read FDisabledFontColor2 write SetDisabledFontColor2; //clGrayText;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure InitiateAction; override;
function GetButtonAtPos(P: TPoint): TJvOutlookBarButton;
function GetPageButtonAtPos(P: TPoint): TJvOutlookBarPage;
public public
property ActivePage: TJvOutlookBarPage read GetActivePage; property ActivePage: TJvOutlookBarPage read GetActivePage;
property WordWrap: Boolean read FWordWrap write SetWordWrap default True; property WordWrap: Boolean read FWordWrap write SetWordWrap default True;
@ -399,7 +406,6 @@ type
TJvOutlookBar = class(TJvCustomOutlookBar) TJvOutlookBar = class(TJvCustomOutlookBar)
public public
property PopUpObject; property PopUpObject;
property Themed;
property DisabledFontColor1; property DisabledFontColor1;
property DisabledFontColor2; property DisabledFontColor2;
property PageBtnProps; property PageBtnProps;
@ -413,6 +419,7 @@ type
property ButtonSize; property ButtonSize;
property PageButtonHeight; property PageButtonHeight;
property ActivePageIndex; property ActivePageIndex;
property Themed;
property ThemedBackground; property ThemedBackground;
property OnButtonClick; property OnButtonClick;
property OnCustomDraw; property OnCustomDraw;
@ -423,6 +430,7 @@ type
property Action; property Action;
property Anchors; property Anchors;
property BiDiMode; property BiDiMode;
property BorderSpacing;
property ParentBiDiMode; property ParentBiDiMode;
property DragCursor; property DragCursor;
property DragKind; property DragKind;
@ -456,6 +464,7 @@ implementation
uses uses
Math, Math,
JvThemes,
JvConsts, JvJVCLUtils; JvConsts, JvJVCLUtils;
{$R ..\..\resource\JvOutlookBar.res} {$R ..\..\resource\JvOutlookBar.res}
@ -654,7 +663,7 @@ begin
*) *)
end; end;
(*
//=== { TJvRepeatButton } ==================================================== //=== { TJvRepeatButton } ====================================================
type type
@ -714,6 +723,7 @@ begin
raise; raise;
end; end;
end; end;
*)
//=== { TJvOutlookBarButtonActionLink } ====================================== //=== { TJvOutlookBarButtonActionLink } ======================================
@ -1329,17 +1339,16 @@ begin
TJvCustomOutlookBar(Owner).Repaint; TJvCustomOutlookBar(Owner).Repaint;
end; end;
(*
//=== { TJvThemedTopBottomButton } =========================================== //=== { TJvThemedTopBottomButton } ===========================================
{$IFDEF JVCLThemesEnabled}
type type
TJvThemedTopBottomButton = class(TJvRepeatButton) TJvThemedTopBottomButton = class(TJvRepeatButton)
private private
FIsUpBtn: Boolean; FIsUpBtn: Boolean;
protected protected
procedure WMEraseBkgnd(var Msg: TWmEraseBkgnd); message WM_ERASEBKGND;
procedure Paint; override; procedure Paint; override;
// procedure WMEraseBkgnd(var Msg: TLMEraseBkgnd); message LM_ERASEBKGND;
end; end;
procedure TJvThemedTopBottomButton.Paint; procedure TJvThemedTopBottomButton.Paint;
@ -1349,7 +1358,8 @@ var
begin begin
if csDestroying in ComponentState then if csDestroying in ComponentState then
Exit; Exit;
if {Themed}StyleServices.Enabled and (not Flat) then
if StyleServices.Enabled and (not Flat) then
begin begin
if not Enabled then if not Enabled then
Button := tsArrowBtnUpDisabled Button := tsArrowBtnUpDisabled
@ -1372,13 +1382,13 @@ begin
else else
inherited Paint; inherited Paint;
end; end;
{
procedure TJvThemedTopBottomButton.WMEraseBkgnd(var Msg: TWmEraseBkgnd); procedure TJvThemedTopBottomButton.WMEraseBkgnd(var Msg: TLMEraseBkgnd);
begin begin
Msg.Result := 1; Msg.Result := 1;
end; end;
}
{$ENDIF JVCLThemesEnabled} *)
//=== { TJvCustomOutlookBar } ================================================ //=== { TJvCustomOutlookBar } ================================================
@ -1391,21 +1401,24 @@ begin
FWordWrap := True; FWordWrap := True;
FPageBtnProps := TJvPageBtnProps.Create(self); FPageBtnProps := TJvPageBtnProps.Create(self);
DoubleBuffered := True; DoubleBuffered := True;
FThemed := ThemeServices.ThemesEnabled; FThemed := StyleServices.Enabled;
FThemedBackground := true;
ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque]; ControlStyle := ControlStyle - [csAcceptsControls] + [csOpaque];
// IncludeThemeStyle(Self, [csNeedsBorderPaint]); <--- wp IncludeThemeStyle(Self, [csNeedsBorderPaint]);
Bmp := TBitmap.Create; Bmp := TBitmap.Create;
FDisabledFontColor1 := clWhite; FDisabledFontColor1 := clWhite;
FDisabledFontColor2 := clGrayText; FDisabledFontColor2 := clGrayText;
try try
{$IFDEF JVCLThemesEnabled} // {$IFDEF JVCLThemesEnabled}
{
FTopButton := TJvThemedTopBottomButton.Create(Self); FTopButton := TJvThemedTopBottomButton.Create(Self);
TJvThemedTopBottomButton(FTopButton).FIsUpBtn := True; TJvThemedTopBottomButton(FTopButton).FIsUpBtn := True;
{$ELSE} }
FTopButton := TJvRepeatButton.Create(Self); // {$ELSE}
{$ENDIF JVCLThemesEnabled} FTopButton := TSpeedButton.Create(self); //TJvRepeatButton.Create(Self);
// {$ENDIF JVCLThemesEnabled}
with FTopButton do with FTopButton do
begin begin
Parent := Self; Parent := Self;
@ -1418,12 +1431,14 @@ begin
Top := -1000; Top := -1000;
end; end;
{$IFDEF JVCLThemesEnabled} // {$IFDEF JVCLThemesEnabled}
{
FBtmButton := TJvThemedTopBottomButton.Create(Self); FBtmButton := TJvThemedTopBottomButton.Create(Self);
TJvThemedTopBottomButton(FBtmButton).FIsUpBtn := False; TJvThemedTopBottomButton(FBtmButton).FIsUpBtn := False;
{$ELSE} }
FBtmButton := TJvRepeatButton.Create(Self); //{$ELSE}
{$ENDIF JVCLThemesEnabled} FBtmButton := TSpeedButton.Create(Self); //TJvRepeatButton.Create(Self);
//{$ENDIF JVCLThemesEnabled}
with FBtmButton do with FBtmButton do
begin begin
Parent := Self; Parent := Self;
@ -1534,9 +1549,30 @@ var
SavedColor: TColor; SavedColor: TColor;
Flags: Cardinal; Flags: Cardinal;
HasImage: Boolean; HasImage: Boolean;
Btn: TThemedButton;
Details: TThemedElementDetails;
begin begin
Assert(Assigned(FPageBtnProps)); Assert(Assigned(FPageBtnProps));
ATop := R.Top + 1; ATop := R.Top + 1;
// Background and frame
if Themed then begin
if Pressed then
Details := StyleServices.GetElementDetails(tbPushButtonPressed)
// Details := StyleServices.GetElementDetails(ttbButtonPressed)
// Details := StyleServices.GetElementDetails(tebNormalGroupHead)
else
if Index = FHotPageBtn then
Details := StyleServices.GetElementDetails(tbPushButtonHot)
// Details := StyleServices.GetElementDetails(ttbButtonHot)
// Details := StyleServices.GetElementDetails(tebNormalGroupHead)
else
Details := StyleServices.GetElementDetails(tbPushButtonNormal);
// Details := StyleServices.GetElementDetails(ttbButtonNormal);
// Details := StyleServices.GetElementDetails(tebSpecialGroupHead);
InflateRect(R, 1, 1);
StyleServices.DrawElement(Canvas.Handle, Details, R);
end else
if Pressed then if Pressed then
begin begin
if BorderStyle = bsNone then if BorderStyle = bsNone then
@ -1557,6 +1593,8 @@ begin
Frame3D(Canvas, R, FPageBtnProps.Face, FPageBtnProps.Shadow, FPageBtnProps.BorderWidth); Frame3D(Canvas, R, FPageBtnProps.Face, FPageBtnProps.Shadow, FPageBtnProps.BorderWidth);
end; end;
end; end;
// Icon
Flags := DT_CENTER or DT_VCENTER or DT_SINGLELINE; Flags := DT_CENTER or DT_VCENTER or DT_SINGLELINE;
HasImage := Assigned(PageImages) and (Pages[Index].ImageIndex >= 0) and (Pages[Index].ImageIndex < PageImages.Count); HasImage := Assigned(PageImages) and (Pages[Index].ImageIndex >= 0) and (Pages[Index].ImageIndex < PageImages.Count);
SavedDC := SaveDC(Canvas.Handle); SavedDC := SaveDC(Canvas.Handle);
@ -1596,10 +1634,20 @@ begin
finally finally
RestoreDC(Canvas.Handle, SavedDC); RestoreDC(Canvas.Handle, SavedDC);
end; end;
// Text
SetBkMode(Canvas.Handle, TRANSPARENT); SetBkMode(Canvas.Handle, TRANSPARENT);
OffsetRect(R, 0, -1); OffsetRect(R, 0, -1);
SavedColor := Canvas.Font.Color; SavedColor := Canvas.Font.Color;
try try
if Themed then begin
if not Pages[Index].Enabled then begin
OffsetRect(R, 1, 1);
Details := StyleServices.GetElementDetails(tbPushButtonPressed)
// Details := StyleServices.GetElementDetails(ttbButtonDisabled)
end;
StyleServices.DrawText(Canvas, Details, Pages[Index].Caption, R, Flags or DT_END_ELLIPSIS, 0);
end else begin
if not Pages[Index].Enabled then if not Pages[Index].Enabled then
begin begin
OffsetRect(R, 1, 1); OffsetRect(R, 1, 1);
@ -1609,6 +1657,7 @@ begin
Canvas.Font.Color := FDisabledFontColor2; //clGrayText; Canvas.Font.Color := FDisabledFontColor2; //clGrayText;
end; end;
DrawText(Canvas, Pages[Index].Caption, -1, R, Flags or DT_END_ELLIPSIS); DrawText(Canvas, Pages[Index].Caption, -1, R, Flags or DT_END_ELLIPSIS);
end;
finally finally
Canvas.Font.Color := SavedColor; Canvas.Font.Color := SavedColor;
end; end;
@ -1618,12 +1667,10 @@ function TJvCustomOutlookBar.DrawTopPages: Integer;
var var
R: TRect; R: TRect;
I: Integer; I: Integer;
{$IFDEF JVCLThemesEnabled}
ToolBar: TThemedToolBar; ToolBar: TThemedToolBar;
Details: TThemedElementDetails; Details: TThemedElementDetails;
ClipRect: TRect; ClipRect: TRect;
LColor: Cardinal; LColor: Cardinal;
{$ENDIF JVCLThemesEnabled}
begin begin
Result := -1; Result := -1;
if csDestroying in ComponentState then if csDestroying in ComponentState then
@ -1634,7 +1681,6 @@ begin
begin begin
if DoDrawPageButton(R, I, FPressedPageBtn = I) then if DoDrawPageButton(R, I, FPressedPageBtn = I) then
begin begin
{$IFDEF JVCLThemesEnabled}
if Themed then // Warren changed. if Themed then // Warren changed.
begin begin
if (FPressedPageBtn = I) or (FHotPageBtn = I) then if (FPressedPageBtn = I) or (FHotPageBtn = I) then
@ -1649,26 +1695,18 @@ begin
InflateRect(R, 1, 1); InflateRect(R, 1, 1);
StyleServices.DrawElement(Canvas.Handle, Details, R, @ClipRect); StyleServices.DrawElement(Canvas.Handle, Details, R, @ClipRect);
InflateRect(R, -1, -1); InflateRect(R, -1, -1);
end end else
else
StyleServices.DrawElement(Canvas.Handle, Details, R); StyleServices.DrawElement(Canvas.Handle, Details, R);
{ Determine text color } { Determine text color }
if FPressedPageBtn = I then if FPressedPageBtn = I then
ToolBar := ttbButtonPressed ToolBar := ttbButtonPressed
else else if FHotPageBtn = I then
if FHotPageBtn = I then
ToolBar := ttbButtonHot ToolBar := ttbButtonHot
else else
ToolBar := ttbButtonNormal; ToolBar := ttbButtonNormal;
Details := StyleServices.GetElementDetails(ToolBar); Details := StyleServices.GetElementDetails(ToolBar);
end else
with Details do
GetThemeColor(StyleServices.Theme[Element], Part, State, TMT_TEXTCOLOR, LColor);
Canvas.Font.Color := LColor;
end
else
{$ENDIF JVCLThemesEnabled}
begin begin
Canvas.Brush.Color := PageBtnProps.Face;// clBtnFace; Canvas.Brush.Color := PageBtnProps.Face;// clBtnFace;
Canvas.FillRect(R); Canvas.FillRect(R);
@ -1685,6 +1723,7 @@ begin
Result := Pages.Count - 1; Result := Pages.Count - 1;
end; end;
{ Draw the buttons inside each page }
procedure TJvCustomOutlookBar.DrawButtons(Index: Integer); procedure TJvCustomOutlookBar.DrawButtons(Index: Integer);
var var
I: Integer; I: Integer;
@ -1692,10 +1731,8 @@ var
C: TColor; C: TColor;
SavedDC: Integer; SavedDC: Integer;
SavedColor: TColor; SavedColor: TColor;
{$IFDEF JVCLThemesEnabled} flags: Integer;
ThemedColor: Cardinal;
Details: TThemedElementDetails; Details: TThemedElementDetails;
{$ENDIF JVCLThemesEnabled}
begin begin
if csDestroying in ComponentState then if csDestroying in ComponentState then
Exit; Exit;
@ -1706,25 +1743,12 @@ begin
R := GetButtonRect(Index, Pages[Index].TopButtonIndex); R := GetButtonRect(Index, Pages[Index].TopButtonIndex);
C := Canvas.Pen.Color; C := Canvas.Pen.Color;
Canvas.Font := Pages[Index].Font; Canvas.Font := Pages[Index].Font;
{$IFDEF JVCLThemesEnabled}
if Themed then
begin
Details := StyleServices.GetElementDetails(ttbButtonNormal);
with Details do
GetThemeColor(StyleServices.Theme[Element], Part, State, TMT_TEXTCOLOR, ThemedColor);
end;
{$ENDIF JVCLThemesEnabled}
try try
Canvas.Brush.Style := bsClear; Canvas.Brush.Style := bsClear;
for I := Pages[Index].TopButtonIndex to Pages[Index].Buttons.Count - 1 do for I := Pages[Index].TopButtonIndex to Pages[Index].Buttons.Count - 1 do
begin begin
Canvas.Font := Pages[Index].Font; Canvas.Font := Pages[Index].Font;
// Canvas.Rectangle(R); // DEBUG // Canvas.Rectangle(R); // DEBUG
{$IFDEF JVCLThemesEnabled}
if Themed then
Canvas.Font.Color := ThemedColor;
{$ENDIF JVCLThemesEnabled}
if Pages[Index].Buttons[I].Down then if Pages[Index].Buttons[I].Down then
begin begin
Canvas.Font := Pages[Index].DownFont; Canvas.Font := Pages[Index].DownFont;
@ -1739,15 +1763,28 @@ begin
SavedDC := SaveDC(Canvas.Handle); SavedDC := SaveDC(Canvas.Handle);
try try
if LargeImages <> nil then if LargeImages <> nil then
LargeImages.Draw(Canvas, R.Left + ((R.Right - R.Left) - LargeImages.Width) div 2, R.Top + 4, LargeImages.Draw(Canvas,
R.Left + ((R.Right - R.Left) - LargeImages.Width) div 2,
R.Top + 4,
Pages[Index].Buttons[I].ImageIndex, Pages[Index].Buttons[I].ImageIndex,
Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled
Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled); );
finally finally
RestoreDC(Canvas.Handle, SavedDC); RestoreDC(Canvas.Handle, SavedDC);
end; end;
R3 := GetButtonTextRect(ActivePageIndex, I); R3 := GetButtonTextRect(ActivePageIndex, I);
SetBkMode(Canvas.Handle, TRANSPARENT); SetBkMode(Canvas.Handle, TRANSPARENT);
if FWordWrap and (LargeImages <> nil) then
Flags := DT_WORDBREAK or DT_CENTER or DT_VCENTER
else
Flags := DT_EXPANDTABS or DT_SINGLELINE or DT_CENTER or DT_VCENTER or DT_END_ELLIPSIS;
if Themed and (Pages[Index].Color = clDefault) then begin
if Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled then
Details := StyleServices.GetElementDetails(ttbButtonNormal)
else
Details := StyleServices.GetElementDetails(ttbButtonDisabled);
StyleServices.DrawText(Canvas, Details, Pages[Index].Buttons[I].Caption, R3, Flags, 0);
end else begin
if not Pages[Index].Enabled or not Pages[Index].Buttons[I].Enabled then if not Pages[Index].Enabled or not Pages[Index].Buttons[I].Enabled then
begin begin
if ColorToRGB(Pages[Index].Color) = ColorToRGB(clGrayText) then if ColorToRGB(Pages[Index].Color) = ColorToRGB(clGrayText) then
@ -1755,12 +1792,8 @@ begin
else else
Canvas.Font.Color := clGrayText; Canvas.Font.Color := clGrayText;
end; end;
if FWordWrap then DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, Flags);
DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, end;
DT_WORDBREAK or DT_CENTER or DT_VCENTER)
else
DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3,
DT_EXPANDTABS or DT_SINGLELINE or DT_CENTER or DT_VCENTER);
finally finally
Canvas.Font.Color := SavedColor; Canvas.Font.Color := SavedColor;
end; end;
@ -1779,7 +1812,18 @@ begin
RestoreDC(Canvas.Handle, SavedDC); RestoreDC(Canvas.Handle, SavedDC);
end; end;
R3 := GetButtonTextRect(ActivePageIndex, I); R3 := GetButtonTextRect(ActivePageIndex, I);
InflateRect(R3, -4, 0);
SetBkMode(Canvas.Handle, TRANSPARENT); SetBkMode(Canvas.Handle, TRANSPARENT);
Flags := DT_EXPANDTABS or DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_NOCLIP or DT_EDITCONTROL;
if Themed and (Pages[Index].Color = clDefault) then
begin
if Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled then
Details := StyleServices.GetElementDetails(ttbButtonNormal)
else
Details := StyleServices.GetElementDetails(ttbButtonDisabled);
StyleServices.DrawText(Canvas, Details, Pages[Index].Buttons[I].Caption, R3, Flags, 0);
end else
begin
if not Pages[Index].Enabled or not Pages[Index].Buttons[I].Enabled then if not Pages[Index].Enabled or not Pages[Index].Buttons[I].Enabled then
begin begin
if ColorToRGB(Pages[Index].Color) = ColorToRGB(clGrayText) then if ColorToRGB(Pages[Index].Color) = ColorToRGB(clGrayText) then
@ -1787,9 +1831,8 @@ begin
else else
Canvas.Font.Color := clGrayText; Canvas.Font.Color := clGrayText;
end; end;
InflateRect(R3, -4, 0); DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, Flags);
DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, end;
DT_EXPANDTABS or DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_NOCLIP or DT_EDITCONTROL);
finally finally
Canvas.Font.Color := SavedColor; Canvas.Font.Color := SavedColor;
end; end;
@ -1865,14 +1908,13 @@ procedure TJvCustomOutlookBar.DrawCurrentPage(PageIndex: Integer);
var var
R: TRect; R: TRect;
AColor: TColor; AColor: TColor;
{$IFDEF JVCLThemesEnabled}
Details: TThemedElementDetails; Details: TThemedElementDetails;
{$ENDIF JVCLThemesEnabled}
begin begin
if csDestroying in ComponentState then if csDestroying in ComponentState then
Exit; Exit;
if (PageIndex < 0) or (PageIndex >= Pages.Count) or (Pages[PageIndex].Buttons = nil) then if (PageIndex < 0) or (PageIndex >= Pages.Count) or (Pages[PageIndex].Buttons = nil) then
Exit; Exit;
R := GetPageRect(PageIndex); R := GetPageRect(PageIndex);
AColor := Canvas.Brush.Color; AColor := Canvas.Brush.Color;
try try
@ -1882,14 +1924,12 @@ begin
begin begin
if not DrawPicture(R, Pages[PageIndex].Picture) then if not DrawPicture(R, Pages[PageIndex].Picture) then
begin begin
{$IFDEF JVCLThemesEnabled}
if (Canvas.Brush.Color = clDefault) and ThemedBackground and Themed then if (Canvas.Brush.Color = clDefault) and ThemedBackground and Themed then
begin begin
Details := StyleServices.GetElementDetails(tebHeaderBackgroundNormal); Details := StyleServices.GetElementDetails(tebNormalGroupBackground); //tebHeaderBackgroundNormal);
StyleServices.DrawElement(Canvas.Handle, Details, R); StyleServices.DrawElement(Canvas.Handle, Details, R);
end end
else else
{$ENDIF JVCLThemesEnabled}
begin begin
if Canvas.Brush.Color = clDefault then if Canvas.Brush.Color = clDefault then
Canvas.Brush.Color := Self.Color; Canvas.Brush.Color := Self.Color;
@ -1911,12 +1951,9 @@ procedure TJvCustomOutlookBar.DrawBottomPages(StartIndex: Integer);
var var
R: TRect; R: TRect;
I: Integer; I: Integer;
{$IFDEF JVCLThemesEnabled}
Details: TThemedElementDetails; Details: TThemedElementDetails;
ClipRect: TRect; ClipRect: TRect;
ToolBar: TThemedToolBar; ToolBar: TThemedToolBar;
LColor: Cardinal;
{$ENDIF JVCLThemesEnabled}
begin begin
if csDestroying in ComponentState then if csDestroying in ComponentState then
Exit; Exit;
@ -1925,7 +1962,7 @@ begin
begin begin
if DoDrawPageButton(R, I, FPressedPageBtn = I) then if DoDrawPageButton(R, I, FPressedPageBtn = I) then
begin begin
{$IFDEF JVCLThemesEnabled} // {$IFDEF JVCLThemesEnabled}
if Themed then if Themed then
begin begin
if (FPressedPageBtn = I) or (FHotPageBtn = I) then if (FPressedPageBtn = I) or (FHotPageBtn = I) then
@ -1940,26 +1977,18 @@ begin
InflateRect(R, 1, 1); InflateRect(R, 1, 1);
StyleServices.DrawElement(Canvas.Handle, Details, R, @ClipRect); StyleServices.DrawElement(Canvas.Handle, Details, R, @ClipRect);
InflateRect(R, -1, -1); InflateRect(R, -1, -1);
end end else
else
StyleServices.DrawElement(Canvas.Handle, Details, R); StyleServices.DrawElement(Canvas.Handle, Details, R);
{ Determine text color } { Determine text color }
if FPressedPageBtn = I then if FPressedPageBtn = I then
ToolBar := ttbButtonPressed ToolBar := ttbButtonPressed
else else if FHotPageBtn = I then
if FHotPageBtn = I then
ToolBar := ttbButtonHot ToolBar := ttbButtonHot
else else
ToolBar := ttbButtonNormal; ToolBar := ttbButtonNormal;
Details := StyleServices.GetElementDetails(ToolBar); Details := StyleServices.GetElementDetails(ToolBar);
end else
with Details do
GetThemeColor(StyleServices.Theme[Element], Part, State, TMT_TEXTCOLOR, LColor);
Canvas.Font.Color := LColor;
end
else
{$ENDIF JVCLThemesEnabled}
begin begin
Canvas.Brush.Color := PageBtnProps.Face;//clBtnFace; Canvas.Brush.Color := PageBtnProps.Face;//clBtnFace;
Canvas.FillRect(R); Canvas.FillRect(R);
@ -2161,14 +2190,17 @@ begin
end; end;
end; end;
function TJvCustomOutlookBar.IsThemedStored: Boolean;
begin
Result := not StyleServices.Enabled;
end;
procedure TJvCustomOutlookBar.Paint; procedure TJvCustomOutlookBar.Paint;
var var
I: Integer; I: Integer;
R: TRect; R: TRect;
{$IFDEF JVCLThemesEnabled}
Details: TThemedElementDetails; Details: TThemedElementDetails;
ClipRect: TRect; ClipRect: TRect;
{$ENDIF JVCLThemesEnabled}
Rgn: HRGN; Rgn: HRGN;
begin begin
if csDestroying in ComponentState then if csDestroying in ComponentState then
@ -2177,26 +2209,25 @@ begin
Canvas.Brush.Color := Self.Color; Canvas.Brush.Color := Self.Color;
if Pages.Count = 0 then // we only need to draw the background when there are no pages if Pages.Count = 0 then // we only need to draw the background when there are no pages
begin begin
{$IFDEF JVCLThemesEnabled}
if ThemedBackground and Themed then if ThemedBackground and Themed then
begin begin
R := ClientRect; R := ClientRect;
ClipRect := R; ClipRect := R;
InflateRect(R, 1, 0); InflateRect(R, 1, 0);
Details := StyleServices.GetElementDetails(ttbButtonHot); Details := StyleServices.GetElementDetails(tebNormalGroupBackground);
StyleServices.DrawElement(Canvas.Handle, Details, R, @ClipRect); StyleServices.DrawElement(Canvas.Handle, Details, R, @ClipRect);
end end
else else
{$ENDIF JVCLThemesEnabled}
begin begin
if DoDrawBackGround then if DoDrawBackGround then
Canvas.FillRect(ClientRect); Canvas.FillRect(ClientRect);
end; end;
end; end;
if IsVista then { Warren Vista paint bug workaround } {
if IsVista then // Warren Vista paint bug workaround
Canvas.FillRect(ClientRect); Canvas.FillRect(ClientRect);
}
SetBkMode(Canvas.Handle, TRANSPARENT); SetBkMode(Canvas.Handle, TRANSPARENT);
I := DrawTopPages; I := DrawTopPages;
@ -2339,9 +2370,11 @@ end;
procedure TJvCustomOutlookBar.SetThemed(const Value: Boolean); procedure TJvCustomOutlookBar.SetThemed(const Value: Boolean);
begin begin
if Value and (not ThemeServices.ThemesEnabled) then { Warren added ability to theme/detheme this component for yourself instead of just checking if XP is themed.} if Value and (not ThemeServices.ThemesEnabled) then
{ Warren added ability to theme/detheme this component for yourself instead of just checking if XP is themed.}
exit; exit;
FThemed := Value; FThemed := Value;
Invalidate;
end; end;
procedure TJvCustomOutlookBar.SetWordWrap(const Value: Boolean); procedure TJvCustomOutlookBar.SetWordWrap(const Value: Boolean);
@ -2538,10 +2571,8 @@ begin
end; end;
procedure TJvCustomOutlookBar.MouseLeave(Control: TControl); procedure TJvCustomOutlookBar.MouseLeave(Control: TControl);
{$IFDEF JVCLThemesEnabled}
var var
R: TRect; R: TRect;
{$ENDIF JVCLThemesEnabled}
begin begin
if csDesigning in ComponentState then if csDesigning in ComponentState then
Exit; Exit;
@ -2549,14 +2580,12 @@ begin
RedrawRect(FButtonRect); RedrawRect(FButtonRect);
FPressedPageBtn := -1; FPressedPageBtn := -1;
FLastButtonIndex := -1; FLastButtonIndex := -1;
{$IFDEF JVCLThemesEnabled}
if Themed and (FHotPageBtn >= 0) then if Themed and (FHotPageBtn >= 0) then
begin begin
R := GetPageButtonRect(FHotPageBtn); R := GetPageButtonRect(FHotPageBtn);
RedrawRect(R); RedrawRect(R);
FHotPageBtn := -1; FHotPageBtn := -1;
end; end;
{$ENDIF JVCLThemesEnabled}
end; end;
function TJvCustomOutlookBar.GetButtonTopHeight(PageIndex, function TJvCustomOutlookBar.GetButtonTopHeight(PageIndex,
@ -2734,8 +2763,12 @@ begin
if Value <> FThemedBackGround then if Value <> FThemedBackGround then
begin begin
FThemedBackGround := Value; FThemedBackGround := Value;
if Themed then
Invalidate;
{
if ([csDesigning, csLoading] * ComponentState = []) and Themed then if ([csDesigning, csLoading] * ComponentState = []) and Themed then
Repaint; Repaint;
}
end; end;
end; end;
@ -2752,6 +2785,20 @@ begin
end; end;
end; end;
procedure TJvCustomOutlookBar.CreateHandle;
var
i: Integer;
begin
inherited;
if Font.Size = 0 then Font.Size := 9;
for i:=0 to Pages.Count - 1 do begin
if Pages[i].Font.Size = 0 then
Pages[i].Font.Size := 9;
if Pages[i].DownFont.Size = 0 then
Pages[i].DownFont.Size := 9;
end;
end;
procedure TJvCustomOutlookBar.FontChanged; procedure TJvCustomOutlookBar.FontChanged;
var var
I: Integer; I: Integer;
@ -2850,16 +2897,22 @@ begin
Pages[I].Buttons[J].ActionChange(Pages[I].Buttons[J].Action, csLoading in ComponentState); Pages[I].Buttons[J].ActionChange(Pages[I].Buttons[J].Action, csLoading in ComponentState);
end; end;
procedure TJvCustomOutlookBar.Resize;
begin
Invalidate;
inherited;
end;
//---- Warren added page button properties Nov 2008 //---- Warren added page button properties Nov 2008
constructor TJvPageBtnProps.Create(owner: TJvCustomOUtlookBar); constructor TJvPageBtnProps.Create(owner: TJvCustomOUtlookBar);
begin begin
Fowner := owner; FOwner := owner;
FShadow := clBtnShadow; FShadow := clBtnShadow;
FHighlight := clBtnHighlight; FHighlight := clBtnHighlight;
FDkShadow := cl3DDkShadow; FDkShadow := cl3DDkShadow;
FFace := clBtnFace; FFace := clBtnFace;
FBorderWidth := 1; FBorderWidth := 1;
end; end;
@ -2888,13 +2941,4 @@ begin
FShadow := Value; FShadow := Value;
end; end;
{$IFDEF UNITVERSIONING}
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
end. end.