TScreen - missing properties (delphi compat.)
Original Reporter info from Mantis: wovan.bugger
-
Reporter name:
Original Reporter info from Mantis: wovan.bugger
- Reporter name:
Description:
I added some missing properties to TScreen implementation 4 win32 + workaround 4 other widgets (i don't know if they have same capabilities).
!May be a call to
SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0);
should be placed somewhere else into "winapih.inc" or wherever is most satisfies your conception.
Additional information:
TScreen = class ()
+
private
function GetDesktopLeft: Integer;
function GetDesktopRect: TRect;
function GetDesktopTop: Integer;
function GetWorkAreaHeight: Integer;
function GetWorkAreaLeft: Integer;
function GetWorkAreaRect: TRect;
function GetWorkAreaTop: Integer;
function GetWorkAreaWidth: Integer;
public
property DesktopLeft: Integer read GetDesktopLeft;
property DesktopTop: Integer read GetDesktopTop;
property DesktopRect: TRect read GetDesktopRect;
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;
implementation
+
function TScreen.GetDesktopLeft: Integer;
begin
{$IFDEF WINDOWS}
Result := GetSystemMetrics(SM_XVIRTUALSCREEN);
{$ELSE}
Result:=0;
{$ENDIF}
end;
function TScreen.GetDesktopRect: TRect;
begin
Result := Bounds(DesktopLeft, DesktopTop, DesktopWidth, DesktopHeight);
end;
function TScreen.GetDesktopTop: Integer;
begin
{$IFDEF WINDOWS}
Result := GetSystemMetrics(SM_YVIRTUALSCREEN);
{$ELSE}
Result:=0;
{$ENDIF}
end;
function TScreen.GetWorkAreaHeight: Integer;
begin
with WorkAreaRect do Result := Bottom - Top;
end;
function TScreen.GetWorkAreaLeft: Integer;
begin
Result := WorkAreaRect.Left;
end;
function TScreen.GetWorkAreaRect: TRect;
begin
{$IFDEF WINDOWS}
SystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0);
{$ELSE}
Result:=DesktopRect;
{$ENDIF}
end;
function TScreen.GetWorkAreaTop: Integer;
begin
Result := WorkAreaRect.Top;
end;
function TScreen.GetWorkAreaWidth: Integer;
begin
with WorkAreaRect do Result := Right - Left;
end;
Mantis conversion info:
- Mantis ID: 19379
- Version: 0.9.31 (SVN)
- Fixed in revision: 31339 (#35a781c6)