mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:39:22 +02:00
lcl: TButtonGlyph
- show always in design time and don't react on ShowMode change - show always for TSpeedButton git-svn-id: trunk@19947 -
This commit is contained in:
parent
ac4b855749
commit
695d17aeb1
@ -88,6 +88,7 @@ type
|
|||||||
|
|
||||||
TButtonGlyph = class(TObject, IUnknown, IImageCacheListener)
|
TButtonGlyph = class(TObject, IUnknown, IImageCacheListener)
|
||||||
private
|
private
|
||||||
|
FIsDesigning: Boolean;
|
||||||
FShowMode: TGlyphShowMode;
|
FShowMode: TGlyphShowMode;
|
||||||
FImageIndexes: array[TButtonState] of Integer;
|
FImageIndexes: array[TButtonState] of Integer;
|
||||||
FImages: TCustomImageList;
|
FImages: TCustomImageList;
|
||||||
@ -125,6 +126,7 @@ type
|
|||||||
BiDiFlags: Longint): TRect;
|
BiDiFlags: Longint): TRect;
|
||||||
procedure Refresh;
|
procedure Refresh;
|
||||||
property Glyph: TBitmap read FOriginal write SetGlyph;
|
property Glyph: TBitmap read FOriginal write SetGlyph;
|
||||||
|
property IsDesigning: Boolean read FIsDesigning write FIsDesigning;
|
||||||
property NumGlyphs: TNumGlyphs read FNumGlyphs write SetNumGlyphs;
|
property NumGlyphs: TNumGlyphs read FNumGlyphs write SetNumGlyphs;
|
||||||
property Images: TCustomImageList read FImages;
|
property Images: TCustomImageList read FImages;
|
||||||
property Width: Integer read GetWidth;
|
property Width: Integer read GetWidth;
|
||||||
|
@ -29,6 +29,7 @@ begin
|
|||||||
FButtonGlyph := TButtonGlyph.Create;
|
FButtonGlyph := TButtonGlyph.Create;
|
||||||
FButtonGlyph.NumGlyphs := 1;
|
FButtonGlyph.NumGlyphs := 1;
|
||||||
FButtonGlyph.OnChange := @GlyphChanged;
|
FButtonGlyph.OnChange := @GlyphChanged;
|
||||||
|
FButtonGlyph.IsDesigning := csDesigning in ComponentState;
|
||||||
Align := alNone;
|
Align := alNone;
|
||||||
RealizeKind;
|
RealizeKind;
|
||||||
end;
|
end;
|
||||||
|
@ -68,6 +68,7 @@ end;
|
|||||||
constructor TButtonGlyph.Create;
|
constructor TButtonGlyph.Create;
|
||||||
begin
|
begin
|
||||||
FImagesCache := nil;
|
FImagesCache := nil;
|
||||||
|
FIsDesigning := False;
|
||||||
FShowMode:= gsmApplication;
|
FShowMode:= gsmApplication;
|
||||||
FOriginal := TGlyphBitmap.Create(Self);
|
FOriginal := TGlyphBitmap.Create(Self);
|
||||||
FOriginal.OnChange := @GlyphChanged;
|
FOriginal.OnChange := @GlyphChanged;
|
||||||
@ -156,6 +157,7 @@ procedure TButtonGlyph.SetShowMode(const AValue: TGlyphShowMode);
|
|||||||
begin
|
begin
|
||||||
if FShowMode = AValue then Exit;
|
if FShowMode = AValue then Exit;
|
||||||
FShowMode := AValue;
|
FShowMode := AValue;
|
||||||
|
if not IsDesigning then
|
||||||
Refresh;
|
Refresh;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -189,6 +191,8 @@ procedure TButtonGlyph.GlyphChanged(Sender: TObject);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if IsDesigning then
|
||||||
|
Exit(True);
|
||||||
case ShowMode of
|
case ShowMode of
|
||||||
gsmAlways:
|
gsmAlways:
|
||||||
Result := True;
|
Result := True;
|
||||||
|
@ -42,6 +42,8 @@ constructor TCustomSpeedButton.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FGlyph := TButtonGlyph.Create;
|
FGlyph := TButtonGlyph.Create;
|
||||||
|
FGlyph.IsDesigning := csDesigning in ComponentState;
|
||||||
|
FGlyph.ShowMode := gsmAlways;
|
||||||
FGlyph.SetTransparentMode(gtmTransparent);
|
FGlyph.SetTransparentMode(gtmTransparent);
|
||||||
FGlyph.OnChange := @GlyphChanged;
|
FGlyph.OnChange := @GlyphChanged;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user