cocoa: set initial title for groupbox, implement SetAlphaBlend for TCustomForm

git-svn-id: trunk@34623 -
This commit is contained in:
paul 2012-01-06 15:46:20 +00:00
parent 108c6e003a
commit c4f0d1a633
2 changed files with 29 additions and 12 deletions

View File

@ -100,12 +100,13 @@ type
// class procedure CloseModal(const ACustomForm: TCustomForm); override;
// class procedure ShowModal(const ACustomForm: TCustomForm); override;
class procedure SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean; const Alpha: Byte); override;
class procedure SetBorderIcons(const AForm: TCustomForm; const ABorderIcons: TBorderIcons); override;
class procedure SetFormBorderStyle(const AForm: TCustomForm; const AFormBorderStyle: TFormBorderStyle); override;
{need to override these }
class function GetClientBounds(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
class function GetClientRect(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
class function GetClientBounds(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
class function GetClientRect(const AWincontrol: TWinControl; var ARect: TRect): Boolean; override;
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
end;
@ -290,17 +291,26 @@ begin
ns.release;
end;
class procedure TCocoaWSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean; const Alpha: Byte);
begin
if ACustomForm.HandleAllocated then
if AlphaBlend then
NSWindow(ACustomForm.Handle).setAlphaValue(Alpha / 255)
else
NSWindow(ACustomForm.Handle).setAlphaValue(1);
end;
class procedure TCocoaWSCustomForm.SetBorderIcons(const AForm: TCustomForm;
const ABorderIcons: TBorderIcons);
begin
if NSObject(AForm.Handle).isKindOfClass(NSWindow) then
if AForm.HandleAllocated then
SetStyleMaskFor(NSWindow(AForm.Handle), AForm.BorderStyle, ABorderIcons, csDesigning in AForm.ComponentState);
end;
class procedure TCocoaWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm;
const AFormBorderStyle: TFormBorderStyle);
begin
if NSObject(AForm.Handle).isKindOfClass(NSWindow) then
if AForm.HandleAllocated then
SetStyleMaskFor(NSWindow(AForm.Handle), AFormBorderStyle, AForm.BorderIcons, csDesigning in AForm.ComponentState);
end;

View File

@ -44,7 +44,7 @@ type
TCocoaWSScrollBar = class(TWSScrollBar)
published
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure SetParams(const AScrollBar: TCustomScrollBar); override;
end;
@ -794,14 +794,21 @@ end;
{ TCocoaWSCustomGroupBox }
class function TCocoaWSCustomGroupBox.CreateHandle(const AWinControl:TWinControl;
const AParams:TCreateParams):TLCLIntfHandle;
class function TCocoaWSCustomGroupBox.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle;
var
box : TCocoaGroupBox;
box: TCocoaGroupBox;
cap: NSString;
begin
box := NSView(TCocoaGroupBox.alloc).lclInitWithCreateParams(AParams);
box.callback:=TLCLCommonCallback.Create(box, AWinControl);
Result:=TLCLIntfHandle(box);
if Assigned(box) then
begin
box.callback := TLCLCommonCallback.Create(box, AWinControl);
cap := NSStringUTF8(AParams.Caption);
box.setTitle(cap);
cap.release;
end;
Result := TLCLIntfHandle(box);
end;
{ TCocoaWSCustomListBox }
@ -809,9 +816,9 @@ end;
function GetListView(AWinControl: TWinControl): TCocoaListView;
begin
if not Assigned(AWinControl) or (AWinControl.Handle=0) then
Result:=nil
Result := nil
else
Result:=TCocoaListView(TCocoaScrollView(AWinControl.Handle).documentView);
Result := TCocoaListView(TCocoaScrollView(AWinControl.Handle).documentView);
end;
class function TCocoaWSCustomListBox.CreateHandle(const AWinControl:TWinControl;