mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 09:59:23 +02:00
win32: cleanup win32extra
git-svn-id: trunk@23393 -
This commit is contained in:
parent
216da02c61
commit
9430f5e3e6
@ -36,13 +36,6 @@ uses
|
|||||||
|
|
||||||
{ Win32 API constants not included in windows.pp }
|
{ Win32 API constants not included in windows.pp }
|
||||||
const
|
const
|
||||||
// progress bar
|
|
||||||
PBM_SETMARQUEE = WM_USER + 10;
|
|
||||||
PBS_MARQUEE = $08;
|
|
||||||
|
|
||||||
// missed messages
|
|
||||||
WM_NCMOUSELEAVE = $2A2; // declared in fpc 2.3.1
|
|
||||||
|
|
||||||
// Layout orientation
|
// Layout orientation
|
||||||
LAYOUT_RTL = $00000001; // Right to left
|
LAYOUT_RTL = $00000001; // Right to left
|
||||||
LAYOUT_BTT = $00000002; // Bottom to top
|
LAYOUT_BTT = $00000002; // Bottom to top
|
||||||
@ -85,11 +78,6 @@ var
|
|||||||
GetComboBoxInfo: function(hwndCombo: HWND; pcbi: PComboboxInfo): BOOL; stdcall;
|
GetComboBoxInfo: function(hwndCombo: HWND; pcbi: PComboboxInfo): BOOL; stdcall;
|
||||||
GetMenuBarInfo: function(hwnd: HWND; idObject: LONG; idItem: LONG; pmbi: PMENUBARINFO): BOOL; stdcall;
|
GetMenuBarInfo: function(hwnd: HWND; idObject: LONG; idItem: LONG; pmbi: PMENUBARINFO): BOOL; stdcall;
|
||||||
GetWindowInfo: function(hwnd: HWND; pwi: PWINDOWINFO): BOOL; stdcall;
|
GetWindowInfo: function(hwnd: HWND; pwi: PWINDOWINFO): BOOL; stdcall;
|
||||||
EnumDisplayMonitors: function(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool; stdcall;
|
|
||||||
GetMonitorInfo: function(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean; stdcall;
|
|
||||||
MonitorFromWindow: function(hWnd: HWND; dwFlags: DWORD): HMONITOR; stdcall;
|
|
||||||
MonitorFromRect: function(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; stdcall;
|
|
||||||
MonitorFromPoint: function(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR; stdcall;
|
|
||||||
SetLayout: function(dc: HDC; l: DWord): DWord; stdcall;
|
SetLayout: function(dc: HDC; l: DWord): DWord; stdcall;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -126,9 +114,6 @@ implementation
|
|||||||
uses
|
uses
|
||||||
Win32Proc;
|
Win32Proc;
|
||||||
|
|
||||||
const
|
|
||||||
xPRIMARY_MONITOR = $12340042;
|
|
||||||
|
|
||||||
{$PACKRECORDS NORMAL}
|
{$PACKRECORDS NORMAL}
|
||||||
|
|
||||||
function _AlphaBlend(hdcDest: HDC; nXOriginDest, nYOriginDest, nWidthDest, nHeightDest: Integer; hdcSrc: HDC; nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc: Integer; blendFunction: TBlendFunction): BOOL; stdcall;
|
function _AlphaBlend(hdcDest: HDC; nXOriginDest, nYOriginDest, nWidthDest, nHeightDest: Integer; hdcSrc: HDC; nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc: Integer; blendFunction: TBlendFunction): BOOL; stdcall;
|
||||||
@ -550,128 +535,6 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function _EnumDisplayMonitors(hdcOptionalForPainting: HDC;
|
|
||||||
lprcEnumMonitorsThatIntersect: PRect;
|
|
||||||
lpfnEnumProc: MonitorEnumProc;
|
|
||||||
dwData: LPARAM): LongBool; stdcall;
|
|
||||||
var
|
|
||||||
rcLimit, rcClip: TRect;
|
|
||||||
ptOrg: TPoint;
|
|
||||||
Cb: Integer;
|
|
||||||
begin
|
|
||||||
// from MultiMon.h
|
|
||||||
rcLimit.left := 0;
|
|
||||||
rcLimit.top := 0;
|
|
||||||
rcLimit.right := GetSystemMetrics(SM_CXSCREEN);
|
|
||||||
rcLimit.bottom := GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
|
|
||||||
if (hdcOptionalForPainting <> 0) then
|
|
||||||
begin
|
|
||||||
Cb := GetClipBox(hdcOptionalForPainting, @rcClip);
|
|
||||||
if not GetDCOrgEx(hdcOptionalForPainting, @ptOrg) then
|
|
||||||
Exit(False);
|
|
||||||
|
|
||||||
OffsetRect(rcLimit, -ptOrg.x, -ptOrg.y);
|
|
||||||
if (IntersectRect(rcLimit, rcLimit, rcClip) and
|
|
||||||
((lprcEnumMonitorsThatIntersect = nil) or
|
|
||||||
IntersectRect(rcLimit, rcLimit, lprcEnumMonitorsThatIntersect^))) then
|
|
||||||
begin
|
|
||||||
if Cb = NULLREGION then
|
|
||||||
Exit(True)
|
|
||||||
else
|
|
||||||
if Cb = ERROR then
|
|
||||||
Exit(False);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if ((lprcEnumMonitorsThatIntersect <> nil) and
|
|
||||||
not IntersectRect(rcLimit, rcLimit, lprcEnumMonitorsThatIntersect^)) then
|
|
||||||
Exit(True);
|
|
||||||
|
|
||||||
Result := lpfnEnumProc(
|
|
||||||
xPRIMARY_MONITOR,
|
|
||||||
hdcOptionalForPainting,
|
|
||||||
@rcLimit,
|
|
||||||
dwData);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function _GetMonitorInfo(hMonitor: HMONITOR; lpMonitorInfo: PMonitorInfo): Boolean; stdcall;
|
|
||||||
var
|
|
||||||
rcWork: TRect;
|
|
||||||
begin
|
|
||||||
// from MultiMon.h
|
|
||||||
if ((hMonitor = xPRIMARY_MONITOR) and
|
|
||||||
(lpMonitorInfo <> nil) and
|
|
||||||
(lpMonitorInfo^.cbSize >= sizeof(TMonitorInfo)) and
|
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, 0, @rcWork, 0)) then
|
|
||||||
begin
|
|
||||||
lpMonitorInfo^.rcMonitor.left := 0;
|
|
||||||
lpMonitorInfo^.rcMonitor.top := 0;
|
|
||||||
lpMonitorInfo^.rcMonitor.right := GetSystemMetrics(SM_CXSCREEN);
|
|
||||||
lpMonitorInfo^.rcMonitor.bottom := GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
lpMonitorInfo^.rcWork := rcWork;
|
|
||||||
lpMonitorInfo^.dwFlags := MONITORINFOF_PRIMARY;
|
|
||||||
|
|
||||||
{$IFDEF WindowsUnicodeSupport}
|
|
||||||
if UnicodeEnabledOS then
|
|
||||||
begin
|
|
||||||
if (lpMonitorInfo^.cbSize >= sizeof(TMonitorInfoExW)) then
|
|
||||||
PMonitorInfoExW(lpMonitorInfo)^.szDevice := 'DISPLAY'
|
|
||||||
end
|
|
||||||
else
|
|
||||||
{$ENDIF}
|
|
||||||
if (lpMonitorInfo^.cbSize >= sizeof(TMonitorInfoEx)) then
|
|
||||||
PMonitorInfoEx(lpMonitorInfo)^.szDevice := 'DISPLAY';
|
|
||||||
|
|
||||||
Result := True;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function _MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR; stdcall;
|
|
||||||
begin
|
|
||||||
if ((dwFlags and (MONITOR_DEFAULTTOPRIMARY or MONITOR_DEFAULTTONEAREST) <> 0 ) or
|
|
||||||
((ptScreenCoords.x >= 0) and
|
|
||||||
(ptScreenCoords.x < GetSystemMetrics(SM_CXSCREEN)) and
|
|
||||||
(ptScreenCoords.y >= 0) and
|
|
||||||
(ptScreenCoords.y < GetSystemMetrics(SM_CYSCREEN)))) then
|
|
||||||
Result := xPRIMARY_MONITOR
|
|
||||||
else
|
|
||||||
Result := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function _MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR; stdcall;
|
|
||||||
begin
|
|
||||||
if ((dwFlags and (MONITOR_DEFAULTTOPRIMARY or MONITOR_DEFAULTTONEAREST) <> 0) or
|
|
||||||
((lprcScreenCoords^.right > 0) and
|
|
||||||
(lprcScreenCoords^.bottom > 0) and
|
|
||||||
(lprcScreenCoords^.left < GetSystemMetrics(SM_CXSCREEN)) and
|
|
||||||
(lprcScreenCoords^.top < GetSystemMetrics(SM_CYSCREEN)))) then
|
|
||||||
Result := xPRIMARY_MONITOR
|
|
||||||
else
|
|
||||||
Result := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function _MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR; stdcall;
|
|
||||||
var
|
|
||||||
wp: TWindowPlacement;
|
|
||||||
B: Boolean;
|
|
||||||
begin
|
|
||||||
if (dwFlags and (MONITOR_DEFAULTTOPRIMARY or MONITOR_DEFAULTTONEAREST) <> 0) then
|
|
||||||
Exit(xPRIMARY_MONITOR);
|
|
||||||
|
|
||||||
if IsIconic(hWnd) then
|
|
||||||
B := GetWindowPlacement(hWnd, @wp)
|
|
||||||
else
|
|
||||||
B := GetWindowRect(hWnd, @wp.rcNormalPosition);
|
|
||||||
|
|
||||||
if B then
|
|
||||||
Result := _MonitorFromRect(@wp.rcNormalPosition, dwFlags)
|
|
||||||
else
|
|
||||||
Result := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function _SHGetStockIconInfo(siid: integer; uFlags: UINT; psii: PSHSTOCKICONINFO): HResult; stdcall;
|
function _SHGetStockIconInfo(siid: integer; uFlags: UINT; psii: PSHSTOCKICONINFO): HResult; stdcall;
|
||||||
begin
|
begin
|
||||||
Result := E_NOTIMPL;
|
Result := E_NOTIMPL;
|
||||||
@ -732,11 +595,6 @@ begin
|
|||||||
Pointer(GetComboboxInfo) := @_GetComboboxInfo;
|
Pointer(GetComboboxInfo) := @_GetComboboxInfo;
|
||||||
Pointer(GetMenuBarInfo) := @_GetMenuBarInfo;
|
Pointer(GetMenuBarInfo) := @_GetMenuBarInfo;
|
||||||
Pointer(GetWindowInfo) := @_GetWindowInfo;
|
Pointer(GetWindowInfo) := @_GetWindowInfo;
|
||||||
Pointer(EnumDisplayMonitors) := @_EnumDisplayMonitors;
|
|
||||||
Pointer(GetMonitorInfo) := @_GetMonitorInfo;
|
|
||||||
Pointer(MonitorFromWindow) := @_MonitorFromWindow;
|
|
||||||
Pointer(MonitorFromRect) := @_MonitorFromRect;
|
|
||||||
Pointer(MonitorFromPoint) := @_MonitorFromPoint;
|
|
||||||
|
|
||||||
user32handle := LoadLibrary(user32lib);
|
user32handle := LoadLibrary(user32lib);
|
||||||
if user32handle <> 0 then
|
if user32handle <> 0 then
|
||||||
@ -752,32 +610,6 @@ begin
|
|||||||
p := GetProcAddress(user32handle, 'GetWindowInfo');
|
p := GetProcAddress(user32handle, 'GetWindowInfo');
|
||||||
if p <> nil
|
if p <> nil
|
||||||
then Pointer(GetWindowInfo) := p;
|
then Pointer(GetWindowInfo) := p;
|
||||||
|
|
||||||
p := GetProcAddress(user32handle, 'EnumDisplayMonitors');
|
|
||||||
if p <> nil
|
|
||||||
then Pointer(EnumDisplayMonitors) := p;
|
|
||||||
|
|
||||||
{$IFDEF WindowsUnicodeSupport}
|
|
||||||
if UnicodeEnabledOS
|
|
||||||
then p := GetProcAddress(user32handle, 'GetMonitorInfoW')
|
|
||||||
else p := GetProcAddress(user32handle, 'GetMonitorInfoA');
|
|
||||||
{$ELSE}
|
|
||||||
p := GetProcAddress(user32handle, 'GetMonitorInfoA');
|
|
||||||
{$ENDIF}
|
|
||||||
if p <> nil
|
|
||||||
then Pointer(GetMonitorInfo) := p;
|
|
||||||
|
|
||||||
p := GetProcAddress(user32handle, 'MonitorFromWindow');
|
|
||||||
if p <> nil
|
|
||||||
then Pointer(MonitorFromWindow) := p;
|
|
||||||
|
|
||||||
p := GetProcAddress(user32handle, 'MonitorFromRect');
|
|
||||||
if p <> nil
|
|
||||||
then Pointer(MonitorFromRect) := p;
|
|
||||||
|
|
||||||
p := GetProcAddress(user32handle, 'MonitorFromPoint');
|
|
||||||
if p <> nil
|
|
||||||
then Pointer(MonitorFromPoint) := p;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
|
@ -37,7 +37,7 @@ uses
|
|||||||
Windows, ActiveX, Classes, Translations, ComCtrls, Controls, Buttons,
|
Windows, ActiveX, Classes, Translations, ComCtrls, Controls, Buttons,
|
||||||
ExtCtrls, Forms, GraphMath, GraphType, InterfaceBase, LCLIntf,
|
ExtCtrls, Forms, GraphMath, GraphType, InterfaceBase, LCLIntf,
|
||||||
LCLType, LMessages, StdCtrls, SysUtils, Win32Def, Graphics, Menus, CommCtrl,
|
LCLType, LMessages, StdCtrls, SysUtils, Win32Def, Graphics, Menus, CommCtrl,
|
||||||
Themes{, Win32Debug};
|
MultiMon, Themes{, Win32Debug};
|
||||||
|
|
||||||
const
|
const
|
||||||
// standard windows cursors
|
// standard windows cursors
|
||||||
|
@ -1328,7 +1328,7 @@ end;
|
|||||||
|
|
||||||
function TWin32WidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
|
function TWin32WidgetSet.EnumDisplayMonitors(hdc: HDC; lprcClip: PRect; lpfnEnum: MonitorEnumProc; dwData: LPARAM): LongBool;
|
||||||
begin
|
begin
|
||||||
Result := Win32Extra.EnumDisplayMonitors(hdc, lprcClip, lpfnEnum, dwData);
|
Result := MultiMon.EnumDisplayMonitors(hdc, lprcClip, lpfnEnum, dwData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWin32WidgetSet.EnumFontFamilies(DC: HDC; Family: Pchar;
|
function TWin32WidgetSet.EnumFontFamilies(DC: HDC; Family: Pchar;
|
||||||
@ -1923,7 +1923,7 @@ begin
|
|||||||
Result := Windows.GetMapMode(DC);
|
Result := Windows.GetMapMode(DC);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWin32WidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean;
|
function TWin32WidgetSet.GetMonitorInfo(hMonitor: HMONITOR; lpmi: LCLType.PMonitorInfo): Boolean;
|
||||||
{$IFDEF WindowsUnicodeSupport}
|
{$IFDEF WindowsUnicodeSupport}
|
||||||
var
|
var
|
||||||
LocalInfo: TMonitorInfoExW;
|
LocalInfo: TMonitorInfoExW;
|
||||||
@ -1935,7 +1935,7 @@ begin
|
|||||||
if UnicodeEnabledOS then
|
if UnicodeEnabledOS then
|
||||||
begin
|
begin
|
||||||
LocalInfo.cbSize := SizeOf(TMonitorInfoExW);
|
LocalInfo.cbSize := SizeOf(TMonitorInfoExW);
|
||||||
Result := Win32Extra.GetMonitorInfo(hMonitor, @LocalInfo);
|
Result := MultiMon.GetMonitorInfo(hMonitor, @LocalInfo);
|
||||||
lpmi^.rcMonitor := LocalInfo.rcMonitor;
|
lpmi^.rcMonitor := LocalInfo.rcMonitor;
|
||||||
lpmi^.rcWork := LocalInfo.rcWork;
|
lpmi^.rcWork := LocalInfo.rcWork;
|
||||||
lpmi^.dwFlags := LocalInfo.dwFlags;
|
lpmi^.dwFlags := LocalInfo.dwFlags;
|
||||||
@ -1946,7 +1946,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result := Win32Extra.GetMonitorInfo(hMonitor, lpmi);
|
Result := MultiMon.GetMonitorInfo(hMonitor, LPMonitorInfo(lpmi));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -2568,17 +2568,17 @@ end;
|
|||||||
|
|
||||||
function TWin32WidgetSet.MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR;
|
function TWin32WidgetSet.MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR;
|
||||||
begin
|
begin
|
||||||
Result := Win32Extra.MonitorFromPoint(ptScreenCoords, dwFlags);
|
Result := MultiMon.MonitorFromPoint(ptScreenCoords, dwFlags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWin32WidgetSet.MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR;
|
function TWin32WidgetSet.MonitorFromRect(lprcScreenCoords: PRect; dwFlags: DWord): HMONITOR;
|
||||||
begin
|
begin
|
||||||
Result := Win32Extra.MonitorFromRect(lprcScreenCoords, dwFlags);
|
Result := MultiMon.MonitorFromRect(lprcScreenCoords, dwFlags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWin32WidgetSet.MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR;
|
function TWin32WidgetSet.MonitorFromWindow(hWnd: HWND; dwFlags: DWord): HMONITOR;
|
||||||
begin
|
begin
|
||||||
Result := Win32Extra.MonitorFromWindow(hWnd, dwFlags);
|
Result := MultiMon.MonitorFromWindow(hWnd, dwFlags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -108,7 +108,7 @@ function GetFocus: HWND; override;
|
|||||||
function GetForegroundWindow: HWND; override;
|
function GetForegroundWindow: HWND; override;
|
||||||
function GetKeyState(NVirtKey: Integer): SmallInt; override;
|
function GetKeyState(NVirtKey: Integer): SmallInt; override;
|
||||||
function GetMapMode(DC: HDC): Integer; override;
|
function GetMapMode(DC: HDC): Integer; override;
|
||||||
function GetMonitorInfo(hMonitor: HMONITOR; lpmi: PMonitorInfo): Boolean; override;
|
function GetMonitorInfo(hMonitor: HMONITOR; lpmi: LCLType.PMonitorInfo): Boolean; override;
|
||||||
function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; override;
|
function GetObject(GDIObj: HGDIOBJ; BufSize: Integer; Buf: Pointer): Integer; override;
|
||||||
function GetParent(Handle: HWND): HWND; override;
|
function GetParent(Handle: HWND): HWND; override;
|
||||||
function GetProp(Handle: HWND; Str: PChar): Pointer; override;
|
function GetProp(Handle: HWND; Str: PChar): Pointer; override;
|
||||||
|
@ -133,7 +133,7 @@ type
|
|||||||
HBITMAP = Windows.HBITMAP;
|
HBITMAP = Windows.HBITMAP;
|
||||||
HPALETTE = Windows.HPALETTE;
|
HPALETTE = Windows.HPALETTE;
|
||||||
HBRUSH = Windows.HBRUSH;
|
HBRUSH = Windows.HBRUSH;
|
||||||
HMONITOR = Windows.HANDLE; // define as Windows.HMONITOR when fpc have it
|
HMONITOR = HANDLE;
|
||||||
|
|
||||||
WPARAM = Windows.WPARAM;
|
WPARAM = Windows.WPARAM;
|
||||||
LPARAM = Windows.LPARAM;
|
LPARAM = Windows.LPARAM;
|
||||||
|
Loading…
Reference in New Issue
Block a user