mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-22 23:10:42 +01:00
DividerBevel: implemented Transparent
git-svn-id: trunk@36511 -
This commit is contained in:
parent
23849c7fce
commit
de0cf80cde
@ -31,10 +31,12 @@ type
|
|||||||
FBevelTop: Integer;
|
FBevelTop: Integer;
|
||||||
FBevelHeight: Integer;
|
FBevelHeight: Integer;
|
||||||
FNeedCalcSize: Boolean;
|
FNeedCalcSize: Boolean;
|
||||||
|
FTransparent: Boolean;
|
||||||
|
|
||||||
procedure CalcSize;
|
procedure CalcSize;
|
||||||
procedure SetCaptionSpacing(const AValue: Integer);
|
procedure SetCaptionSpacing(const AValue: Integer);
|
||||||
procedure SetLeftIndent(const AValue: Integer);
|
procedure SetLeftIndent(const AValue: Integer);
|
||||||
|
procedure SetTransparent(AValue: Boolean);
|
||||||
protected
|
protected
|
||||||
class function GetControlClassDefaultSize: TSize; override;
|
class function GetControlClassDefaultSize: TSize; override;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
@ -59,6 +61,7 @@ type
|
|||||||
property ParentFont;
|
property ParentFont;
|
||||||
property ParentShowHint;
|
property ParentShowHint;
|
||||||
property ShowHint;
|
property ShowHint;
|
||||||
|
property Transparent: Boolean read FTransparent write SetTransparent default True;
|
||||||
property Visible;
|
property Visible;
|
||||||
published
|
published
|
||||||
property CaptionSpacing: Integer read FCaptionSpacing write SetCaptionSpacing
|
property CaptionSpacing: Integer read FCaptionSpacing write SetCaptionSpacing
|
||||||
@ -111,6 +114,13 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDividerBevel.SetTransparent(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FTransparent = AValue then Exit;
|
||||||
|
FTransparent := AValue;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TDividerBevel.GetControlClassDefaultSize: TSize;
|
class function TDividerBevel.GetControlClassDefaultSize: TSize;
|
||||||
begin
|
begin
|
||||||
Result.CX := 150;
|
Result.CX := 150;
|
||||||
@ -122,9 +132,11 @@ var
|
|||||||
PaintRect: TRect;
|
PaintRect: TRect;
|
||||||
begin
|
begin
|
||||||
CalcSize;
|
CalcSize;
|
||||||
Canvas.Brush.Color := Color;
|
if not FTransparent then begin
|
||||||
Canvas.Brush.Style := bsSolid;
|
Canvas.Brush.Color := Color;
|
||||||
Canvas.FillRect(ClientRect);
|
Canvas.Brush.Style := bsSolid;
|
||||||
|
Canvas.FillRect(ClientRect);
|
||||||
|
end;
|
||||||
|
|
||||||
Canvas.Pen.Color := Font.Color;
|
Canvas.Pen.Color := Font.Color;
|
||||||
PaintRect.Top := FBevelTop;
|
PaintRect.Top := FBevelTop;
|
||||||
@ -144,6 +156,7 @@ begin
|
|||||||
PaintRect.Right := Width;
|
PaintRect.Right := Width;
|
||||||
Canvas.Frame3D(PaintRect, 1, bvLowered);
|
Canvas.Frame3D(PaintRect, 1, bvLowered);
|
||||||
|
|
||||||
|
Canvas.Brush.Style := bsClear;
|
||||||
Canvas.TextOut(FLeftIndent + FCaptionSpacing, 0, Caption);
|
Canvas.TextOut(FLeftIndent + FCaptionSpacing, 0, Caption);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -176,6 +189,7 @@ begin
|
|||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
ControlStyle := [csSetCaption];
|
ControlStyle := [csSetCaption];
|
||||||
FCaptionSpacing := 10;
|
FCaptionSpacing := 10;
|
||||||
|
FTransparent := True;
|
||||||
LeftIndent := 60;
|
LeftIndent := 60;
|
||||||
FNeedCalcSize := True;
|
FNeedCalcSize := True;
|
||||||
if (AOwner = nil) or not(csLoading in AOwner.ComponentState) then
|
if (AOwner = nil) or not(csLoading in AOwner.ComponentState) then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user