mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 19:35:57 +02:00
cocoa: implement SetActiveWindow and SetForegroundWindow
git-svn-id: trunk@34307 -
This commit is contained in:
parent
76950c5c17
commit
c59a98a83e
@ -1127,6 +1127,24 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.SetActiveWindow(Handle: HWND): HWND;
|
||||
var
|
||||
Obj: NSObject;
|
||||
begin
|
||||
Obj := NSObject(Handle);
|
||||
if Assigned(Obj) and NSApp.isActive then
|
||||
begin
|
||||
Result := HWND(NSApp.keyWindow);
|
||||
if Obj.isKindOfClass(NSWindow) then
|
||||
NSwindow(Obj).makeKeyWindow
|
||||
else
|
||||
if Obj.isKindOfClass(NSView) then
|
||||
NSView(Obj).window.makeKeyWindow
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.SetBKColor(DC: HDC; Color: TColorRef): TColorRef;
|
||||
var
|
||||
ctx: TCocoaContext;
|
||||
@ -1218,6 +1236,25 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.SetForegroundWindow(HWnd: HWND): boolean;
|
||||
var
|
||||
Obj: NSObject;
|
||||
begin
|
||||
Result := HWnd <> 0;
|
||||
if Result then
|
||||
begin
|
||||
NSApp.activateIgnoringOtherApps(True);
|
||||
Obj := NSObject(HWnd);
|
||||
if Obj.isKindOfClass(NSWindow) then
|
||||
NSwindow(Obj).makeKeyAndOrderFront(NSApp)
|
||||
else
|
||||
if Obj.isKindOfClass(NSView) then
|
||||
NSView(Obj).window.makeKeyAndOrderFront(NSApp)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------- FONT AND TEXT --------------------------------}
|
||||
|
||||
function TCocoaWidgetSet.SetTextColor(DC: HDC; Color: TColorRef): TColorRef;
|
||||
|
@ -162,8 +162,8 @@ function SaveDC(DC: HDC): Integer; override;
|
||||
function ScreenToClient(Handle: HWND; var P: TPoint): Integer; override;
|
||||
function SelectClipRGN(DC : hDC; RGN : HRGN) : Longint; override;
|
||||
function SelectObject(ADC: HDC; GDIObj: HGDIOBJ): HGDIOBJ; override;
|
||||
{function SendMessage(HandleWnd: HWND; Msg: Cardinal; WParam: WParam; LParam: LParam): LResult; override;
|
||||
function SetActiveWindow(Handle: HWND): HWND; override;}
|
||||
{function SendMessage(HandleWnd: HWND; Msg: Cardinal; WParam: WParam; LParam: LParam): LResult; override;}
|
||||
function SetActiveWindow(Handle: HWND): HWND; override;
|
||||
function SetBKColor(DC: HDC; Color: TColorRef): TColorRef; override;
|
||||
function SetBkMode(DC: HDC; bkMode : Integer) : Integer; override;
|
||||
{function SetCapture(AHandle: HWND): HWND; override;
|
||||
@ -172,8 +172,8 @@ function SetCaretPosEx(Handle: HWnd; X, Y: Integer): Boolean; override;
|
||||
function SetCaretRespondToFocus(handle: HWND; ShowHideOnFocus: boolean): Boolean; override;}
|
||||
function SetCursor(ACursor: HCURSOR): HCURSOR; override;
|
||||
function SetCursorPos(X, Y: Integer): Boolean; override;
|
||||
{function SetFocus(hWnd: HWND): HWND; override;
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;}
|
||||
{function SetFocus(hWnd: HWND): HWND; override;}
|
||||
function SetForegroundWindow(HWnd: HWND): boolean; override;
|
||||
function SetProp(Handle: hwnd; Str: PChar; Data: Pointer) : Boolean; override;
|
||||
function SetROP2(DC: HDC; Mode: Integer): Integer; override;
|
||||
function SetScrollInfo(Handle : HWND; SBStyle : Integer; ScrollInfo: TScrollInfo; bRedraw : Boolean): Integer; override;
|
||||
|
Loading…
Reference in New Issue
Block a user