- added TCollectionPropertyEditor.ShowCollectionEditor and EditCollection procedure
- added component editor for THeaderControl to allow sections edit from popup menu or double click

git-svn-id: trunk@14642 -
This commit is contained in:
paul 2008-03-26 04:04:49 +00:00
parent 00936481e1
commit a647d94b50
5 changed files with 96 additions and 7 deletions

1
.gitattributes vendored
View File

@ -2205,6 +2205,7 @@ ideintf/graphicpropedit.lfm svneol=native#text/plain
ideintf/graphicpropedit.lrs svneol=native#text/plain
ideintf/graphicpropedit.pas svneol=native#text/plain
ideintf/graphpropedits.pas svneol=native#text/pascal
ideintf/headercontrolpropedit.pp svneol=native#text/pascal
ideintf/helpfpdoc.pas svneol=native#text/pascal
ideintf/idecommands.pas svneol=native#text/pascal
ideintf/idedialogs.pas svneol=native#text/plain

View File

@ -42,6 +42,7 @@ uses
ImageListEditor,
LazIDEIntf,
ListViewPropEdit,
HeaderControlPropEdit,
MacroIntf,
MaskPropEdit,
MenuIntf,

View File

@ -0,0 +1,69 @@
{
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
Property editor for THeaderControl objects
}
unit HeaderControlPropEdit;
{$MODE OBJFPC}{$H+}
interface
uses
Classes, SysUtils, ComCtrls, PropEdits, ComponentEditors, ObjInspStrConsts;
type
{ THeaderControlComponentEditor }
THeaderControlComponentEditor = class(TComponentEditor)
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;
implementation
{ THeaderControlComponentEditor }
procedure THeaderControlComponentEditor.ExecuteVerb(Index: Integer);
var
Hook: TPropertyEditorHook;
AHeaderControl: THeaderControl;
begin
if Index = 0 then
begin
GetHook(Hook);
AHeaderControl := GetComponent as THeaderControl;
EditCollection(AHeaderControl, AHeaderControl.Sections, 'Sections');
if Assigned(Hook) then Hook.Modified(Self);
end;
end;
function THeaderControlComponentEditor.GetVerb(Index: Integer): string;
begin
Result := '';
if Index = 0 then Result := sccsHCEditSections;
end;
function THeaderControlComponentEditor.GetVerbCount: Integer;
begin
Result := 1;
end;
initialization
//Register a component editor for THeaderControl
RegisterComponentEditor(THeaderControl, THeaderControlComponentEditor);
end.

View File

@ -147,6 +147,9 @@ resourcestring
sccsSGEdtSaveDialog = 'Save';
sccsSGEdtMoveRowsCols = 'Move Rows/Cols';
// HeaderControl Editor
sccsHCEditSections = 'Sections Editor ...';
// component editors
nbcesAddPage = 'Add page';
nbcesInsertPage = 'Insert page';

View File

@ -912,6 +912,8 @@ type
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
class function ShowCollectionEditor(ACollection: TCollection;
OwnerPersistent: TPersistent; const PropName: String): TCustomForm;
end;
//==============================================================================
@ -1442,7 +1444,7 @@ type
procedure WritePublishedProperties(Instance: TPersistent);
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
implementation
@ -3706,17 +3708,25 @@ begin
Result := [paDialog, paReadOnly];
end;
Procedure TCollectionPropertyEditor.Edit;
class function TCollectionPropertyEditor.ShowCollectionEditor(
ACollection: TCollection;
OwnerPersistent: TPersistent;
const PropName: String): TCustomForm;
begin
if CollectionForm = nil then
CollectionForm := TCollectionPropertyEditorForm.Create(Application);
CollectionForm.SetCollection(ACollection, OwnerPersistent, PropName);
CollectionForm.EnsureVisible;
end;
procedure TCollectionPropertyEditor.Edit;
var
TheCollection: TCollection;
begin
TheCollection := TCollection(GetObjectValue);
if TheCollection=nil then
if TheCollection = nil then
raise Exception.Create('Collection=nil');
If CollectionForm=nil then
CollectionForm := TCollectionPropertyEditorForm.Create(Application);
CollectionForm.SetCollection(TheCollection,GetComponent(0),GetName);
CollectionForm.EnsureVisible;
ShowCollectionEditor(TheCollection, GetComponent(0), GetName);
end;
{ TClassPropertyEditor }
@ -6183,6 +6193,11 @@ begin
DummyClassForPropTypes.Free;
end;
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
begin
TCollectionPropertyEditor.ShowCollectionEditor(ACollection, AComponent, APropertyName);
end;
initialization
{$I collectionpropeditform.lrs}