summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-06-04 10:19:29 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-06-04 10:19:29 +0000
commit1483bd8c7494635cbf7881ec56530b3551aae1af (patch)
tree68c1379eb717da7b779c509038feee033f4b921e /src
parent2d545ff910bde8b83ccfab2714d2ef89c5dff181 (diff)
downloadfpGUI-1483bd8c7494635cbf7881ec56530b3551aae1af.tar.xz
* Applied a patch from Luiz Americo which fixes some alignment issues inside TfpgPanel.
* I implemented more alignment fixes for TfpgGroupBox and TfpgBevel. * I improved the painting of the focus rectangle it TfpgCheckBox and TfpgRadioButton. * UI Designer's Unknown widget can now act like a container component.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/gfx_widget.pas11
-rw-r--r--src/gui/gui_checkbox.pas2
-rw-r--r--src/gui/gui_panel.pas16
-rw-r--r--src/gui/gui_radiobutton.pas2
4 files changed, 25 insertions, 6 deletions
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index 9d569e66..9b99baa9 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -62,6 +62,7 @@ type
FTextColor: TfpgColor;
procedure SetBackgroundColor(const AValue: TfpgColor); virtual;
procedure SetTextColor(const AValue: TfpgColor); virtual;
+ function GetClientBounds: TfpgRect; virtual;
function GetParent: TfpgWidget; reintroduce;
procedure SetParent(const AValue: TfpgWidget); reintroduce;
procedure SetEnabled(const AValue: boolean); virtual;
@@ -217,6 +218,11 @@ begin
end;
end;
+function TfpgWidget.GetClientBounds: TfpgRect;
+begin
+ Result.SetRect(0, 0, Width, Height);
+end;
+
function TfpgWidget.GetParent: TfpgWidget;
begin
Result := TfpgWidget(inherited GetParent);
@@ -909,10 +915,7 @@ var
begin
if (csLoading in ComponentState) then
Exit; //==>
- FAlignRect.Top := 0;
- FAlignRect.Left := 0;
- FAlignRect.Width := Width;
- FAlignRect.Height := Height;
+ FAlignRect := GetClientBounds;
DoAlign(alTop);
DoAlign(alBottom);
diff --git a/src/gui/gui_checkbox.pas b/src/gui/gui_checkbox.pas
index 463ea405..f0013043 100644
--- a/src/gui/gui_checkbox.pas
+++ b/src/gui/gui_checkbox.pas
@@ -125,7 +125,7 @@ begin
begin
Canvas.SetColor(clText1);
Canvas.SetLineStyle(1, lsDot);
- Canvas.DrawRectangle(1, 1, Width-1, Height-1);
+ Canvas.DrawRectangle(1, 1, Width-2, Height-2);
end;
Canvas.SetLineStyle(1, lsSolid);
diff --git a/src/gui/gui_panel.pas b/src/gui/gui_panel.pas
index d25271a6..2e4280c5 100644
--- a/src/gui/gui_panel.pas
+++ b/src/gui/gui_panel.pas
@@ -38,11 +38,13 @@ type
TPanelBorder = (bsSingle, bsDouble);
+
TfpgAbstractPanel = class(TfpgWidget)
private
FPanelShape: TPanelShape;
FPanelStyle: TPanelStyle;
FPanelBorder: TPanelBorder;
+ function GetClientBounds: TfpgRect; override;
procedure SetPanelStyle(const AValue: TPanelStyle);
procedure SetPanelBorder(const AValue: TPanelBorder);
protected
@@ -128,6 +130,7 @@ type
procedure SetMargin(const AValue: integer);
protected
FFont: TfpgFont;
+ function GetClientBounds: TfpgRect; override;
procedure HandlePaint; override;
public
constructor Create(AOwner: TComponent); override;
@@ -205,6 +208,11 @@ end;
{TfpgAbstractPanel}
+function TfpgAbstractPanel.GetClientBounds: TfpgRect;
+begin
+ Result.SetRect(2, 2, Width - 4, Height - 4);
+end;
+
procedure TfpgAbstractPanel.SetPanelStyle(const AValue: TPanelStyle);
begin
if FPanelStyle <> AValue then
@@ -538,6 +546,14 @@ begin
end;
end;
+function TfpgGroupBox.GetClientBounds: TfpgRect;
+var
+ h: integer;
+begin
+ h := FFont.Height + 4;
+ Result.SetRect(2, h, Width - 4, Height - (h + 2));
+end;
+
procedure TfpgGroupBox.HandlePaint;
var
r: TfpgRect;
diff --git a/src/gui/gui_radiobutton.pas b/src/gui/gui_radiobutton.pas
index cf49365e..31e14656 100644
--- a/src/gui/gui_radiobutton.pas
+++ b/src/gui/gui_radiobutton.pas
@@ -175,7 +175,7 @@ begin
begin
Canvas.SetColor(clText1);
Canvas.SetLineStyle(1, lsDot);
- Canvas.DrawRectangle(1, 1, Width-1, Height-1);
+ Canvas.DrawRectangle(1, 1, Width-2, Height-2);
end;
Canvas.SetLineStyle(1, lsSolid);