cocoa: applying lcl formatting to the latest commit changed

git-svn-id: trunk@43484 -
This commit is contained in:
dmitry 2013-11-27 04:15:18 +00:00
parent 03f347c5f8
commit 69a47e1ae7
2 changed files with 50 additions and 32 deletions

View File

@ -482,40 +482,48 @@ end;
function TCocoaWindowContent.lclOwnWindow: NSWindow;
begin
if not isembedded then Result:=window
else Result:=nil;
if not isembedded then
Result := window
else
Result := nil;
end;
procedure TCocoaWindowContent.lclSetFrame(const r: TRect);
begin
if isembedded then inherited lclSetFrame(r)
else window.lclSetFrame(r);
if isembedded then
inherited lclSetFrame(r)
else
window.lclSetFrame(r);
end;
procedure TCocoaWindowContent.viewDidMoveToSuperview;
begin
inherited viewDidMoveToSuperview;
end;
procedure TCocoaWindowContent.viewDidMoveToWindow;
begin
isembedded:=window.contentView<>self;
if isembedded then begin
if Assigned(ownwin) then ownwin.close;
ownwin:=nil;
end else begin
ownwin:=window;
isembedded := window.contentView<>self;
if isembedded then
begin
if Assigned(ownwin) then
ownwin.close;
ownwin := nil;
end
else
begin
ownwin := window;
end;
inherited viewDidMoveToWindow;
end;
procedure TCocoaWindowContent.viewWillMoveToWindow(newWindow: NSWindow);
begin
if not isembedded then begin
if not isembedded then
begin
window.close;
ownwin:=nil;
isembedded:=false;
ownwin := nil;
isembedded := false;
end;
inherited viewWillMoveToWindow(newWindow);
end;

View File

@ -366,10 +366,13 @@ var
win : NSWindow;
begin
Result := AWinControl.HandleAllocated;
if Result then begin
if Result then
begin
win := TCocoaWindowContent(AWinControl.Handle).lclOwnWindow;
if not Assigned(win) then AText:=''
else AText := NSStringToString(win.title);
if not Assigned(win) then
AText := ''
else
AText := NSStringToString(win.title);
end;
end;
@ -378,7 +381,8 @@ var
win : NSWindow;
begin
Result := AWinControl.HandleAllocated;
if Result then begin
if Result then
begin
win := TCocoaWindowContent(AWinControl.Handle).lclOwnWindow;
if Assigned(win) then
ALength := NSWindow(AWinControl.Handle).title.length
@ -392,9 +396,11 @@ var
ns: NSString;
win : NSWindow;
begin
if not AWinControl.HandleAllocated then Exit;
win:=TCocoaWindowContent(AWinControl.Handle).lclOwnWindow;
if Assigned(win) then begin
if not AWinControl.HandleAllocated then
Exit;
win := TCocoaWindowContent(AWinControl.Handle).lclOwnWindow;
if Assigned(win) then
begin
ns := NSStringUtf8(AText);
NSwindow(win).setTitle(ns);
ns.release;
@ -417,9 +423,11 @@ class procedure TCocoaWSCustomForm.SetAlphaBlend(const ACustomForm: TCustomForm;
var
win : NSWindow;
begin
if ACustomForm.HandleAllocated then begin
win:=TCocoaWindowContent(ACustomForm.Handle).lclOwnWindow;
if not Assigned(win) then Exit;
if ACustomForm.HandleAllocated then
begin
win := TCocoaWindowContent(ACustomForm.Handle).lclOwnWindow;
if not Assigned(win) then
Exit;
if AlphaBlend then
win.setAlphaValue(Alpha / 255)
else
@ -432,8 +440,9 @@ class procedure TCocoaWSCustomForm.SetBorderIcons(const AForm: TCustomForm;
var
win : NSWindow;
begin
if AForm.HandleAllocated then begin
win:=TCocoaWindowContent(AForm.Handle).lclOwnWindow;
if AForm.HandleAllocated then
begin
win := TCocoaWindowContent(AForm.Handle).lclOwnWindow;
if Assigned(win) then
UpdateWindowMask(win, GetDesigningBorderStyle(AForm), ABorderIcons);
end;
@ -444,8 +453,9 @@ class procedure TCocoaWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm;
var
win : NSWindow;
begin
if AForm.HandleAllocated then begin
win:=TCocoaWindowContent(AForm.Handle).lclOwnWindow;
if AForm.HandleAllocated then
begin
win := TCocoaWindowContent(AForm.Handle).lclOwnWindow;
if Assigned(win) then
UpdateWindowMask(win, AFormBorderStyle, AForm.BorderIcons);
end;
@ -456,8 +466,9 @@ class procedure TCocoaWSCustomForm.SetFormStyle(const AForm: TCustomform;
var
win : NSWindow;
begin
if AForm.HandleAllocated then begin
win:=TCocoaWindowContent(AForm.Handle).lclOwnWindow;
if AForm.HandleAllocated then
begin
win := TCocoaWindowContent(AForm.Handle).lclOwnWindow;
if Assigned(win) then
win.setLevel(FormStyleToWindowLevel[AFormStyle]);
end;
@ -508,9 +519,8 @@ end;
class procedure TCocoaWSCustomForm.SetBounds(const AWinControl: TWinControl;
const ALeft, ATop, AWidth, AHeight: Integer);
begin
if AWinControl.HandleAllocated then begin
if AWinControl.HandleAllocated then
NSObject(AWinControl.Handle).lclSetFrame(Bounds(ALeft, ATop, AWidth, AHeight));
end;
end;
end.