diff --git a/lcl/buttonpanel.pas b/lcl/buttonpanel.pas index e219cc67a3..23d1f476cc 100644 --- a/lcl/buttonpanel.pas +++ b/lcl/buttonpanel.pas @@ -15,7 +15,7 @@ interface uses Math, Types, SysUtils, Classes, // LCL - LCLType, LMessages, Controls, ExtCtrls, StdCtrls, Buttons, Forms, Graphics, Themes, + LCLType, LMessages, Controls, ExtCtrls, StdCtrls, Buttons, Forms, Graphics, Themes, Menus, // LazUtils GraphType; @@ -61,7 +61,6 @@ type FShowButtons: TPanelButtons; FShowGlyphs: TPanelButtons; FBevel: TBevel; - FGlyphs: array[TPanelButton] of TBitmap; FButtons: array[TPanelButton] of TPanelBitBtn; FButtonsWidth: Integer; FButtonsHeight: Integer; @@ -98,7 +97,6 @@ type procedure CMShowingChanged(var Message: TLMessage); message CM_SHOWINGCHANGED; public constructor Create(AOwner: TComponent); override; - destructor Destroy; override; property Align default alBottom; property AutoSize default True; @@ -235,13 +233,10 @@ begin begin if FButtons[btn] = nil then Continue; - if btn in FShowGlyphs - then begin - FButtons[btn].Glyph.Assign(FGlyphs[btn]); - end - else begin - FButtons[btn].Glyph.Assign(nil); - end; + if btn in FShowGlyphs then + FButtons[btn].GlyphShowMode := gsmApplication + else + FButtons[btn].GlyphShowMode := gsmNever; end; EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomButtonPanel.DoShowGlyphs'){$ENDIF}; end; @@ -548,16 +543,10 @@ begin AutoSize := true; TabOrder := Ord(AButton); //initial order Align := alCustom; - if FGlyphs[AButton] = nil - then begin - // first time - FGlyphs[AButton] := TBitmap.Create; - FGlyphs[AButton].Assign(Glyph); - end; - // (re)set the glyph if needed - if (AButton in FShowGlyphs) - then Glyph.Assign(FGlyphs[AButton]) - else Glyph.Assign(nil); + if AButton in FShowGlyphs then + GlyphShowMode := gsmApplication + else + GlyphShowMode := gsmNever; // set default Default := AButton = FDefaultButton; @@ -690,13 +679,4 @@ begin //debugln(['TCustomButtonPanel.CalculatePreferredSize ',DbgSName(Self),' ',PreferredWidth,'x',PreferredHeight]); end; -destructor TCustomButtonPanel.Destroy; -var - btn: TPanelButton; -begin - for btn := Low(btn) to High(btn) do - FreeAndNil(FGlyphs[btn]); - inherited Destroy; -end; - end.