From 1b1260086d2d9831ead84f83239260966e36a7ce Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 17 Jun 2011 15:40:11 +0200 Subject: gdi implementation of GetWindowState Now we can retrieve the WindowState of TfpgForm under both Linux and Windows. --- src/corelib/gdi/fpg_gdi.pas | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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); -- cgit v1.2.3-70-g09d2