summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-06-17 15:40:11 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-06-17 15:40:11 +0200
commit1b1260086d2d9831ead84f83239260966e36a7ce (patch)
tree8bb35fa1558108189c9795cf1ce3d6e6815ece6c
parent618c8d577bdfdf0155fda659560801cf19a00650 (diff)
downloadfpGUI-1b1260086d2d9831ead84f83239260966e36a7ce.tar.xz
gdi implementation of GetWindowState
Now we can retrieve the WindowState of TfpgForm under both Linux and Windows.
-rw-r--r--src/corelib/gdi/fpg_gdi.pas33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index 9bae51c5..ffaefff2 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -188,6 +188,7 @@ type
procedure DoDNDEnabled(const AValue: boolean); override;
procedure DoAcceptDrops(const AValue: boolean); override;
procedure DoDragStartDetected; override;
+ function GetWindowState: TfpgWindowState; override;
property WinHandle: TfpgWinHandle read FWinHandle;
public
constructor Create(AOwner: TComponent); override;
@@ -1940,6 +1941,38 @@ begin
FreeAndNil(wapplication.FDrag);
end;
+function TfpgGDIWindow.GetWindowState: TfpgWindowState;
+const
+ flagsoffs = 0 * sizeof(integer);
+var
+ placement: TWindowPlacement;
+begin
+ Result := inherited GetWindowState;
+ case GetWindowLong(FWinHandle, flagsoffs) of
+ 1:
+ begin
+ Result := wsMaximized; { TODO: this could later become wsFullScreen or something }
+ end;
+
+ 2:
+ begin
+ { Do Nothing. This is actually just vertical fullscreen }
+ end;
+
+ else
+ begin
+ placement.length:= sizeof(placement);
+ if GetWindowPlacement(FWinHandle, placement) then
+ begin
+ case placement.ShowCmd of
+ SW_SHOWMAXIMIZED: result:= wsMaximized;
+ SW_SHOWMINIMIZED: result:= wsMinimized;
+ end;
+ end;
+ end; { case..else }
+ end; { case }
+end;
+
constructor TfpgGDIWindow.Create(AOwner: TComponent);
begin
inherited Create(AOwner);