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:
paul 2009-05-13 02:58:39 +00:00
parent ac4b855749
commit 695d17aeb1
4 changed files with 10 additions and 1 deletions

View File

@ -88,6 +88,7 @@ type
TButtonGlyph = class(TObject, IUnknown, IImageCacheListener)
private
FIsDesigning: Boolean;
FShowMode: TGlyphShowMode;
FImageIndexes: array[TButtonState] of Integer;
FImages: TCustomImageList;
@ -125,6 +126,7 @@ type
BiDiFlags: Longint): TRect;
procedure Refresh;
property Glyph: TBitmap read FOriginal write SetGlyph;
property IsDesigning: Boolean read FIsDesigning write FIsDesigning;
property NumGlyphs: TNumGlyphs read FNumGlyphs write SetNumGlyphs;
property Images: TCustomImageList read FImages;
property Width: Integer read GetWidth;

View File

@ -29,6 +29,7 @@ begin
FButtonGlyph := TButtonGlyph.Create;
FButtonGlyph.NumGlyphs := 1;
FButtonGlyph.OnChange := @GlyphChanged;
FButtonGlyph.IsDesigning := csDesigning in ComponentState;
Align := alNone;
RealizeKind;
end;

View File

@ -68,6 +68,7 @@ end;
constructor TButtonGlyph.Create;
begin
FImagesCache := nil;
FIsDesigning := False;
FShowMode:= gsmApplication;
FOriginal := TGlyphBitmap.Create(Self);
FOriginal.OnChange := @GlyphChanged;
@ -156,7 +157,8 @@ procedure TButtonGlyph.SetShowMode(const AValue: TGlyphShowMode);
begin
if FShowMode = AValue then Exit;
FShowMode := AValue;
Refresh;
if not IsDesigning then
Refresh;
end;
function TButtonGlyph.GetHeight: Integer;
@ -189,6 +191,8 @@ procedure TButtonGlyph.GlyphChanged(Sender: TObject);
end;
begin
if IsDesigning then
Exit(True);
case ShowMode of
gsmAlways:
Result := True;

View File

@ -42,6 +42,8 @@ constructor TCustomSpeedButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FGlyph := TButtonGlyph.Create;
FGlyph.IsDesigning := csDesigning in ComponentState;
FGlyph.ShowMode := gsmAlways;
FGlyph.SetTransparentMode(gtmTransparent);
FGlyph.OnChange := @GlyphChanged;