mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-06 11:41:04 +02:00
LCL buttonpanel: fix hiding glyphs with ShowGlyphs. issue #37455
(cherry picked from commit cea0e01fd4
)
This commit is contained in:
parent
cc48d6c1d7
commit
ed085d959f
@ -15,7 +15,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Math, Types, SysUtils, Classes,
|
Math, Types, SysUtils, Classes,
|
||||||
// LCL
|
// LCL
|
||||||
LCLType, LMessages, Controls, ExtCtrls, StdCtrls, Buttons, Forms, Graphics, Themes,
|
LCLType, LMessages, Controls, ExtCtrls, StdCtrls, Buttons, Forms, Graphics, Themes, Menus,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
GraphType;
|
GraphType;
|
||||||
|
|
||||||
@ -60,7 +60,6 @@ type
|
|||||||
FShowButtons: TPanelButtons;
|
FShowButtons: TPanelButtons;
|
||||||
FShowGlyphs: TPanelButtons;
|
FShowGlyphs: TPanelButtons;
|
||||||
FBevel: TBevel;
|
FBevel: TBevel;
|
||||||
FGlyphs: array[TPanelButton] of TBitmap;
|
|
||||||
FButtons: array[TPanelButton] of TPanelBitBtn;
|
FButtons: array[TPanelButton] of TPanelBitBtn;
|
||||||
FButtonsWidth: Integer;
|
FButtonsWidth: Integer;
|
||||||
FButtonsHeight: Integer;
|
FButtonsHeight: Integer;
|
||||||
@ -97,7 +96,6 @@ type
|
|||||||
procedure CMShowingChanged(var Message: TLMessage); message CM_SHOWINGCHANGED;
|
procedure CMShowingChanged(var Message: TLMessage); message CM_SHOWINGCHANGED;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
|
||||||
|
|
||||||
property Align default alBottom;
|
property Align default alBottom;
|
||||||
property AutoSize default True;
|
property AutoSize default True;
|
||||||
@ -234,13 +232,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
if FButtons[btn] = nil then Continue;
|
if FButtons[btn] = nil then Continue;
|
||||||
|
|
||||||
if btn in FShowGlyphs
|
if btn in FShowGlyphs then
|
||||||
then begin
|
FButtons[btn].GlyphShowMode := gsmApplication
|
||||||
FButtons[btn].Glyph.Assign(FGlyphs[btn]);
|
else
|
||||||
end
|
FButtons[btn].GlyphShowMode := gsmNever;
|
||||||
else begin
|
|
||||||
FButtons[btn].Glyph.Assign(nil);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomButtonPanel.DoShowGlyphs'){$ENDIF};
|
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomButtonPanel.DoShowGlyphs'){$ENDIF};
|
||||||
end;
|
end;
|
||||||
@ -547,16 +542,10 @@ begin
|
|||||||
AutoSize := true;
|
AutoSize := true;
|
||||||
TabOrder := Ord(AButton); //initial order
|
TabOrder := Ord(AButton); //initial order
|
||||||
Align := alCustom;
|
Align := alCustom;
|
||||||
if FGlyphs[AButton] = nil
|
if AButton in FShowGlyphs then
|
||||||
then begin
|
GlyphShowMode := gsmApplication
|
||||||
// first time
|
else
|
||||||
FGlyphs[AButton] := TBitmap.Create;
|
GlyphShowMode := gsmNever;
|
||||||
FGlyphs[AButton].Assign(Glyph);
|
|
||||||
end;
|
|
||||||
// (re)set the glyph if needed
|
|
||||||
if (AButton in FShowGlyphs)
|
|
||||||
then Glyph.Assign(FGlyphs[AButton])
|
|
||||||
else Glyph.Assign(nil);
|
|
||||||
// set default
|
// set default
|
||||||
Default := AButton = FDefaultButton;
|
Default := AButton = FDefaultButton;
|
||||||
|
|
||||||
@ -689,13 +678,4 @@ begin
|
|||||||
//debugln(['TCustomButtonPanel.CalculatePreferredSize ',DbgSName(Self),' ',PreferredWidth,'x',PreferredHeight]);
|
//debugln(['TCustomButtonPanel.CalculatePreferredSize ',DbgSName(Self),' ',PreferredWidth,'x',PreferredHeight]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCustomButtonPanel.Destroy;
|
|
||||||
var
|
|
||||||
btn: TPanelButton;
|
|
||||||
begin
|
|
||||||
for btn := Low(btn) to High(btn) do
|
|
||||||
FreeAndNil(FGlyphs[btn]);
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user