summaryrefslogtreecommitdiff
path: root/src/corelib/gdi
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-18 13:50:26 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-18 13:50:26 +0000
commit98851de91fc5f661087e2859a516b323de6a3c8a (patch)
treea4f3ec94a24ea6060298d0bedb44019f2ab392f1 /src/corelib/gdi
parent98ad0f11febab82677e87492360c1cff3e263e93 (diff)
downloadfpGUI-98851de91fc5f661087e2859a516b323de6a3c8a.tar.xz
* Improved the implementation of the Minimum Width/Height
support under Win32. * Fixed bug #1811433 where the Anchor feature was broken when resizing forms under Windows. We never took into account the window border width and title bar height.
Diffstat (limited to 'src/corelib/gdi')
-rw-r--r--src/corelib/gdi/fpgfx_package.lpk8
-rw-r--r--src/corelib/gdi/gfx_gdi.pas49
2 files changed, 49 insertions, 8 deletions
diff --git a/src/corelib/gdi/fpgfx_package.lpk b/src/corelib/gdi/fpgfx_package.lpk
index 8b6d510d..aa5edb8c 100644
--- a/src/corelib/gdi/fpgfx_package.lpk
+++ b/src/corelib/gdi/fpgfx_package.lpk
@@ -10,7 +10,7 @@
<SearchPaths>
<IncludeFiles Value="..\"/>
<OtherUnitFiles Value="..\;..\..\gui\"/>
- <UnitOutputDirectory Value="..\..\..\lib\"/>
+ <UnitOutputDirectory Value="..\..\..\lib"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
@@ -21,11 +21,11 @@
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
- <Description Value="fpGUI redesign with multiple handles
+ <Description Value="fpGUI redesign with multiple handles
"/>
- <License Value="Modified LGPL
+ <License Value="Modified LGPL
"/>
- <Version Minor="5"/>
+ <Version Minor="5" Release="1"/>
<Files Count="13">
<Item1>
<Filename Value="..\gfxbase.pas"/>
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas
index c366ad28..921c0b1e 100644
--- a/src/corelib/gdi/gfx_gdi.pas
+++ b/src/corelib/gdi/gfx_gdi.pas
@@ -352,16 +352,55 @@ var
//------------
procedure SetMinMaxInfo(var MinMaxInfo: TMINMAXINFO);
+
+ procedure GetWindowBorderDimentions(const w: TfpgWindowBase; var dx, dy: integer);
+ var
+ bx: integer; // left/right border width
+ by: integer; // top/bottom border height
+ bt: integer; // title bar
+ begin
+ bx := 0;
+ by := 0;
+ bt := 0;
+
+ if w.WindowType in [wtWindow, wtModalForm] then
+ begin
+ if w is TfpgForm then
+ begin
+ if TfpgForm(w).Sizeable then
+ begin
+ bx := GetSystemMetrics(SM_CXSIZEFRAME);
+ by := GetSystemMetrics(SM_CYSIZEFRAME);
+ end
+ else
+ begin
+ bx := GetSystemMetrics(SM_CXFIXEDFRAME);
+ by := GetSystemMetrics(SM_CYFIXEDFRAME);
+ end;
+ end;
+ bt := GetSystemMetrics(SM_CYCAPTION);
+ end;
+ dx := (2 * bx);
+ dy := (2 * by) + bt;
+ end;
+
procedure SetWin32SizePoint(AWidth, AHeight: integer; var pt: TPoint);
var
IntfWidth: integer;
IntfHeight: integer;
+ dx: integer;
+ dy: integer;
begin
// 0 means no constraint
// if (AWidth=0) and (AHeight=0) then exit;
-
- IntfWidth := AWidth;
- IntfHeight := AHeight;
+ dx := 0;
+ dy := 0;
+ IntfWidth := AWidth;
+ IntfHeight := AHeight;
+
+ GetWindowBorderDimentions(w, dx, dy);
+ Inc(IntfWidth, dx);
+ Inc(IntfHeight, dy);
if AWidth > 0 then
pt.X := IntfWidth;
@@ -369,7 +408,7 @@ var
pt.Y := IntfHeight;
end;
begin
- if (w = nil) or not (w is TfpgForm) then
+ if (w = nil) {or not (w is TfpgForm)} then
Exit; //==>
SetWin32SizePoint(w.MinWidth, w.MinHeight, MinMaxInfo.ptMinTrackSize);
// SetWin32SizePoint(MaxWidth, MaxHeight, MinMaxInfo.ptMaxSize);
@@ -971,6 +1010,8 @@ begin
rwidth := FWidth;
rheight := FHeight;
+ // Because a child has no borders or title bar the
+ // client area size gets adjusted.
if (FWinStyle and WS_CHILD) = 0 then
begin
r.Left := FLeft;