mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 23:49:18 +02:00
implement WinControl.SetFont
git-svn-id: trunk@34463 -
This commit is contained in:
parent
30056f1dc2
commit
1ac5f81918
@ -10,7 +10,7 @@ uses
|
||||
CocoaAll,
|
||||
Classes, Controls, SysUtils,
|
||||
//
|
||||
WSControls, LCLType, LMessages, LCLProc, Forms,
|
||||
WSControls, LCLType, LMessages, LCLProc, Graphics, Forms,
|
||||
CocoaPrivate, CocoaGDIObjects, CocoaCaret, CocoaUtils, LCLMessageGlue;
|
||||
|
||||
type
|
||||
@ -74,6 +74,7 @@ type
|
||||
class procedure GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override;
|
||||
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||
class procedure SetCursor(const AWinControl: TWinControl; const ACursor: HCursor); override;
|
||||
class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
|
||||
end;
|
||||
|
||||
|
||||
@ -580,6 +581,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TCocoaWSWinControl.SetFont(const AWinControl: TWinControl; const AFont: TFont);
|
||||
var
|
||||
Obj: NSObject;
|
||||
begin
|
||||
if (AWinControl.Handle <> 0) then
|
||||
begin
|
||||
Obj := NSObject(AWinControl.Handle);
|
||||
if Obj.isKindOfClass(NSControl) then
|
||||
NSCell(NSControl(Obj).cell).setFont(TCocoaFont(AFont.Reference.Handle).Font);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TCocoaWSCustomControl }
|
||||
|
||||
class function TCocoaWSCustomControl.CreateHandle(const AWinControl: TWinControl;
|
||||
|
@ -324,15 +324,15 @@ end;
|
||||
|
||||
Sets button default indication in Cocoa interface
|
||||
------------------------------------------------------------------------------}
|
||||
class procedure TCocoaWSButton.SetDefault(const AButton: TCustomButton;
|
||||
ADefault: Boolean);
|
||||
class procedure TCocoaWSButton.SetDefault(const AButton: TCustomButton; ADefault: Boolean);
|
||||
var
|
||||
cf :NSString;
|
||||
cf: NSString;
|
||||
const
|
||||
DefEq : array [Boolean] of String = (#0, #13);
|
||||
DefEq: array [Boolean] of String = (#0, #13);
|
||||
begin
|
||||
if AButton.Handle=0 then Exit;
|
||||
cf:=NSStringUtf8(DefEq[ADefault]);
|
||||
if not AButton.HandleAllocated then
|
||||
Exit;
|
||||
cf := NSStringUtf8(DefEq[ADefault]);
|
||||
|
||||
NSButton(AButton.Handle).setKeyEquivalent(cf);
|
||||
cf.release;
|
||||
|
Loading…
Reference in New Issue
Block a user