From 98ad0f11febab82677e87492360c1cff3e263e93 Mon Sep 17 00:00:00 2001 From: graemeg Date: Thu, 18 Oct 2007 09:28:57 +0000 Subject: * Win32: Implemented MinWidth and MinHeight constraint support for Forms. Not sure if we need it for any Widgets or just Forms. --- examples/corelib/canvastest/fpgcanvas.lpi | 9 +++++---- examples/gui/filedialog/filedialog.lpi | 9 +++++---- src/corelib/gdi/gfx_gdi.pas | 32 +++++++++++++++++++++++++++++++ src/corelib/gfx_widget.pas | 1 - 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/examples/corelib/canvastest/fpgcanvas.lpi b/examples/corelib/canvastest/fpgcanvas.lpi index f81836d4..7f1c6c21 100644 --- a/examples/corelib/canvastest/fpgcanvas.lpi +++ b/examples/corelib/canvastest/fpgcanvas.lpi @@ -1,15 +1,15 @@ - - + + - + </General> @@ -24,7 +24,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -43,6 +43,7 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> + <PathDelim Value="\"/> <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> diff --git a/examples/gui/filedialog/filedialog.lpi b/examples/gui/filedialog/filedialog.lpi index 93c2d7b0..06092817 100644 --- a/examples/gui/filedialog/filedialog.lpi +++ b/examples/gui/filedialog/filedialog.lpi @@ -1,15 +1,15 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="6"/> + <PathDelim Value="\"/> + <Version Value="5"/> <General> <Flags> <SaveOnlyProjectUnits Value="True"/> </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <IconPath Value="./"/> + <IconPath Value=".\"/> <TargetFileExt Value=""/> </General> <VersionInfo> @@ -23,7 +23,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -42,6 +42,7 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> + <PathDelim Value="\"/> <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index 5ee48268..c366ad28 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -349,6 +349,33 @@ var mcode: integer; wmsg: TMsg; PaintStruct: TPaintStruct; + + //------------ + procedure SetMinMaxInfo(var MinMaxInfo: TMINMAXINFO); + procedure SetWin32SizePoint(AWidth, AHeight: integer; var pt: TPoint); + var + IntfWidth: integer; + IntfHeight: integer; + begin + // 0 means no constraint +// if (AWidth=0) and (AHeight=0) then exit; + + IntfWidth := AWidth; + IntfHeight := AHeight; + + if AWidth > 0 then + pt.X := IntfWidth; + if AHeight > 0 then + pt.Y := IntfHeight; + end; + begin + if (w = nil) or not (w is TfpgForm) then + Exit; //==> + SetWin32SizePoint(w.MinWidth, w.MinHeight, MinMaxInfo.ptMinTrackSize); +// SetWin32SizePoint(MaxWidth, MaxHeight, MinMaxInfo.ptMaxSize); +// SetWin32SizePoint(MaxWidth, MaxHeight, MinMaxInfo.ptMaxTrackSize); + end; + begin if uMsg = WM_CREATE then begin @@ -546,6 +573,11 @@ begin end; { if blockmsg } end; + WM_GETMINMAXINFO: + begin + SetMinMaxInfo(PMINMAXINFO(LParam)^); + end; + WM_SIZE: begin // note that WM_SIZING allows some control on sizeing diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas index f6eeba24..48559855 100644 --- a/src/corelib/gfx_widget.pas +++ b/src/corelib/gfx_widget.pas @@ -13,7 +13,6 @@ uses type TFocusSearchDirection = (fsdFirst, fsdLast, fsdNext, fsdPrev); - { TfpgWidget } TfpgWidget = class(TfpgWindow) private -- cgit v1.2.3-70-g09d2