jvcllaz: Fix JvOutlookBar being blocked due to missing call to EnableAutoSizing. Several cosmetic changes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6354 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-04-25 17:39:48 +00:00
parent 100954c7a4
commit c99e29e309
5 changed files with 137 additions and 162 deletions

View File

@ -33,7 +33,8 @@ begin
// Timeline // Timeline
RegisterComponentEditor(TJvCustomTimeLine, TJvTimeLineEditor); RegisterComponentEditor(TJvCustomTimeLine, TJvTimeLineEditor);
RegisterPropertyEditor(TypeInfo(TDate), TJvTimeLine, 'FirstVisibledate', TDatePropertyEditor); RegisterPropertyEditor(TypeInfo(TDate), TJvTimeLine,
'FirstVisibledate', TDatePropertyEditor);
// OutlookBar // OutlookBar
{RegisterPropertyEditor(TypeInfo(TJvOutlookBarPages), TJvCustomOutlookBar, {RegisterPropertyEditor(TypeInfo(TJvOutlookBarPages), TJvCustomOutlookBar,

View File

@ -51,6 +51,7 @@ type
procedure SetValue(const Value: string); override; procedure SetValue(const Value: string); override;
end; end;
(*
TJvOutlookBarPagesProperty = class(TPropertyEditor) TJvOutlookBarPagesProperty = class(TPropertyEditor)
private private
function GetOutlookBar: TJvCustomOutlookBar; function GetOutlookBar: TJvCustomOutlookBar;
@ -59,8 +60,9 @@ type
function GetAttributes: TPropertyAttributes; override; function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override; function GetValue: string; override;
end; end;
*)
TJvOutlookBarButtonImageIndexProperty = class(TImageIndexPropertyEditor) //TJvDefaultImageIndexProperty) TJvOutlookBarButtonImageIndexProperty = class(TImageIndexPropertyEditor)
private private
function GetPage: TJvOutlookBarPage; function GetPage: TJvOutlookBarPage;
function GetBar: TJvCustomOutlookBar; function GetBar: TJvCustomOutlookBar;
@ -68,7 +70,7 @@ type
function GetImageList: TCustomImageList; override; function GetImageList: TCustomImageList; override;
end; end;
TJvOutlookBarPageImageIndexProperty = class(TImageIndexPropertyEditor) //TJvDefaultImageIndexProperty) TJvOutlookBarPageImageIndexProperty = class(TImageIndexPropertyEditor)
protected protected
function GetImageList: TCustomImageList; override; function GetImageList: TCustomImageList; override;
end; end;
@ -145,7 +147,7 @@ end;
*) *)
//=== { TJvOutlookBarPagesProperty } ========================================= //=== { TJvOutlookBarPagesProperty } =========================================
(*
procedure TJvOutlookBarPagesProperty.Edit; procedure TJvOutlookBarPagesProperty.Edit;
begin begin
// !!!!!!!!!!!! HOW DO I GET THE DESIGNER HERE ??????????????? // !!!!!!!!!!!! HOW DO I GET THE DESIGNER HERE ???????????????
@ -172,7 +174,7 @@ function TJvOutlookBarPagesProperty.GetValue: string;
begin begin
Result := Format('(%s)', [GetPropType^.Name]); Result := Format('(%s)', [GetPropType^.Name]);
end; end;
*)
//=== { TJvOutlookBarEditor } ================================================ //=== { TJvOutlookBarEditor } ================================================
@ -214,7 +216,7 @@ begin
end; end;
//=== { TJvOutlookBarActivePageProperty } ==================================== //=== TJvOutlookBarActivePageProperty ==========================================
function TJvOutlookBarActivePageProperty.GetAttributes: TPropertyAttributes; function TJvOutlookBarActivePageProperty.GetAttributes: TPropertyAttributes;
begin begin

View File

@ -38,7 +38,11 @@ object OLBarMainForm: TOLBarMainForm
Hint = 'Right-click the bar to see the options' Hint = 'Right-click the bar to see the options'
Top = 0 Top = 0
Width = 130 Width = 130
ActivePageIndex = 1
Align = alLeft Align = alLeft
BorderStyle = bsNone
Font.Color = clWindowText
LargeImages = LargeImages
Pages = < Pages = <
item item
Buttons = < Buttons = <
@ -152,21 +156,14 @@ object OLBarMainForm: TOLBarMainForm
ParentColor = False ParentColor = False
TopButtonIndex = 0 TopButtonIndex = 0
end> end>
LargeImages = LargeImages
SmallImages = SmallImages
ActivePageIndex = 1
OnButtonClick = JvOutlookBar1ButtonClick
OnPageChange = JvOutlookBar1PageChange
OnPageChanging = JvOutlookBar1PageChanging
BorderStyle = bsNone
Font.Color = clWindowText
ParentFont = False ParentFont = False
PopupMenu = popOL PopupMenu = popOL
SmallImages = SmallImages
TabOrder = 1 TabOrder = 1
OnButtonClick = JvOutlookBar1ButtonClick
OnContextPopup = JvOutlookBar1ContextPopup OnContextPopup = JvOutlookBar1ContextPopup
LargeImagesWidth = 0 OnPageChange = JvOutlookBar1PageChange
SmallImagesWidth = 0 OnPageChanging = JvOutlookBar1PageChanging
PageImagesWidth = 0
end end
object Panel1: TPanel object Panel1: TPanel
Left = 134 Left = 134
@ -4221,7 +4218,7 @@ object OLBarMainForm: TOLBarMainForm
object popPage: TPopupMenu object popPage: TPopupMenu
Images = SmallImages Images = SmallImages
left = 320 left = 320
top = 144 top = 136
object Editpagecaption1: TMenuItem object Editpagecaption1: TMenuItem
Action = acEditPageCaption Action = acEditPageCaption
end end

View File

@ -19,7 +19,7 @@
"/> "/>
<License Value="The JVCL is released in accordance with the MPL 1.1 license. To get your own copy or read it, go to http://www.mozilla.org/MPL/MPL-1.1.html. "/> <License Value="The JVCL is released in accordance with the MPL 1.1 license. To get your own copy or read it, go to http://www.mozilla.org/MPL/MPL-1.1.html. "/>
<Version Major="1" Release="4"/> <Version Major="1" Release="4"/>
<Files Count="3"> <Files Count="4">
<Item1> <Item1>
<Filename Value="..\design\JvCustomControls\JvCustomReg.pas"/> <Filename Value="..\design\JvCustomControls\JvCustomReg.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
@ -33,6 +33,10 @@
<Filename Value="..\design\JvCustomControls\JvOutlookBarEditors.pas"/> <Filename Value="..\design\JvCustomControls\JvOutlookBarEditors.pas"/>
<UnitName Value="JvOutlookBarEditors"/> <UnitName Value="JvOutlookBarEditors"/>
</Item3> </Item3>
<Item4>
<Filename Value="..\design\JvCustomControls\jvoutlookbarform.pas"/>
<UnitName Value="JvOutlookBarForm"/>
</Item4>
</Files> </Files>
<RequiredPkgs Count="4"> <RequiredPkgs Count="4">
<Item1> <Item1>

View File

@ -41,7 +41,7 @@ Known Issues:
unit JvOutlookBar; unit JvOutlookBar;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{.$DEFINE JVCLThemesEnabled}
interface interface
@ -51,12 +51,6 @@ uses
Buttons, Controls, Graphics, ImgList, Forms, StdCtrls, ExtCtrls, Themes, Buttons, Controls, Graphics, ImgList, Forms, StdCtrls, ExtCtrls, Themes,
JvJCLUtils, JvComponent; JvJCLUtils, JvComponent;
(*
{$IF LCL_FullVersion >= 1090000}
{$DEFINE HAS_SCALED_IMAGELIST}
{$ENDIF}
*)
const const
CM_CAPTION_EDITING = CM_BASE + 756; CM_CAPTION_EDITING = CM_BASE + 756;
CM_CAPTION_EDIT_ACCEPT = CM_CAPTION_EDITING + 1; CM_CAPTION_EDIT_ACCEPT = CM_CAPTION_EDITING + 1;
@ -244,7 +238,6 @@ type
FShadow: TColor; FShadow: TColor;
FDkShadow: TColor; FDkShadow: TColor;
FBorderWidth: Integer; FBorderWidth: Integer;
procedure SetDkShadow(const Value: TColor); procedure SetDkShadow(const Value: TColor);
procedure SetFace(const Value: TColor); procedure SetFace(const Value: TColor);
procedure SetHighlight(const Value: TColor); procedure SetHighlight(const Value: TColor);
@ -257,8 +250,7 @@ type
property Highlight:TColor read FHighlight write SetHighlight default clBtnHighlight; property Highlight:TColor read FHighlight write SetHighlight default clBtnHighlight;
property DkShadow:TColor read FDkShadow write SetDkShadow default cl3DDkShadow; property DkShadow:TColor read FDkShadow write SetDkShadow default cl3DDkShadow;
property Face:TColor read FFace write SetFace default clBtnFace; property Face:TColor read FFace write SetFace default clBtnFace;
property BorderWidth : Integer read FBorderWidth write SetBorderWidth default 1;
property BorderWidth : INteger read FBorderWidth write SetBorderWidth default 1;
end; end;
TJvCustomOutlookBar = class(TJvCustomControl) TJvCustomOutlookBar = class(TJvCustomControl)
@ -298,7 +290,6 @@ type
FDisabledFontColor1: TColor; FDisabledFontColor1: TColor;
FDisabledFontColor2: TColor; FDisabledFontColor2: TColor;
FWordWrap: Boolean; FWordWrap: Boolean;
function GetActivePage: TJvOutlookBarPage; function GetActivePage: TJvOutlookBarPage;
function GetActivePageIndex: Integer; function GetActivePageIndex: Integer;
function IsStoredPageButtonHeight: Boolean; function IsStoredPageButtonHeight: Boolean;
@ -314,23 +305,19 @@ type
procedure SetThemed(const Value: Boolean); procedure SetThemed(const Value: Boolean);
procedure SetThemedBackground(const Value: Boolean); procedure SetThemedBackground(const Value: Boolean);
procedure SetWordWrap(const Value: Boolean); procedure SetWordWrap(const Value: Boolean);
procedure CMCaptionEditing(var Msg: TLMessage); message CM_CAPTION_EDITING;
procedure CMCaptionEditAccept(var Msg: TLMessage); message CM_CAPTION_EDIT_ACCEPT; procedure CMCaptionEditAccept(var Msg: TLMessage); message CM_CAPTION_EDIT_ACCEPT;
procedure CMCaptionEditCancel(var Msg: TLMessage); message CM_CAPTION_EDIT_CANCEL; procedure CMCaptionEditCancel(var Msg: TLMessage); message CM_CAPTION_EDIT_CANCEL;
procedure CMCaptionEditing(var Msg: TLMessage); message CM_CAPTION_EDITING;
procedure CMDialogChar(var Msg: TCMDialogChar); message CM_DIALOGCHAR; procedure CMDialogChar(var Msg: TCMDialogChar); message CM_DIALOGCHAR;
protected protected
function CalcPageButtonHeight: Integer; function CalcPageButtonHeight: Integer;
procedure CalculatePreferredSize(var PreferredWidth, procedure CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; WithThemeSpace: Boolean); override; PreferredHeight: integer; WithThemeSpace: Boolean); override;
procedure ColorChanged; override; procedure ColorChanged; override;
procedure CreateHandle; override;
{$IF LCL_FullVersion >= 1080000} {$IF LCL_FullVersion >= 1080000}
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override; const AXProportion, AYProportion: Double); override;
{$ENDIF} {$ENDIF}
procedure DoButtonClick(Index: Integer); virtual; procedure DoButtonClick(Index: Integer); virtual;
procedure DoButtonEdit(NewText: string; B: TJvOutlookBarButton); procedure DoButtonEdit(NewText: string; B: TJvOutlookBarButton);
procedure DoChangeLinkChange(Sender: TObject); procedure DoChangeLinkChange(Sender: TObject);
@ -383,12 +370,11 @@ type
procedure Paint; override; procedure Paint; override;
procedure RedrawRect(R: TRect; Erase: Boolean = False); procedure RedrawRect(R: TRect; Erase: Boolean = False);
procedure Resize; override; procedure Resize; override;
property PopUpObject: TObject read FPopUpObject write FPopUpObject; property PopUpObject: TObject read FPopUpObject write FPopUpObject;
property UpButton: TSpeedButton read FUpButton; property UpButton: TSpeedButton read FUpButton;
property DownButton: TSpeedButton read FDownButton; property DownButton: TSpeedButton read FDownButton;
property BorderStyle default bsSingle; property BorderStyle default bsSingle;
property Font; // property Font;
property Color default clBtnShadow; property Color default clBtnShadow;
property Pages: TJvOutlookBarPages read FPages write SetPages; property Pages: TJvOutlookBarPages read FPages write SetPages;
property LargeImages: TCustomImageList read FLargeImages write SetLargeImages; property LargeImages: TCustomImageList read FLargeImages write SetLargeImages;
@ -399,15 +385,15 @@ type
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 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 PageBtnProps: TJvPageBtnProps read FPageBtnProps;
property DisabledFontColor1: TColor read FDisabledFontColor1 write SetDisabledFontColor1; //clWhite;
property DisabledFontColor2: TColor read FDisabledFontColor2 write SetDisabledFontColor2; //clGrayText;
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;
property OnButtonClick: TOutlookBarButtonClick read FOnButtonClick write FOnButtonClick; property OnButtonClick: TOutlookBarButtonClick read FOnButtonClick write FOnButtonClick;
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 PageBtnProps:TJvPageBtnProps read FPageBtnProps;
property DisabledFontColor1:TColor read FDisabledFontColor1 write SetDisabledFontColor1; //clWhite;
property DisabledFontColor2:TColor read FDisabledFontColor2 write SetDisabledFontColor2; //clGrayText;
{$IF LCL_FullVersion >= 1090000} {$IF LCL_FullVersion >= 1090000}
private private
@ -507,7 +493,6 @@ type
property OnStartDock; property OnStartDock;
property OnStartDrag; property OnStartDrag;
property OnUnDock; property OnUnDock;
{$IF LCL_FullVersion >= 1090000} {$IF LCL_FullVersion >= 1090000}
property LargeImagesWidth; property LargeImagesWidth;
property SmallImagesWidth; property SmallImagesWidth;
@ -867,7 +852,6 @@ begin
// Mantis 3688 // Mantis 3688
FActionLink.Free; FActionLink.Free;
inherited Destroy; inherited Destroy;
end; end;
@ -1097,6 +1081,7 @@ begin
TJvOutlookBarPage(Owner).Changed(False); TJvOutlookBarPage(Owner).Changed(False);
end; end;
//=== { TJvOutlookBarPage } ================================================== //=== { TJvOutlookBarPage } ==================================================
constructor TJvOutlookBarPage.Create(ACollection: Classes.TCollection); constructor TJvOutlookBarPage.Create(ACollection: Classes.TCollection);
@ -1351,6 +1336,7 @@ begin
Buttons[Value].Down := True; Buttons[Value].Down := True;
end; end;
//=== { TJvOutlookBarPages } ================================================= //=== { TJvOutlookBarPages } =================================================
constructor TJvOutlookBarPages.Create(AOwner: TPersistent); constructor TJvOutlookBarPages.Create(AOwner: TPersistent);
@ -1532,7 +1518,7 @@ end;
destructor TJvCustomOutlookBar.Destroy; destructor TJvCustomOutlookBar.Destroy;
begin begin
FEdit.Free; // FEdit.Free;
FLargeChangeLink.Free; FLargeChangeLink.Free;
FSmallChangeLink.Free; FSmallChangeLink.Free;
FPageChangeLink.Free; FPageChangeLink.Free;
@ -1570,11 +1556,6 @@ begin
FPageButtonHeight := Canvas.TextHeight('Tg') + 4; FPageButtonHeight := Canvas.TextHeight('Tg') + 4;
end; end;
procedure TJvCustomOutlookBar.CreateHandle;
begin
inherited;
end;
procedure TJvCustomOutlookBar.DoDwnClick(Sender: TObject); procedure TJvCustomOutlookBar.DoDwnClick(Sender: TObject);
begin begin
if FDownButton.Visible then if FDownButton.Visible then
@ -1622,7 +1603,6 @@ begin
end; end;
end; end;
{ Warren modified this so you can have some weird page button colors that aren't standard windows colors } { Warren modified this so you can have some weird page button colors that aren't standard windows colors }
procedure TJvCustomOutlookBar.DrawPageButton(R: TRect; Index: Integer; Pressed: Boolean); procedure TJvCustomOutlookBar.DrawPageButton(R: TRect; Index: Integer; Pressed: Boolean);
var var
@ -1811,7 +1791,6 @@ var
R, R2, R3: TRect; R, R2, R3: TRect;
C: TColor; C: TColor;
SavedDC: Integer; SavedDC: Integer;
SavedColor: TColor;
flags: Integer; flags: Integer;
Details: TThemedElementDetails; Details: TThemedElementDetails;
w: Integer; w: Integer;
@ -1847,12 +1826,11 @@ begin
begin begin
if Pages[Index].Buttons[I].Down then if Pages[Index].Buttons[I].Down then
DrawButtonFrame(Index, I, I); DrawButtonFrame(Index, I, I);
if DoDrawButton(R, I, Pages[Index].Buttons[I].Down, I = FLastButtonIndex) then if DoDrawButton(R, I, Pages[Index].Buttons[I].Down, I = FLastButtonIndex) then
case Pages[Index].ButtonSize of case Pages[Index].ButtonSize of
olbsLarge: olbsLarge:
begin begin
SavedColor := Canvas.Font.Color;
try
SavedDC := SaveDC(Canvas.Handle); SavedDC := SaveDC(Canvas.Handle);
try try
if LargeImages <> nil then begin if LargeImages <> nil then begin
@ -1882,6 +1860,10 @@ begin
Flags := DT_WORDBREAK or DT_CENTER or DT_VCENTER Flags := DT_WORDBREAK or DT_CENTER or DT_VCENTER
else else
Flags := DT_EXPANDTABS or DT_SINGLELINE or DT_CENTER or DT_VCENTER or DT_END_ELLIPSIS; Flags := DT_EXPANDTABS or DT_SINGLELINE or DT_CENTER or DT_VCENTER or DT_END_ELLIPSIS;
if Pages[Index].Buttons[I].Down then
Canvas.Font.Assign(Pages[Index].DownFont)
else
Canvas.Font.Assign(Pages[Index].Font);
if Themed and (Pages[Index].Color = clDefault) then begin if Themed and (Pages[Index].Color = clDefault) then begin
if Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled then if Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled then
Details := StyleServices.GetElementDetails(ttbButtonNormal) Details := StyleServices.GetElementDetails(ttbButtonNormal)
@ -1889,28 +1871,19 @@ begin
Details := StyleServices.GetElementDetails(ttbButtonDisabled); Details := StyleServices.GetElementDetails(ttbButtonDisabled);
StyleServices.DrawText(Canvas, Details, Pages[Index].Buttons[I].Caption, R3, Flags, 0); StyleServices.DrawText(Canvas, Details, Pages[Index].Buttons[I].Caption, R3, Flags, 0);
end else begin end else begin
if Pages[Index].Buttons[I].Down then
Canvas.Font.Assign(Pages[Index].DownFont)
else
Canvas.Font.Assign(Pages[Index].Font);
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
Canvas.Font.Color := PageBtnProps.Face //clBtnFace Canvas.Font.Color := FPageBtnProps.Face //clBtnFace
else else
Canvas.Font.Color := clGrayText; Canvas.Font.Color := clGrayText;
end; end;
DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, Flags); DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, Flags);
end; end;
finally
Canvas.Font.Color := SavedColor;
end;
end; end;
olbsSmall: olbsSmall:
begin begin
SavedColor := Canvas.Font.Color;
try
SavedDC := SaveDC(Canvas.Handle); SavedDC := SaveDC(Canvas.Handle);
try try
if SmallImages <> nil then begin if SmallImages <> nil then begin
@ -1936,6 +1909,10 @@ begin
// InflateRect(R3, -Scale96ToForm(4), 0); // InflateRect(R3, -Scale96ToForm(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; Flags := DT_EXPANDTABS or DT_SINGLELINE or DT_LEFT or DT_VCENTER or DT_NOCLIP or DT_EDITCONTROL;
if Pages[Index].Buttons[I].Down then
Canvas.Font.Assign(Pages[Index].DownFont)
else
Canvas.Font.Assign(Pages[Index].Font);
if Themed and (Pages[Index].Color = clDefault) then if Themed and (Pages[Index].Color = clDefault) then
begin begin
if Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled then if Pages[Index].Enabled and Pages[Index].Buttons[I].Enabled then
@ -1945,22 +1922,15 @@ begin
StyleServices.DrawText(Canvas, Details, Pages[Index].Buttons[I].Caption, R3, Flags, 0); StyleServices.DrawText(Canvas, Details, Pages[Index].Buttons[I].Caption, R3, Flags, 0);
end else end else
begin begin
if Pages[Index].Buttons[I].Down then
Canvas.Font.Assign(Pages[Index].DownFont)
else
Canvas.Font.Assign(Pages[Index].Font);
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
Canvas.Font.Color := PageBtnProps.Face//clBtnFace Canvas.Font.Color := FPageBtnProps.Face//clBtnFace
else else
Canvas.Font.Color := clGrayText; Canvas.Font.Color := clGrayText;
end; end;
DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, Flags); DrawText(Canvas.Handle, PChar(Pages[Index].Buttons[I].Caption), -1, R3, Flags);
end; end;
finally
Canvas.Font.Color := SavedColor;
end;
end; end;
end; end;
OffsetRect(R, 0, GetButtonHeight(Index, I)); OffsetRect(R, 0, GetButtonHeight(Index, I));
@ -2130,7 +2100,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 if Themed then
begin begin
if (FPressedPageBtn = I) or (FHotPageBtn = I) then if (FPressedPageBtn = I) or (FHotPageBtn = I) then
@ -2158,7 +2127,7 @@ begin
Details := StyleServices.GetElementDetails(ToolBar); Details := StyleServices.GetElementDetails(ToolBar);
end else end else
begin begin
Canvas.Brush.Color := PageBtnProps.Face;//clBtnFace; Canvas.Brush.Color := FPageBtnProps.Face;//clBtnFace;
Canvas.FillRect(R); Canvas.FillRect(R);
end; end;
DrawPageButton(R, I, FPressedPageBtn = I); DrawPageButton(R, I, FPressedPageBtn = I);
@ -2411,7 +2380,8 @@ begin
Result.Bottom := Result.Top + textSize.cy + dist2; Result.Bottom := Result.Top + textSize.cy + dist2;
Result.Right := Result.Left + textSize.cx + dist4; Result.Right := Result.Left + textSize.cx + dist4;
OffsetRect(Result, 0, -(ButtonHeight - (Result.Bottom - Result.Top)) div 4); OffsetRect(Result, 0, -(ButtonHeight - (Result.Bottom - Result.Top)) div 4);
end; end else
InflateRect(Result, -dist4, 0);
end; end;
end; end;
@ -3008,8 +2978,8 @@ end;
function TJvCustomOutlookBar.GetActivePage: TJvOutlookBarPage; function TJvCustomOutlookBar.GetActivePage: TJvOutlookBarPage;
begin begin
if (ActivePageIndex > -1) and (ActivePageIndex < Pages.Count) then if (FActivePageIndex > -1) and (FActivePageIndex < FPages.Count) then
Result := Pages[ActivePageIndex] Result := FPages[FActivePageIndex]
else else
Result := nil; Result := nil;
end; end;
@ -3053,12 +3023,12 @@ var
I: Integer; I: Integer;
begin begin
inherited FontChanged; inherited FontChanged;
for I := 0 to Pages.Count - 1 do for I := 0 to FPages.Count - 1 do
if Pages[I].ParentFont then if FPages[I].ParentFont then
begin //set the font of the buttons as well begin //set the font of the buttons as well
Pages[I].ParentFont := False; FPages[I].ParentFont := False;
Pages[I].Font := Self.Font; FPages[I].Font := Self.Font;
Pages[I].ParentFont := True; // reset flag FPages[I].ParentFont := True; // reset flag
end; end;
end; end;
@ -3109,6 +3079,7 @@ begin
if IsStoredPageButtonHeight then if IsStoredPageButtonHeight then
FPageButtonHeight := round(FPageButtonHeight * AYProportion); FPageButtonHeight := round(FPageButtonHeight * AYProportion);
finally finally
EnableAutoSizing;
end; end;
end; end;
end; end;