mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 11:00:33 +02:00
LCL: groupbox: use csOpaque style if the groupbox shouldn't be transparent, publish ParentBackground
git-svn-id: trunk@64871 -
This commit is contained in:
parent
6be311758d
commit
28e5806a74
@ -20,6 +20,21 @@ begin
|
||||
Result.CY := 105;
|
||||
end;
|
||||
|
||||
procedure TCustomGroupBox.SetParentBackground(const AParentBackground: Boolean);
|
||||
begin
|
||||
inherited SetParentBackground(AParentBackground);
|
||||
|
||||
UpdateOpaque;
|
||||
end;
|
||||
|
||||
procedure TCustomGroupBox.UpdateOpaque;
|
||||
begin
|
||||
if ParentBackground then
|
||||
ControlStyle := ControlStyle - [csOpaque]
|
||||
else
|
||||
ControlStyle := ControlStyle + [csOpaque];
|
||||
end;
|
||||
|
||||
procedure TCustomGroupBox.CreateParams(var Params: TCreateParams);
|
||||
begin
|
||||
inherited CreateParams(Params);
|
||||
@ -33,9 +48,18 @@ constructor TCustomGroupBox.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
fCompStyle := csGroupBox;
|
||||
ControlStyle := ControlStyle + [csAcceptsControls];
|
||||
ControlStyle := ControlStyle + [csAcceptsControls, csParentBackground];
|
||||
with GetControlClassDefaultSize do
|
||||
SetInitialBounds(0, 0, CX, CY);
|
||||
end;
|
||||
|
||||
procedure TCustomGroupBox.CMParentColorChanged(var Message: TLMessage);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if csLoading in ComponentState then Exit;
|
||||
|
||||
UpdateOpaque;
|
||||
end;
|
||||
|
||||
// included by stdctrls.pp
|
||||
|
@ -166,9 +166,15 @@ type
|
||||
protected
|
||||
class procedure WSRegisterClass; override;
|
||||
class function GetControlClassDefaultSize: TSize; override;
|
||||
|
||||
procedure UpdateOpaque;
|
||||
procedure CreateParams(var Params: TCreateParams); override;
|
||||
procedure SetParentBackground(const AParentBackground: Boolean); override;
|
||||
procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
|
||||
property ParentBackground default True;
|
||||
end;
|
||||
|
||||
|
||||
@ -194,6 +200,7 @@ type
|
||||
property DragMode;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property ParentBackground;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentDoubleBuffered;
|
||||
|
Loading…
Reference in New Issue
Block a user