mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 00:02:03 +02:00
ide:
- 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:
parent
00936481e1
commit
a647d94b50
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -42,6 +42,7 @@ uses
|
||||
ImageListEditor,
|
||||
LazIDEIntf,
|
||||
ListViewPropEdit,
|
||||
HeaderControlPropEdit,
|
||||
MacroIntf,
|
||||
MaskPropEdit,
|
||||
MenuIntf,
|
||||
|
69
ideintf/headercontrolpropedit.pp
Normal file
69
ideintf/headercontrolpropedit.pp
Normal 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.
|
@ -147,6 +147,9 @@ resourcestring
|
||||
sccsSGEdtSaveDialog = 'Save';
|
||||
sccsSGEdtMoveRowsCols = 'Move Rows/Cols';
|
||||
|
||||
// HeaderControl Editor
|
||||
sccsHCEditSections = 'Sections Editor ...';
|
||||
|
||||
// component editors
|
||||
nbcesAddPage = 'Add page';
|
||||
nbcesInsertPage = 'Insert page';
|
||||
|
@ -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}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user