IDE: Fix grid image index property editor not finding the image list

git-svn-id: trunk@57975 -
This commit is contained in:
wp 2018-05-19 17:02:56 +00:00
parent 35068a948a
commit be91e3f128

View File

@ -17,7 +17,7 @@ interface
uses uses
Classes, TypInfo, SysUtils, LCLProc, Forms, Controls, LCLType, GraphType, Classes, TypInfo, SysUtils, LCLProc, Forms, Controls, LCLType, GraphType,
LazFileUtils, Graphics, Buttons, Menus, ExtCtrls, Dialogs, LazFileUtils, Graphics, Buttons, Menus, ExtCtrls, Dialogs, Grids,
LCLIntf, PropEdits, PropEditUtils, ImgList, EditBtn, Math, LCLIntf, PropEdits, PropEditUtils, ImgList, EditBtn, Math,
GraphicPropEdit; // defines TGraphicPropertyEditorForm GraphicPropEdit; // defines TGraphicPropertyEditorForm
@ -142,6 +142,14 @@ type
ACanvas: TCanvas; const ARect: TRect; AState: TPropEditDrawState); override; ACanvas: TCanvas; const ARect: TRect; AState: TPropEditDrawState); override;
end; end;
{ TGridImageIndexPropertyEditor
ImageIndex property editor specialized for a grid's title and sort images. }
TGridImageIndexPropertyEditor = class(TImageIndexPropertyEditor)
protected
function GetImageList: TCustomImageList; override;
end;
//============================================================================== //==============================================================================
// Delphi Compatible Property Editor Classnames // Delphi Compatible Property Editor Classnames
@ -751,6 +759,29 @@ begin
inherited ListDrawValue(CurValue, Index, ACanvas, R, AState); inherited ListDrawValue(CurValue, Index, ACanvas, R, AState);
end; end;
{ TGridImageIndexPropertyEditor }
type
TCustomGridOpener = class(TCustomGrid);
function TGridImageIndexPropertyEditor.GetImagelist: TCustomImagelist;
var
grid: TComponent;
p: TPersistent;
begin
Result := nil;
p := GetComponent(0);
if (p is TGridColumnTitle) then begin
p := TGridColumnTitle(p).Column;
if not (p is TGridColumn) then exit;
p := TGridColumn(p).Collection;
if not (p is TGridColumns) then exit;
p := TGridColumns(p).Grid;
end;
if p is TCustomGrid then
Result := TCustomGridOpener(p).TitleImageList
end;
initialization initialization
RegisterPropertyEditor(TypeInfo(TGraphicsColor), nil, '', TColorPropertyEditor); RegisterPropertyEditor(TypeInfo(TGraphicsColor), nil, '', TColorPropertyEditor);
RegisterPropertyEditor(TypeInfo(TPenStyle), nil, '', TPenStylePropertyEditor); RegisterPropertyEditor(TypeInfo(TPenStyle), nil, '', TPenStylePropertyEditor);
@ -758,8 +789,9 @@ initialization
RegisterPropertyEditor(TypeInfo(AnsiString), TFont, 'Name', TFontNamePropertyEditor); RegisterPropertyEditor(TypeInfo(AnsiString), TFont, 'Name', TFontNamePropertyEditor);
RegisterPropertyEditor(TypeInfo(TFontCharset), nil, 'CharSet', TFontCharsetPropertyEditor); RegisterPropertyEditor(TypeInfo(TFontCharset), nil, 'CharSet', TFontCharsetPropertyEditor);
RegisterPropertyEditor(TypeInfo(TImageIndex), TPersistent, 'ImageIndex', TImageIndexPropertyEditor); RegisterPropertyEditor(TypeInfo(TImageIndex), TPersistent, 'ImageIndex', TImageIndexPropertyEditor);
RegisterPropertyEditor(TypeInfo(TImageIndex), TComponent, 'ImageIndexSortAsc', TImageIndexPropertyEditor); RegisterPropertyEditor(TypeInfo(TImageIndex), TGridColumnTitle, 'ImageIndex', TGridImageIndexPropertyEditor);
RegisterPropertyEditor(TypeInfo(TImageIndex), TComponent, 'ImageIndexSortDesc', TImageIndexPropertyEditor); RegisterPropertyEditor(TypeInfo(TImageIndex), TCustomGrid, 'ImageIndexSortAsc', TGridImageIndexPropertyEditor);
RegisterPropertyEditor(TypeInfo(TImageIndex), TCustomGrid, 'ImageIndexSortDesc', TGridImageIndexPropertyEditor);
RegisterPropertyEditor(ClassTypeInfo(TFont), nil,'',TFontPropertyEditor); RegisterPropertyEditor(ClassTypeInfo(TFont), nil,'',TFontPropertyEditor);
RegisterPropertyEditor(ClassTypeInfo(TGraphic), nil,'',TGraphicPropertyEditor); RegisterPropertyEditor(ClassTypeInfo(TGraphic), nil,'',TGraphicPropertyEditor);
RegisterPropertyEditor(ClassTypeInfo(TPicture), nil,'',TPicturePropertyEditor); RegisterPropertyEditor(ClassTypeInfo(TPicture), nil,'',TPicturePropertyEditor);