From 35a781c60776295cc28bf86cf9c54cda5424c51a Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 22 Jun 2011 21:03:25 +0000 Subject: [PATCH] Adds more TScreen properties, from patch from bug #19379 by wovan.bugger git-svn-id: trunk@31339 - --- lcl/forms.pp | 17 ++++++++++ lcl/include/screen.inc | 42 +++++++++++++++++++++++++ lcl/interfaces/carbon/carbonwinapi.inc | 15 +++++++++ lcl/interfaces/carbon/carbonwinapih.inc | 1 + lcl/interfaces/gtk/gtkwinapi.inc | 15 +++++++++ lcl/interfaces/gtk/gtkwinapih.inc | 1 + lcl/interfaces/gtk2/gtk2winapi.inc | 15 +++++++++ lcl/interfaces/gtk2/gtk2winapih.inc | 1 + lcl/interfaces/qt/qtwinapi.inc | 7 +++++ lcl/interfaces/wince/wincewinapi.inc | 6 ++++ lcl/interfaces/wince/wincewinapih.inc | 1 + 11 files changed, 121 insertions(+) diff --git a/lcl/forms.pp b/lcl/forms.pp index 5875d57805..59ae3ae055 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -943,8 +943,11 @@ type function GetCustomFormsZOrdered(Index: Integer): TCustomForm; function GetDataModuleCount: Integer; function GetDataModules(AIndex: Integer): TDataModule; + function GetDesktopLeft: Integer; + function GetDesktopTop: Integer; function GetDesktopHeight: Integer; function GetDesktopWidth: Integer; + function GetDesktopRect: TRect; function GetFonts : TStrings; function GetFormCount: Integer; function GetForms(IIndex: Integer): TForm; @@ -973,6 +976,11 @@ type procedure DoRemoveDataModule(DataModule: TDataModule); procedure NotifyScreenFormHandler(HandlerType: TScreenNotification; Form: TCustomForm); + function GetWorkAreaHeight: Integer; + function GetWorkAreaLeft: Integer; + function GetWorkAreaRect: TRect; + function GetWorkAreaTop: Integer; + function GetWorkAreaWidth: Integer; protected function GetHintFont: TFont; virtual; function GetIconFont: TFont; virtual; @@ -1033,8 +1041,12 @@ type property CustomFormZOrderCount: Integer read GetCustomFormZOrderCount; property CustomFormsZOrdered[Index: Integer]: TCustomForm read GetCustomFormsZOrdered; // lower index means on top + property DesktopLeft: Integer read GetDesktopLeft; + property DesktopTop: Integer read GetDesktopTop; + property DesktopHeight: Integer read GetDesktopHeight; property DesktopWidth: Integer read GetDesktopWidth; + property DesktopRect: TRect read GetDesktopRect; property FocusedForm: TCustomForm read FFocusedForm; property FormCount: Integer read GetFormCount; property Forms[Index: Integer]: TForm read GetForms; @@ -1053,6 +1065,11 @@ type property PixelsPerInch: integer read FPixelsPerInch; property PrimaryMonitor: TMonitor read GetPrimaryMonitor; property Width: Integer read GetWidth; + property WorkAreaRect: TRect read GetWorkAreaRect; + property WorkAreaHeight: Integer read GetWorkAreaHeight; + property WorkAreaLeft: Integer read GetWorkAreaLeft; + property WorkAreaTop: Integer read GetWorkAreaTop; + property WorkAreaWidth: Integer read GetWorkAreaWidth; property OnActiveControlChange: TNotifyEvent read FOnActiveControlChange write FOnActiveControlChange; property OnActiveFormChange: TNotifyEvent read FOnActiveFormChange diff --git a/lcl/include/screen.inc b/lcl/include/screen.inc index 0429b2c36d..b8e4f71ea8 100644 --- a/lcl/include/screen.inc +++ b/lcl/include/screen.inc @@ -654,6 +654,48 @@ begin Result := GetSystemMetrics(SM_CXVIRTUALSCREEN); end; +function TScreen.GetDesktopLeft: Integer; +begin + Result := GetSystemMetrics(SM_XVIRTUALSCREEN); +end; + +function TScreen.GetDesktopRect: TRect; +begin + Result := Bounds(DesktopLeft, DesktopTop, DesktopWidth, DesktopHeight); +end; + +function TScreen.GetDesktopTop: Integer; +begin + Result := GetSystemMetrics(SM_YVIRTUALSCREEN); +end; + +function TScreen.GetWorkAreaLeft: Integer; +begin + Result := WorkAreaRect.Left; +end; + +function TScreen.GetWorkAreaRect: TRect; +begin + SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0); +end; + +function TScreen.GetWorkAreaTop: Integer; +begin + Result := WorkAreaRect.Top; +end; + +function TScreen.GetWorkAreaHeight: Integer; +begin + with WorkAreaRect do Result := Bottom - Top; +end; + +function TScreen.GetWorkAreaWidth: Integer; +begin + with WorkAreaRect do Result := Right - Left; +end; + + + {------------------------------------------------------------------------------ Function: TScreen.AddForm Params: FForm: The form to be added diff --git a/lcl/interfaces/carbon/carbonwinapi.inc b/lcl/interfaces/carbon/carbonwinapi.inc index 611d24bc2b..fe4bbe08c8 100644 --- a/lcl/interfaces/carbon/carbonwinapi.inc +++ b/lcl/interfaces/carbon/carbonwinapi.inc @@ -3616,6 +3616,21 @@ begin TCarbonBitmap(Mask), XMask, YMask, Rop); end; +function TCarbonWidgetSet.SystemParametersInfo(uiAction: DWord; uiParam: DWord; + pvParam: Pointer; fWinIni: DWord): LongBool; +begin + Result:=False; + Case uiAction of + SPI_GETWORKAREA: begin + TRect(pvParam^):=Bounds(GetSystemMetrics(SM_XVIRTUALSCREEN), + GetSystemMetrics(SM_YVIRTUALSCREEN), + GetSystemMetrics(SM_CXVIRTUALSCREEN), + GetSystemMetrics(SM_CYVIRTUALSCREEN)); + Result:=True; + end; + end; +end; + {------------------------------------------------------------------------------ Method: TextOut Params: DC - Handle of the device context diff --git a/lcl/interfaces/carbon/carbonwinapih.inc b/lcl/interfaces/carbon/carbonwinapih.inc index eb35764b23..ba2ca3b07a 100644 --- a/lcl/interfaces/carbon/carbonwinapih.inc +++ b/lcl/interfaces/carbon/carbonwinapih.inc @@ -217,6 +217,7 @@ function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; ov function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override; function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override; function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Mask: HBITMAP; XMask, YMask: Integer; Rop: DWORD): Boolean; override; +function SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool; override; function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override; function UpdateWindow(Handle: HWND): Boolean; override; diff --git a/lcl/interfaces/gtk/gtkwinapi.inc b/lcl/interfaces/gtk/gtkwinapi.inc index 5d2c81a549..48105596cc 100644 --- a/lcl/interfaces/gtk/gtkwinapi.inc +++ b/lcl/interfaces/gtk/gtkwinapi.inc @@ -9776,6 +9776,21 @@ begin Rop); end; +function TGTKWidgetSet.SystemParametersInfo(uiAction: DWord; uiParam: DWord; + pvParam: Pointer; fWinIni: DWord): LongBool; +begin + Result:=False; + Case uiAction of + SPI_GETWORKAREA: begin + TRect(pvParam^):=Bounds(GetSystemMetrics(SM_XVIRTUALSCREEN), + GetSystemMetrics(SM_YVIRTUALSCREEN), + GetSystemMetrics(SM_CXVIRTUALSCREEN), + GetSystemMetrics(SM_CYVIRTUALSCREEN)); + Result:=True; + end; + end; +end; + {------------------------------------------------------------------------------ Function: TextOut Params: DC: diff --git a/lcl/interfaces/gtk/gtkwinapih.inc b/lcl/interfaces/gtk/gtkwinapih.inc index f97aaeaf90..4a04cde4d8 100644 --- a/lcl/interfaces/gtk/gtkwinapih.inc +++ b/lcl/interfaces/gtk/gtkwinapih.inc @@ -215,6 +215,7 @@ function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; ov function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override; function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override; function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Mask: HBITMAP; XMask, YMask: Integer; Rop: DWORD): Boolean; override; +function SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool; override; function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override; diff --git a/lcl/interfaces/gtk2/gtk2winapi.inc b/lcl/interfaces/gtk2/gtk2winapi.inc index 00c764bcce..9fb2cd03c6 100644 --- a/lcl/interfaces/gtk2/gtk2winapi.inc +++ b/lcl/interfaces/gtk2/gtk2winapi.inc @@ -9106,6 +9106,21 @@ begin Rop); end; +function TGtk2WidgetSet.SystemParametersInfo(uiAction: DWord; uiParam: DWord; + pvParam: Pointer; fWinIni: DWord): LongBool; +begin + Result:=False; + Case uiAction of + SPI_GETWORKAREA: begin + TRect(pvParam^):=Bounds(GetSystemMetrics(SM_XVIRTUALSCREEN), + GetSystemMetrics(SM_YVIRTUALSCREEN), + GetSystemMetrics(SM_CXVIRTUALSCREEN), + GetSystemMetrics(SM_CYVIRTUALSCREEN)); + Result:=True; + end; + end; +end; + {------------------------------------------------------------------------------ Function: TextOut Params: DC: diff --git a/lcl/interfaces/gtk2/gtk2winapih.inc b/lcl/interfaces/gtk2/gtk2winapih.inc index d9f4f403e6..91e034768f 100644 --- a/lcl/interfaces/gtk2/gtk2winapih.inc +++ b/lcl/interfaces/gtk2/gtk2winapih.inc @@ -231,6 +231,7 @@ function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; ov function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override; function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override; function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Mask: HBITMAP; XMask, YMask: Integer; Rop: DWORD): Boolean; override; +function SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool; override; function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override; diff --git a/lcl/interfaces/qt/qtwinapi.inc b/lcl/interfaces/qt/qtwinapi.inc index e729a01430..e332e8322a 100644 --- a/lcl/interfaces/qt/qtwinapi.inc +++ b/lcl/interfaces/qt/qtwinapi.inc @@ -5790,6 +5790,13 @@ function TQtWidgetSet.SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvPa begin case uiAction of SPI_GETWHEELSCROLLLINES: PDword(pvPAram)^ := QApplication_wheelScrollLines; + SPI_GETWORKAREA: begin + TRect(pvParam^):=Bounds(GetSystemMetrics(SM_XVIRTUALSCREEN), + GetSystemMetrics(SM_YVIRTUALSCREEN), + GetSystemMetrics(SM_CXVIRTUALSCREEN), + GetSystemMetrics(SM_CYVIRTUALSCREEN)); + Result:=True; + end; else Result := False; end diff --git a/lcl/interfaces/wince/wincewinapi.inc b/lcl/interfaces/wince/wincewinapi.inc index 0d47191f85..0107af33e1 100644 --- a/lcl/interfaces/wince/wincewinapi.inc +++ b/lcl/interfaces/wince/wincewinapi.inc @@ -3534,6 +3534,12 @@ begin Result := true; end; +function TWinCEWidgetSet.SystemParametersInfo(uiAction: DWord; uiParam: DWord; + pvParam: Pointer; fWinIni: DWord): LongBool; +begin + Result := Windows.SystemParametersInfo(uiAction, uiParam, pvParam, fWinIni); +end; + {------------------------------------------------------------------------------ Method: TextOut Params: DC - handle of device context diff --git a/lcl/interfaces/wince/wincewinapih.inc b/lcl/interfaces/wince/wincewinapih.inc index cc3d16bd0f..4a3662674e 100644 --- a/lcl/interfaces/wince/wincewinapih.inc +++ b/lcl/interfaces/wince/wincewinapih.inc @@ -229,6 +229,7 @@ function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; ov function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; override; function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; ROp: Cardinal): Boolean; override; function StretchMaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Mask: HBITMAP; XMask, YMask: Integer; Rop: DWORD): Boolean; override; +function SystemParametersInfo(uiAction: DWord; uiParam: DWord; pvParam: Pointer; fWinIni: DWord): LongBool; override; function TextOut(DC: HDC; X,Y : Integer; Str : Pchar; Count: Integer) : Boolean; override;