mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:59:16 +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
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Buttons, Classes, Controls, ExtCtrls, Forms, Graphics, GraphType, SysUtils,
|
Types, SysUtils, Classes, Controls, ExtCtrls, Buttons, Forms, GraphType,
|
||||||
LCLStrConsts;
|
Graphics, LCLStrConsts, Themes;
|
||||||
|
|
||||||
type
|
type
|
||||||
TButtonOrder = (boDefault, boCloseCancelOK, boCloseOKCancel);
|
TButtonOrder = (boDefault, boCloseCancelOK, boCloseOKCancel);
|
||||||
@ -151,8 +151,6 @@ const
|
|||||||
DEFAULT_BUTTONPANEL_BORDERSPACING: TControlBorderSpacingDefault = (
|
DEFAULT_BUTTONPANEL_BORDERSPACING: TControlBorderSpacingDefault = (
|
||||||
Left:0; Top:0; Right:0; Bottom:0; Around:6;
|
Left:0; Top:0; Right:0; Bottom:0; Around:6;
|
||||||
);
|
);
|
||||||
DefMinWidth = 75;
|
|
||||||
DefMinHeight = 25;
|
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
@ -254,11 +252,17 @@ procedure TCustomButtonPanel.UpdateSizes;
|
|||||||
var
|
var
|
||||||
btn: TPanelButton;
|
btn: TPanelButton;
|
||||||
BtnWidth, BtnHeight: Integer;
|
BtnWidth, BtnHeight: Integer;
|
||||||
|
Details: TThemedElementDetails;
|
||||||
|
DefButtonSize: TSize;
|
||||||
begin
|
begin
|
||||||
if csDestroying in ComponentState then
|
if csDestroying in ComponentState then
|
||||||
Exit;
|
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
|
for btn := Low(btn) to High(btn) do
|
||||||
begin
|
begin
|
||||||
if FButtons[btn] = nil then Continue;
|
if FButtons[btn] = nil then Continue;
|
||||||
@ -446,17 +450,23 @@ const
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Details: TThemedElementDetails;
|
||||||
|
DefButtonSize: TSize;
|
||||||
begin
|
begin
|
||||||
if FButtons[AButton] <> nil then Exit;
|
if FButtons[AButton] <> nil then Exit;
|
||||||
|
|
||||||
|
Details := ThemeServices.GetElementDetails(tbPushButtonNormal);
|
||||||
|
DefButtonSize := ThemeServices.GetDetailSize(Details);
|
||||||
|
|
||||||
FButtons[AButton] := TPanelBitBtn.Create(Self);
|
FButtons[AButton] := TPanelBitBtn.Create(Self);
|
||||||
with FButtons[AButton] do
|
with FButtons[AButton] do
|
||||||
begin
|
begin
|
||||||
Name := NAMES[AButton];
|
Name := NAMES[AButton];
|
||||||
Parent := Self;
|
Parent := Self;
|
||||||
Kind := KINDS[AButton];
|
Kind := KINDS[AButton];
|
||||||
Constraints.MinWidth := DefMinWidth;
|
Constraints.MinWidth := DefButtonSize.cx;
|
||||||
Constraints.MinHeight := DefMinHeight;
|
Constraints.MinHeight := DefButtonSize.cy;
|
||||||
Caption := GetCaption(AButton);
|
Caption := GetCaption(AButton);
|
||||||
TabOrder := Ord(AButton); //initial order
|
TabOrder := Ord(AButton); //initial order
|
||||||
Align := alCustom;
|
Align := alCustom;
|
||||||
|
@ -1774,7 +1774,10 @@ begin
|
|||||||
case Details.Element of
|
case Details.Element of
|
||||||
teButton:
|
teButton:
|
||||||
if Details.Part in [BP_RADIOBUTTON, BP_CHECKBOX] then
|
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:
|
teRebar:
|
||||||
if Details.Part = RP_GRIPPER then
|
if Details.Part = RP_GRIPPER then
|
||||||
Result.cy := 30
|
Result.cy := 30
|
||||||
|
Loading…
Reference in New Issue
Block a user