LCL, TToolBar: Added property Orientation

This commit is contained in:
Martin 2024-12-29 18:08:44 +01:00
parent f0826a35cb
commit 2ef4fc98ab
2 changed files with 22 additions and 1 deletions

View File

@ -2248,11 +2248,17 @@ type
TToolBarOnPaintButton = procedure(Sender: TToolButton; State: integer) of object; TToolBarOnPaintButton = procedure(Sender: TToolButton; State: integer) of object;
TToolBarOrientation = (
tboAutomatic,
tboHorizontal,
tboVertical
);
TToolBarFlag = ( TToolBarFlag = (
tbfUpdateVisibleBarNeeded, tbfUpdateVisibleBarNeeded,
tbfPlacingControls tbfPlacingControls
); );
TToolBarFlags = set of TToolBarFlag; TToolBarFlags = set of TToolBarFlag;
TToolBar = class(TToolWindow) TToolBar = class(TToolWindow)
@ -2260,6 +2266,7 @@ type
FOnPaint: TNotifyEvent; FOnPaint: TNotifyEvent;
FOnPaintButton: TToolBarOnPaintButton; FOnPaintButton: TToolBarOnPaintButton;
FButtonHeight: Integer; FButtonHeight: Integer;
FOrientation: TToolBarOrientation;
FRealizedButtonHeight, FRealizedButtonHeight,
FRealizedButtonWidth, FRealizedButtonWidth,
FRealizedDropDownWidth, FRealizedDropDownWidth,
@ -2308,6 +2315,7 @@ type
procedure SetImagesWidth(const aImagesWidth: Integer); procedure SetImagesWidth(const aImagesWidth: Integer);
procedure SetIndent(const AValue: Integer); procedure SetIndent(const AValue: Integer);
procedure SetList(const AValue: Boolean); procedure SetList(const AValue: Boolean);
procedure SetOrientation(AValue: TToolBarOrientation);
procedure SetShowCaptions(const AValue: Boolean); procedure SetShowCaptions(const AValue: Boolean);
procedure SetTransparent(const AValue: Boolean); procedure SetTransparent(const AValue: Boolean);
procedure SetWrapable(const AValue: Boolean); procedure SetWrapable(const AValue: Boolean);
@ -2425,6 +2433,7 @@ type
property OnResize; property OnResize;
property OnChangeBounds; property OnChangeBounds;
property OnStartDrag; property OnStartDrag;
property Orientation: TToolBarOrientation read FOrientation write SetOrientation default tboAutomatic;
end; end;
{ TCoolBar } { TCoolBar }

View File

@ -244,6 +244,11 @@ end;
function TToolBar.IsVertical: Boolean; function TToolBar.IsVertical: Boolean;
begin begin
case FOrientation of
tboHorizontal: exit(False);
tboVertical: exit(True);
end;
if (Parent is TCoolBar) then if (Parent is TCoolBar) then
Exit(TCoolBar(Parent).Vertical); Exit(TCoolBar(Parent).Vertical);
@ -299,6 +304,13 @@ begin
UpdateVisibleBar; UpdateVisibleBar;
end; end;
procedure TToolBar.SetOrientation(AValue: TToolBarOrientation);
begin
if FOrientation = AValue then Exit;
FOrientation := AValue;
invalidate;
end;
procedure TToolBar.SetFlat(const AValue: Boolean); procedure TToolBar.SetFlat(const AValue: Boolean);
begin begin
if FFlat = AValue then exit; if FFlat = AValue then exit;