summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2009-10-23 09:34:31 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2009-10-23 09:34:31 +0200
commitc9fb1258cd8cc37dba1b36f83ac92716dc544d6e (patch)
tree2f7eedfb2fc7a3b5dda3447eaa3bb8ddb5160605 /src
parent5f610dc4bf2f56080cc88b253d5a8709cf906394 (diff)
downloadfpGUI-c9fb1258cd8cc37dba1b36f83ac92716dc544d6e.tar.xz
New WindowPosition setting of wpOneThirdDown.
Part of the "golden ratio" goodies. It seems to me more pleasing to the eye if a dialog is not 100% centered in the window, but rather 1/3 down of available vertical space. I think Mac OS X also does this.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/fpg_base.pas4
-rw-r--r--src/corelib/gdi/fpg_gdi.pas9
-rw-r--r--src/corelib/x11/fpg_x11.pas8
-rw-r--r--src/gui/charmapdialog.inc2
-rw-r--r--src/gui/fpg_dialogs.pas4
-rw-r--r--src/gui/fpg_form.pas7
-rw-r--r--src/gui/messagedialog.inc2
-rw-r--r--src/gui/selectdirdialog.inc2
8 files changed, 29 insertions, 9 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index 2ebb3201..a616cf31 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -45,7 +45,9 @@ type
TWindowType = (wtChild, wtWindow, wtModalForm, wtPopup);
- TWindowAttribute = (waSizeable, waAutoPos, waScreenCenterPos, waStayOnTop, waFullScreen, waBorderless, waUnblockableMessages, waX11SkipWMHints);
+ TWindowAttribute = (waSizeable, waAutoPos, waScreenCenterPos, waStayOnTop,
+ waFullScreen, waBorderless, waUnblockableMessages, waX11SkipWMHints,
+ waOneThirdDownPos);
TWindowAttributes = set of TWindowAttribute;
TMouseCursor = (mcDefault, mcArrow, mcCross, mcIBeam, mcSizeEW, mcSizeNS,
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index 49f2fb05..fd6aa6d6 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -1370,6 +1370,12 @@ begin
FLeft := (wapplication.ScreenWidth - FWidth) div 2;
FTop := (wapplication.ScreenHeight - FHeight) div 2;
DoMoveWindow(FLeft, FTop);
+ end
+ else if waOneThirdDownPos in FWindowAttributes then
+ begin
+ FLeft := (wapplication.ScreenWidth - FWidth) div 2;
+ FTop := (wapplication.ScreenHeight - FHeight) div 3;
+ DoMoveWindow(FLeft, FTop);
end;
if waStayOnTop in FWindowAttributes then
@@ -1409,7 +1415,8 @@ begin
Windows.ShowWindow(FWinHandle, SW_SHOWNORMAL);
if (waAutoPos in FWindowAttributes) or
- (waScreenCenterPos in FWindowAttributes) then
+ (waScreenCenterPos in FWindowAttributes) or
+ (waOneThirdDownPos in FWindowAttributes) then
begin
GetWindowRect(FWinHandle, r);
FLeft := r.Left;
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index 3d3d3df9..09305c1e 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -1421,10 +1421,16 @@ begin
if waScreenCenterPos in FWindowAttributes then
begin
hints.flags := hints.flags or PPosition;
-
FLeft := (xapplication.ScreenWidth - FWidth) div 2;
FTop := (xapplication.ScreenHeight - FHeight) div 2;
DoMoveWindow(FLeft, FTop);
+ end
+ else if waOneThirdDownPos in FWindowAttributes then
+ begin
+ hints.flags := hints.flags or PPosition;
+ FLeft := (xapplication.ScreenWidth - FWidth) div 2;
+ FTop := (xapplication.ScreenHeight - FHeight) div 3;
+ DoMoveWindow(FLeft, FTop);
end;
if (FWindowType <> wtChild) and (waSizeable in FWindowAttributes) then
diff --git a/src/gui/charmapdialog.inc b/src/gui/charmapdialog.inc
index 7a33f157..5c602627 100644
--- a/src/gui/charmapdialog.inc
+++ b/src/gui/charmapdialog.inc
@@ -185,7 +185,7 @@ begin
Name := 'CharMapForm';
SetPosition(316, 186, 377, 390);
WindowTitle := 'Character Map';
- WindowPosition := wpAuto;
+ WindowPosition := wpOneThirdDown;
OnShow := @FormShow;
StringGrid1 := TfpgStringGrid.Create(self);
diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas
index 418823a5..2ffc803b 100644
--- a/src/gui/fpg_dialogs.pas
+++ b/src/gui/fpg_dialogs.pas
@@ -429,7 +429,7 @@ end;
constructor TfpgMessageBox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
- WindowPosition := wpScreenCenter;
+ WindowPosition := wpOneThirdDown;
Sizeable := False;
FLines := TStringList.Create;
@@ -508,7 +508,7 @@ begin
Height := 400;
MinWidth := 300;
MinHeight := 300;
- WindowPosition := wpScreenCenter;
+ WindowPosition := wpOneThirdDown;
FSpacing := 6;
FDefaultButtonWidth := 80;
diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas
index 20aad60e..8c2545c1 100644
--- a/src/gui/fpg_form.pas
+++ b/src/gui/fpg_form.pas
@@ -29,7 +29,7 @@ uses
fpg_widget;
type
- TWindowPosition = (wpUser, wpAuto, wpScreenCenter);
+ TWindowPosition = (wpUser, wpAuto, wpScreenCenter, wpOneThirdDown);
TCloseAction = (caNone, caHide, caFree{, caMinimize});
TFormCloseEvent = procedure(Sender: TObject; var CloseAction: TCloseAction) of object;
@@ -213,6 +213,11 @@ begin
else
Exclude(FWindowAttributes, waScreenCenterPos);
+ if FWindowPosition = wpOneThirdDown then
+ Include(FWindowAttributes, waOneThirdDownPos)
+ else
+ Exclude(FWindowAttributes, waOneThirdDownPos);
+
if FSizeable then
Include(FWindowAttributes, waSizeable)
else
diff --git a/src/gui/messagedialog.inc b/src/gui/messagedialog.inc
index daa3d0a0..88a22272 100644
--- a/src/gui/messagedialog.inc
+++ b/src/gui/messagedialog.inc
@@ -470,7 +470,7 @@ begin
Height := 400;
MinWidth := 300;
MinHeight := 160;
- WindowPosition := wpScreenCenter;
+ WindowPosition := wpOneThirdDown;
lblName1 := TfpgLabel.Create(self);
with lblName1 do
diff --git a/src/gui/selectdirdialog.inc b/src/gui/selectdirdialog.inc
index 75f04392..35bafff6 100644
--- a/src/gui/selectdirdialog.inc
+++ b/src/gui/selectdirdialog.inc
@@ -200,7 +200,7 @@ begin
Name := 'fpgSelectDirDialog';
SetPosition(20, 20, 300, 370);
WindowTitle := 'Select a Directory'; { TODO : Localize this!! }
- WindowPosition := wpScreenCenter;
+ WindowPosition := wpOneThirdDown;
tv := TfpgTreeView.Create(self);
with tv do