mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 16:40:48 +02:00
lcl-cocoa: Fixes TCheckBox.AutoSize
git-svn-id: trunk@46742 -
This commit is contained in:
parent
263412374c
commit
e4c6f04852
@ -179,6 +179,8 @@ type
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
|
||||
//
|
||||
class procedure GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
|
||||
end;
|
||||
|
||||
{ TCocoaWSToggleBox }
|
||||
@ -471,6 +473,23 @@ begin
|
||||
NSButton(ACustomCheckBox.Handle).setState(buttonState[NewState]);
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSCustomCheckBox.GetPreferredSize(
|
||||
const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer;
|
||||
WithThemeSpace: Boolean);
|
||||
var
|
||||
lButton: NSButton;
|
||||
lOldSize: NSSize;
|
||||
begin
|
||||
if not AWinControl.HandleAllocated then Exit;
|
||||
lButton := NSButton(AWinControl.Handle);
|
||||
|
||||
lOldSize := lButton.bounds.size;
|
||||
lButton.sizeToFit();
|
||||
PreferredWidth := Integer(lButton.bounds.size.width);
|
||||
PreferredHeight := Integer(lButton.bounds.size.height);
|
||||
lButton.setBoundsSize(lOldSize);
|
||||
end;
|
||||
|
||||
{ TCocoaWSRadioButton }
|
||||
|
||||
class function TCocoaWSRadioButton.CreateHandle(const AWinControl: TWinControl;
|
||||
|
Loading…
Reference in New Issue
Block a user