From 1412bf4f4ab12d905f7b47a2676aaa39a82dc221 Mon Sep 17 00:00:00 2001 From: ondrej Date: Wed, 25 Apr 2018 10:56:32 +0000 Subject: [PATCH] LCL: TSpeedButton, TBitBtn: ImageIndex with combo box. Issue #33645 git-svn-id: trunk@57708 - --- components/ideintf/graphpropedits.pas | 6 +++++- lcl/buttons.pp | 12 ++++++------ lcl/include/bitbtn.inc | 6 +++--- lcl/include/buttonglyph.inc | 1 + lcl/include/speedbutton.inc | 4 ++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/components/ideintf/graphpropedits.pas b/components/ideintf/graphpropedits.pas index fe966192fd..60f9bc9331 100644 --- a/components/ideintf/graphpropedits.pas +++ b/components/ideintf/graphpropedits.pas @@ -672,7 +672,11 @@ begin end else begin - Component := Component.GetParentComponent; + if not ( + (Component is TCustomSpeedButton) + or (Component is TCustomBitBtn)) + then + Component := Component.GetParentComponent; if Component = nil then Exit; PropInfo := TypInfo.GetPropInfo(Component, 'Images'); diff --git a/lcl/buttons.pp b/lcl/buttons.pp index 9982568dba..65f3e1802d 100644 --- a/lcl/buttons.pp +++ b/lcl/buttons.pp @@ -169,8 +169,8 @@ type function GetCaptionOfKind(AKind: TBitBtnKind): String; function GetImages: TCustomImageList; procedure SetImages(const aImages: TCustomImageList); - function GetImageIndex: Integer; - procedure SetImageIndex(const aImageIndex: Integer); + function GetImageIndex: TImageIndex; + procedure SetImageIndex(const aImageIndex: TImageIndex); function GetImageWidth: Integer; procedure SetImageWidth(const aImageWidth: Integer); protected @@ -200,7 +200,7 @@ type property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored; property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1; property Images: TCustomImageList read GetImages write SetImages; - property ImageIndex: Integer read GetImageIndex write SetImageIndex default 0; + property ImageIndex: TImageIndex read GetImageIndex write SetImageIndex default -1; property ImageWidth: Integer read GetImageWidth write SetImageWidth default 0; property Kind: TBitBtnKind read FKind write SetKind default bkCustom; property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft; @@ -325,8 +325,8 @@ type procedure WMLButtonDBLCLK(Var Message: TLMLButtonDblClk); message LM_LBUTTONDBLCLK; function GetImages: TCustomImageList; procedure SetImages(const aImages: TCustomImageList); - function GetImageIndex: Integer; - procedure SetImageIndex(const aImageIndex: Integer); + function GetImageIndex: TImageIndex; + procedure SetImageIndex(const aImageIndex: TImageIndex); function GetImageWidth: Integer; procedure SetImageWidth(const aImageWidth: Integer); protected @@ -384,7 +384,7 @@ type property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored; property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0; property Images: TCustomImageList read GetImages write SetImages; - property ImageIndex: Integer read GetImageIndex write SetImageIndex default 0; + property ImageIndex: TImageIndex read GetImageIndex write SetImageIndex default -1; property ImageWidth: Integer read GetImageWidth write SetImageWidth default 0; property Layout: TButtonLayout read FLayout write SetLayout default blGlyphLeft; property Margin: integer read FMargin write SetMargin default -1; diff --git a/lcl/include/bitbtn.inc b/lcl/include/bitbtn.inc index cfa3695147..c1665646e8 100644 --- a/lcl/include/bitbtn.inc +++ b/lcl/include/bitbtn.inc @@ -107,10 +107,10 @@ begin Result := FButtonGlyph.ShowMode; end; -function TCustomBitBtn.GetImageIndex: Integer; +function TCustomBitBtn.GetImageIndex: TImageIndex; begin if FButtonGlyph.ExternalImages=GLCLBtnGlyphs then - Result := 0 + Result := -1 else Result := FButtonGlyph.ExternalImageIndex; end; @@ -162,7 +162,7 @@ begin FButtonGlyph.ShowMode := AValue; end; -procedure TCustomBitBtn.SetImageIndex(const aImageIndex: Integer); +procedure TCustomBitBtn.SetImageIndex(const aImageIndex: TImageIndex); begin FButtonGlyph.ExternalImageIndex := aImageIndex; end; diff --git a/lcl/include/buttonglyph.inc b/lcl/include/buttonglyph.inc index ae4f19a555..37369141d8 100644 --- a/lcl/include/buttonglyph.inc +++ b/lcl/include/buttonglyph.inc @@ -67,6 +67,7 @@ begin FOriginal := TGlyphBitmap.Create(Self); FOriginal.OnChange := @GlyphChanged; FNumGlyphs := Low(TNumGlyphs); + FExternalImageIndex := -1; end; {------------------------------------------------------------------------------ diff --git a/lcl/include/speedbutton.inc b/lcl/include/speedbutton.inc index 812e584284..076abd4200 100644 --- a/lcl/include/speedbutton.inc +++ b/lcl/include/speedbutton.inc @@ -211,7 +211,7 @@ begin end; end; -procedure TCustomSpeedButton.SetImageIndex(const aImageIndex: Integer); +procedure TCustomSpeedButton.SetImageIndex(const aImageIndex: TImageIndex); begin FGlyph.ExternalImageIndex := aImageIndex; end; @@ -1064,7 +1064,7 @@ begin end; end; -function TCustomSpeedButton.GetImageIndex: Integer; +function TCustomSpeedButton.GetImageIndex: TImageIndex; begin Result := FGlyph.ExternalImageIndex; end;