mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 23:28:41 +02:00
lcl: move default TButtonPanel button constraints to the ThemeServices
git-svn-id: trunk@20214 -
This commit is contained in:
parent
597eb84d8c
commit
8e3c500a4d
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user