mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 15:40:41 +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.lrs svneol=native#text/plain
|
||||||
ideintf/graphicpropedit.pas svneol=native#text/plain
|
ideintf/graphicpropedit.pas svneol=native#text/plain
|
||||||
ideintf/graphpropedits.pas svneol=native#text/pascal
|
ideintf/graphpropedits.pas svneol=native#text/pascal
|
||||||
|
ideintf/headercontrolpropedit.pp svneol=native#text/pascal
|
||||||
ideintf/helpfpdoc.pas svneol=native#text/pascal
|
ideintf/helpfpdoc.pas svneol=native#text/pascal
|
||||||
ideintf/idecommands.pas svneol=native#text/pascal
|
ideintf/idecommands.pas svneol=native#text/pascal
|
||||||
ideintf/idedialogs.pas svneol=native#text/plain
|
ideintf/idedialogs.pas svneol=native#text/plain
|
||||||
|
@ -42,6 +42,7 @@ uses
|
|||||||
ImageListEditor,
|
ImageListEditor,
|
||||||
LazIDEIntf,
|
LazIDEIntf,
|
||||||
ListViewPropEdit,
|
ListViewPropEdit,
|
||||||
|
HeaderControlPropEdit,
|
||||||
MacroIntf,
|
MacroIntf,
|
||||||
MaskPropEdit,
|
MaskPropEdit,
|
||||||
MenuIntf,
|
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';
|
sccsSGEdtSaveDialog = 'Save';
|
||||||
sccsSGEdtMoveRowsCols = 'Move Rows/Cols';
|
sccsSGEdtMoveRowsCols = 'Move Rows/Cols';
|
||||||
|
|
||||||
|
// HeaderControl Editor
|
||||||
|
sccsHCEditSections = 'Sections Editor ...';
|
||||||
|
|
||||||
// component editors
|
// component editors
|
||||||
nbcesAddPage = 'Add page';
|
nbcesAddPage = 'Add page';
|
||||||
nbcesInsertPage = 'Insert page';
|
nbcesInsertPage = 'Insert page';
|
||||||
|
@ -912,6 +912,8 @@ type
|
|||||||
public
|
public
|
||||||
function GetAttributes: TPropertyAttributes; override;
|
function GetAttributes: TPropertyAttributes; override;
|
||||||
procedure Edit; override;
|
procedure Edit; override;
|
||||||
|
class function ShowCollectionEditor(ACollection: TCollection;
|
||||||
|
OwnerPersistent: TPersistent; const PropName: String): TCustomForm;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@ -1442,7 +1444,7 @@ type
|
|||||||
|
|
||||||
|
|
||||||
procedure WritePublishedProperties(Instance: TPersistent);
|
procedure WritePublishedProperties(Instance: TPersistent);
|
||||||
|
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -3706,17 +3708,25 @@ begin
|
|||||||
Result := [paDialog, paReadOnly];
|
Result := [paDialog, paReadOnly];
|
||||||
end;
|
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
|
var
|
||||||
TheCollection: TCollection;
|
TheCollection: TCollection;
|
||||||
begin
|
begin
|
||||||
TheCollection := TCollection(GetObjectValue);
|
TheCollection := TCollection(GetObjectValue);
|
||||||
if TheCollection=nil then
|
if TheCollection = nil then
|
||||||
raise Exception.Create('Collection=nil');
|
raise Exception.Create('Collection=nil');
|
||||||
If CollectionForm=nil then
|
ShowCollectionEditor(TheCollection, GetComponent(0), GetName);
|
||||||
CollectionForm := TCollectionPropertyEditorForm.Create(Application);
|
|
||||||
CollectionForm.SetCollection(TheCollection,GetComponent(0),GetName);
|
|
||||||
CollectionForm.EnsureVisible;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TClassPropertyEditor }
|
{ TClassPropertyEditor }
|
||||||
@ -6183,6 +6193,11 @@ begin
|
|||||||
DummyClassForPropTypes.Free;
|
DummyClassForPropTypes.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
|
||||||
|
begin
|
||||||
|
TCollectionPropertyEditor.ShowCollectionEditor(ACollection, AComponent, APropertyName);
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$I collectionpropeditform.lrs}
|
{$I collectionpropeditform.lrs}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user