diff options
-rw-r--r-- | examples/apps/uidesigner/vfdwidgets.pas | 1 | ||||
-rw-r--r-- | src/corelib/gfx_widget.pas | 11 | ||||
-rw-r--r-- | src/gui/gui_checkbox.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_panel.pas | 16 | ||||
-rw-r--r-- | src/gui/gui_radiobutton.pas | 2 |
5 files changed, 26 insertions, 6 deletions
diff --git a/examples/apps/uidesigner/vfdwidgets.pas b/examples/apps/uidesigner/vfdwidgets.pas index 71cacc1d..730dbb89 100644 --- a/examples/apps/uidesigner/vfdwidgets.pas +++ b/examples/apps/uidesigner/vfdwidgets.pas @@ -417,6 +417,7 @@ begin wc := TVFDWidgetClass.Create(TOtherWidget); wc.NameBase := 'Custom'; wc.WidgetIconName := 'vfd.other'; + wc.Container := True; RegisterVFDWidget(wc); VFDOtherWidget := wc; end; 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); |