mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 14:32:30 +02:00
carbon: implement TMonitor support
git-svn-id: trunk@19251 -
This commit is contained in:
parent
f28c5d307b
commit
f33ba3c8e5
@ -788,6 +788,20 @@ begin
|
||||
System.EnterCriticalsection(ACritSec^);
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect;
|
||||
lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
|
||||
var
|
||||
Count: CGDisplayCount;
|
||||
activeDspys: array[0..1024] of CGDirectDisplayID;
|
||||
i: integer;
|
||||
begin
|
||||
if OSError(CGGetActiveDisplayList(1024, activeDspys, Count),
|
||||
'TCarbonWidgetSet.EnumDisplayMonitors', 'CGGetActiveDisplayList') then Exit(False);
|
||||
Result := True;
|
||||
for i := 0 to Count - 1 do
|
||||
Result := Result and lpfnEnum(HMONITOR(activeDspys[i]), 0, nil, dwData);
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.EnumFontFamilies(DC: HDC; Family: Pchar;
|
||||
EnumFontFamProc: FontEnumProc; LParam: Lparam): Longint;
|
||||
begin
|
||||
@ -1407,6 +1421,32 @@ begin
|
||||
Result:=inherited GetFontLanguageInfo(DC);
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
||||
var
|
||||
DisplayID: CGDirectDisplayID absolute hMonitor;
|
||||
DeviceHandle: GDHandle;
|
||||
displayRect: CGRect;
|
||||
availRect: Rect;
|
||||
begin
|
||||
Result := (lpmi <> nil) and (lpmi^.cbSize >= SizeOf(TMonitorInfo));
|
||||
if not Result then Exit;
|
||||
displayRect := CGDisplayBounds(DisplayID);
|
||||
lpmi^.rcMonitor := CGRectToRect(displayRect);
|
||||
lpmi^.rcWork := lpmi^.rcMonitor;
|
||||
if DisplayID = CGMainDisplayID then
|
||||
begin
|
||||
lpmi^.dwFlags := MONITORINFOF_PRIMARY;
|
||||
if OSError(DMGetGDeviceByDisplayID(DisplayIDType(DisplayID), DeviceHandle, True),
|
||||
'TCarbonWidgetSet.GetMonitorInfo', 'DMGetGDeviceByDisplayID') then Exit;
|
||||
if OSError(GetAvailableWindowPositioningBounds(DeviceHandle, availRect),
|
||||
'TCarbonWidgetSet.GetMonitorInfo', 'GetAvailableWindowPositioningBounds') then Exit;
|
||||
with availRect do
|
||||
lpmi^.rcWork := Types.Rect(left, top, right, bottom);
|
||||
end
|
||||
else
|
||||
lpmi^.dwFlags := 0;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: GetKeyState
|
||||
Params: nVirtKey - The requested key
|
||||
|
@ -79,6 +79,7 @@ function EnableScrollBar(Wnd: HWND; wSBflags, wArrows: Cardinal): Boolean; overr
|
||||
function EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; override;
|
||||
function EndPaint(Handle : hwnd; var PS : TPaintStruct): Integer; override;
|
||||
procedure EnterCriticalSection(var CritSection: TCriticalSection); override;
|
||||
function EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; override;
|
||||
function EnumFontFamilies(DC: HDC; Family:Pchar; EnumFontFamProc: FontEnumProc; LParam: Lparam): Longint; override;
|
||||
function EnumFontFamiliesEx(DC: HDC; lpLogFont: PLogFont; Callback: FontEnumExProc; LParam: Lparam; flags: dword): Longint; override;
|
||||
function ExcludeClipRect(DC: HDC; Left, Top, Right, Bottom : Integer) : Integer; override;
|
||||
@ -110,6 +111,7 @@ function GetDeviceSize(DC: HDC; var p: TPoint): boolean; override;
|
||||
function GetDIBits(DC: HDC; Bitmap: HBitmap; StartScan, NumScans: UINT; Bits: Pointer; var BitInfo: BitmapInfo; Usage: UINT): Integer; Override;
|
||||
function GetFocus: HWND; override;
|
||||
function GetFontLanguageInfo(DC: HDC): DWord; override;
|
||||
function GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean; override;
|
||||
function GetKeyState(nVirtKey: Integer): Smallint; override;
|
||||
function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; override;
|
||||
function GetParent(Handle : HWND): HWND; override;
|
||||
|
Loading…
Reference in New Issue
Block a user