mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 14:19:17 +02:00
LCL: added TToolButton.ShowCaption, bug #16778
git-svn-id: trunk@26388 -
This commit is contained in:
parent
cb894f41be
commit
f4aff160db
@ -17422,6 +17422,10 @@ the comparision is case sensitive.
|
|||||||
<element name="TToolBar.WSRegisterClass" link="#LCL.LCLClasses.TLCLComponent.WSRegisterClass"/>
|
<element name="TToolBar.WSRegisterClass" link="#LCL.LCLClasses.TLCLComponent.WSRegisterClass"/>
|
||||||
<element name="TCustomTrackBar.WSRegisterClass" link="#LCL.LCLClasses.TLCLComponent.WSRegisterClass"/>
|
<element name="TCustomTrackBar.WSRegisterClass" link="#LCL.LCLClasses.TLCLComponent.WSRegisterClass"/>
|
||||||
<element name="TCustomTreeView.WSRegisterClass" link="#LCL.LCLClasses.TLCLComponent.WSRegisterClass"/>
|
<element name="TCustomTreeView.WSRegisterClass" link="#LCL.LCLClasses.TLCLComponent.WSRegisterClass"/>
|
||||||
|
<element name="TToolButton.ShowCaption">
|
||||||
|
<short>Show/Hide caption</short>
|
||||||
|
<descr>The ToolBar.ShowCaptions has precendence. Hiding will only work if ToolBar.List is true.</descr>
|
||||||
|
</element>
|
||||||
</module>
|
</module>
|
||||||
<!-- ComCtrls -->
|
<!-- ComCtrls -->
|
||||||
</package>
|
</package>
|
||||||
|
@ -1524,6 +1524,7 @@ type
|
|||||||
FMarked: Boolean;
|
FMarked: Boolean;
|
||||||
FMenuItem: TMenuItem;
|
FMenuItem: TMenuItem;
|
||||||
FMouseInControl: boolean;
|
FMouseInControl: boolean;
|
||||||
|
FShowCaption: boolean;
|
||||||
FStyle: TToolButtonStyle;
|
FStyle: TToolButtonStyle;
|
||||||
FToolButtonFlags: TToolButtonFlags;
|
FToolButtonFlags: TToolButtonFlags;
|
||||||
FUpdateCount: Integer;
|
FUpdateCount: Integer;
|
||||||
@ -1541,6 +1542,7 @@ type
|
|||||||
procedure SetIndeterminate(Value: Boolean);
|
procedure SetIndeterminate(Value: Boolean);
|
||||||
procedure SetMarked(Value: Boolean);
|
procedure SetMarked(Value: Boolean);
|
||||||
procedure SetMenuItem(Value: TMenuItem);
|
procedure SetMenuItem(Value: TMenuItem);
|
||||||
|
procedure SetShowCaption(const AValue: boolean);
|
||||||
procedure SetStyle(Value: TToolButtonStyle);
|
procedure SetStyle(Value: TToolButtonStyle);
|
||||||
procedure SetWrap(Value: Boolean);
|
procedure SetWrap(Value: Boolean);
|
||||||
procedure SetMouseInControl(NewMouseInControl: Boolean);
|
procedure SetMouseInControl(NewMouseInControl: Boolean);
|
||||||
@ -1606,13 +1608,6 @@ type
|
|||||||
property Indeterminate: Boolean read FIndeterminate write SetIndeterminate default False;
|
property Indeterminate: Boolean read FIndeterminate write SetIndeterminate default False;
|
||||||
property Marked: Boolean read FMarked write SetMarked default False;
|
property Marked: Boolean read FMarked write SetMarked default False;
|
||||||
property MenuItem: TMenuItem read FMenuItem write SetMenuItem;
|
property MenuItem: TMenuItem read FMenuItem write SetMenuItem;
|
||||||
property ParentShowHint;
|
|
||||||
property PopupMenu;
|
|
||||||
property Wrap: Boolean read FWrap write SetWrap default False;
|
|
||||||
property ShowHint;
|
|
||||||
property Style: TToolButtonStyle read FStyle write SetStyle default tbsButton;
|
|
||||||
property Visible;
|
|
||||||
property Width stored IsWidthStored;
|
|
||||||
property OnClick;
|
property OnClick;
|
||||||
property OnContextPopup;
|
property OnContextPopup;
|
||||||
property OnDragDrop;
|
property OnDragDrop;
|
||||||
@ -1624,6 +1619,14 @@ type
|
|||||||
property OnMouseUp;
|
property OnMouseUp;
|
||||||
property OnStartDock;
|
property OnStartDock;
|
||||||
property OnStartDrag;
|
property OnStartDrag;
|
||||||
|
property ParentShowHint;
|
||||||
|
property PopupMenu;
|
||||||
|
property ShowCaption: boolean read FShowCaption write SetShowCaption default true;
|
||||||
|
property ShowHint;
|
||||||
|
property Style: TToolButtonStyle read FStyle write SetStyle default tbsButton;
|
||||||
|
property Visible;
|
||||||
|
property Width stored IsWidthStored;
|
||||||
|
property Wrap: Boolean read FWrap write SetWrap default False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TToolBarEnumerator }
|
{ TToolBarEnumerator }
|
||||||
|
@ -59,6 +59,7 @@ begin
|
|||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
FImageIndex := -1;
|
FImageIndex := -1;
|
||||||
FStyle := tbsButton;
|
FStyle := tbsButton;
|
||||||
|
FShowCaption := true;
|
||||||
ControlStyle := [csCaptureMouse, csSetCaption, csDesignNoSmoothResize];
|
ControlStyle := [csCaptureMouse, csSetCaption, csDesignNoSmoothResize];
|
||||||
with GetControlClassDefaultSize do
|
with GetControlClassDefaultSize do
|
||||||
SetInitialBounds(0, 0, CX, CY);
|
SetInitialBounds(0, 0, CX, CY);
|
||||||
@ -259,9 +260,11 @@ begin
|
|||||||
// calculate text size
|
// calculate text size
|
||||||
TextSize.cx:=0;
|
TextSize.cx:=0;
|
||||||
TextSize.cy:=0;
|
TextSize.cy:=0;
|
||||||
if (Style in [tbsButton, tbsDropDown, tbsCheck]) and
|
if (Style in [tbsButton, tbsDropDown, tbsCheck]) and (FToolBar.ShowCaptions)
|
||||||
(FToolBar.ShowCaptions) and
|
and ((FToolbar.List and ShowCaption) //Allow hide caption only in list mode
|
||||||
(Caption <> '') then
|
or not FToolBar.List)
|
||||||
|
and (Caption <> '')
|
||||||
|
then
|
||||||
TextSize := GetTextSize;
|
TextSize := GetTextSize;
|
||||||
|
|
||||||
// calculate icon size
|
// calculate icon size
|
||||||
@ -563,7 +566,7 @@ begin
|
|||||||
if FImageIndex = Value then exit;
|
if FImageIndex = Value then exit;
|
||||||
//debugln('TToolButton.SetImageIndex ',Name,':',ClassName,' Old=',FImageIndex,' New=',Value);
|
//debugln('TToolButton.SetImageIndex ',Name,':',ClassName,' Old=',FImageIndex,' New=',Value);
|
||||||
FImageIndex := Value;
|
FImageIndex := Value;
|
||||||
if Visible and (FToolBar <> nil) then
|
if IsControlVisible and (FToolBar <> nil) then
|
||||||
begin
|
begin
|
||||||
RefreshControl;
|
RefreshControl;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
@ -600,12 +603,23 @@ begin
|
|||||||
FMenuItem.FreeNotification(Self);
|
FMenuItem.FreeNotification(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TToolButton.SetShowCaption(const AValue: boolean);
|
||||||
|
begin
|
||||||
|
if FShowCaption=AValue then exit;
|
||||||
|
FShowCaption:=AValue;
|
||||||
|
if IsControlVisible then
|
||||||
|
begin
|
||||||
|
InvalidatePreferredSize;
|
||||||
|
UpdateVisibleToolbar;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TToolButton.SetStyle(Value: TToolButtonStyle);
|
procedure TToolButton.SetStyle(Value: TToolButtonStyle);
|
||||||
begin
|
begin
|
||||||
if FStyle = Value then exit;
|
if FStyle = Value then exit;
|
||||||
FStyle := Value;
|
FStyle := Value;
|
||||||
InvalidatePreferredSize;
|
InvalidatePreferredSize;
|
||||||
if Visible then
|
if IsControlVisible then
|
||||||
UpdateVisibleToolbar;
|
UpdateVisibleToolbar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -929,7 +943,9 @@ begin
|
|||||||
// calculate text size
|
// calculate text size
|
||||||
TextSize.cx:=0;
|
TextSize.cx:=0;
|
||||||
TextSize.cy:=0;
|
TextSize.cy:=0;
|
||||||
if (Style in [tbsButton,tbsDropDown,tbsCheck]) and (FToolBar.ShowCaptions) then
|
if (Style in [tbsButton,tbsDropDown,tbsCheck]) and (FToolBar.ShowCaptions) and
|
||||||
|
//Allow hide caption only in list mode
|
||||||
|
((FToolBar.List and ShowCaption) or not FToolBar.List) then
|
||||||
begin
|
begin
|
||||||
if (Caption<>'') then
|
if (Caption<>'') then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user