From 8e3c500a4df7d1534d8a98344f879026835399ae Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 26 May 2009 01:39:02 +0000 Subject: [PATCH] lcl: move default TButtonPanel button constraints to the ThemeServices git-svn-id: trunk@20214 - --- lcl/buttonpanel.pas | 26 ++++++++++++++++++-------- lcl/themes.pas | 5 ++++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lcl/buttonpanel.pas b/lcl/buttonpanel.pas index be6dc2a78d..f3adf3fb8e 100644 --- a/lcl/buttonpanel.pas +++ b/lcl/buttonpanel.pas @@ -19,8 +19,8 @@ unit ButtonPanel; interface uses - Buttons, Classes, Controls, ExtCtrls, Forms, Graphics, GraphType, SysUtils, - LCLStrConsts; + Types, SysUtils, Classes, Controls, ExtCtrls, Buttons, Forms, GraphType, + Graphics, LCLStrConsts, Themes; type TButtonOrder = (boDefault, boCloseCancelOK, boCloseOKCancel); @@ -151,8 +151,6 @@ const DEFAULT_BUTTONPANEL_BORDERSPACING: TControlBorderSpacingDefault = ( Left:0; Top:0; Right:0; Bottom:0; Around:6; ); - DefMinWidth = 75; - DefMinHeight = 25; procedure Register; begin @@ -254,11 +252,17 @@ procedure TCustomButtonPanel.UpdateSizes; var btn: TPanelButton; BtnWidth, BtnHeight: Integer; + Details: TThemedElementDetails; + DefButtonSize: TSize; begin if csDestroying in ComponentState then Exit; - FButtonsHeight := DefMinHeight; - FButtonsWidth := DefMinWidth; + + Details := ThemeServices.GetElementDetails(tbPushButtonNormal); + DefButtonSize := ThemeServices.GetDetailSize(Details); + FButtonsWidth := DefButtonSize.cx; + FButtonsHeight := DefButtonSize.cy; + for btn := Low(btn) to High(btn) do begin if FButtons[btn] = nil then Continue; @@ -446,17 +450,23 @@ const end; end; +var + Details: TThemedElementDetails; + DefButtonSize: TSize; begin if FButtons[AButton] <> nil then Exit; + Details := ThemeServices.GetElementDetails(tbPushButtonNormal); + DefButtonSize := ThemeServices.GetDetailSize(Details); + FButtons[AButton] := TPanelBitBtn.Create(Self); with FButtons[AButton] do begin Name := NAMES[AButton]; Parent := Self; Kind := KINDS[AButton]; - Constraints.MinWidth := DefMinWidth; - Constraints.MinHeight := DefMinHeight; + Constraints.MinWidth := DefButtonSize.cx; + Constraints.MinHeight := DefButtonSize.cy; Caption := GetCaption(AButton); TabOrder := Ord(AButton); //initial order Align := alCustom; diff --git a/lcl/themes.pas b/lcl/themes.pas index 52d5ad538f..323cd23c59 100644 --- a/lcl/themes.pas +++ b/lcl/themes.pas @@ -1774,7 +1774,10 @@ begin case Details.Element of teButton: if Details.Part in [BP_RADIOBUTTON, BP_CHECKBOX] then - Result := Size(13, 13); + Result := Size(13, 13) + else + if Details.Part = BP_PUSHBUTTON then + Result := Size(75, 25); teRebar: if Details.Part = RP_GRIPPER then Result.cy := 30