lcl-cocoa: Fixes TCheckBox.AutoSize

git-svn-id: trunk@46742 -
This commit is contained in:
sekelsenmat 2014-11-02 19:44:47 +00:00
parent 263412374c
commit e4c6f04852

View File

@ -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;