|
There is a Form class that the IDE is aware of that you may create a
descendant of, TDesignWindow. This class is informed when the the
user interacts with the Object Inspector and Components. It is
notified when a property is modified, item is deleted/inserted,
selection of items changes, designers are opened or closed, or can
request the current state of the items being edited. It has a built
in self registration scheme with the IDE and just the creation of a
descendant of the base class is enough to allow the IDE to begin
interacting with it.
This class is not documented and has gone through changes
between Delphi 5 and Delphi 6. In Delphi 6 and greater it is found in the
$(DELPHI)\Source\ToolsAPI\DesignWindows.pas
and is defined as such:
|
TDesignWindow = class(TForm,
IUnknown, IDesignWindow, IDesignNotification, IEditHandler, IActivatable)
private
FSelection: IDesignerSelections;
FOwner: TComponent;
FDesigner: IDesigner;
FComponentDesigner: IComponentDesigner;
FActive: Boolean;
procedure
ComponentRead(Component: TComponent);
procedure
ReaderSetName(Reader: TReader; Component: TComponent; var Name: string);
procedure
WMActivate(var Msg: TWMActivate); message WM_ACTIVATE;
protected
procedure
Activated; dynamic;
procedure
ActivateInspector(Ch: Char);
function
ClipboardComponents: Boolean;
procedure
CopyComponents(Root: TComponent; const Components: IDesignerSelections);
procedure
PasteComponents(AOwner, AParent: TComponent; const Components: IDesignerSelections);
procedure
SetSelection(const Components: IDesignerSelections);
function
UniqueName(Component: TComponent): string; virtual;
public
constructor
Create(AOwner: TComponent); override;
destructor
Destroy; override;
// IEditHandler
function
GetEditState: TEditState; virtual;
function
EditAction(Action: TEditAction): Boolean; virtual;
// IDesignNotification
procedure
ItemDeleted(const ADesigner: IDesigner; Item: TPersistent); virtual;
procedure
ItemInserted(const ADesigner: IDesigner; Item: TPersistent); virtual;
procedure
SelectionChanged(const ADesigner: IDesigner; const ASelection:
IDesignerSelections); virtual;
procedure
DesignerOpened(const Designer: IDesigner; AResurrecting: Boolean); virtual;
procedure
DesignerClosed(const Designer: IDesigner; AGoingDormant: Boolean); virtual;
procedure
ItemsModified(const Designer: IDesigner); virtual;
// IDesignWindowActions
procedure
WindowHide; virtual;
procedure
WindowShow; virtual;
property
Active: Boolean read FActive;
property
Designer: IDesigner read FDesigner write FDesigner;
property
ComponentDesigner: IComponentDesigner read FComponentDesigner;
end; |
file in Delphi 5 it is found in the
$(Delphi)\Docs\dsgnwnds.int
as only the interface section is documented in earlier versions of
Delphi and is defined as
|
TDesignWindow = class(TForm, IUnknown,
IDesignNotification, IDesignEditQuery)
protected
procedure Activated; dynamic;
procedure ActivateInspector(Ch: Char);
function ClipboardComponents: Boolean;
procedure CopyComponents(Root:
TComponent; Components: TDesignerSelectionList);
procedure PasteComponents(AOwner,
AParent: TComponent; Components: TDesignerSelectionList);
procedure SetSelection(Components: TDesignerSelectionList);
function UniqueName(Component:
TComponent): string; virtual; abstract;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
// IDesignEditQuery
function GetEditState: TEditState; virtual;
procedure EditAction(Action:
TEditAction); virtual;
// IDesignNotification
procedure ItemDeleted(const Item: IPersistent);
procedure ItemInserted(const Item: IPersistent);
procedure SelectionChanged(const
ASelection: IDesignerSelections); overload;
procedure DesignerInitialized(const
Designer: IUnknown);
procedure DesignerClosed(const Designer: IUnknown);
procedure ItemsModified(const Designer: IUnknown);
// old versions
procedure ComponentDeleted(Component:
IPersistent); virtual;
procedure ComponentInserted(Component:
IPersistent); virtual;
procedure SelectionChanged(ASelection:
TDesignerSelectionList); overload; virtual;
procedure FormClosed(AForm:
TCustomForm); virtual;
procedure FormModified; virtual;
// IDesignWindowActions
procedure WindowHide; virtual;
procedure WindowShow; virtual;
property Active: Boolean;
property Designer: IFormDesigner;
end; |
and in Delphi 4 is is defined as
|
TDesignWindow = class(TForm)
protected
procedure Activated; dynamic;
procedure ActivateInspector(Ch: Char);
function ClipboardComponents: Boolean;
procedure CopyComponents(Root:
TComponent; Components: TComponentList);
procedure PasteComponents(AOwner,
AParent: TComponent; Components: TComponentList);
procedure SetSelection(Components: TComponentList);
function UniqueName(Component:
TComponent): string; virtual; abstract;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ComponentDeleted(Component:
IPersistent); virtual;
function GetEditState: TEditState; virtual;
procedure EditAction(Action:
TEditAction); virtual;
procedure FormClosed(AForm:
TCustomForm); virtual;
procedure FormModified; virtual;
procedure SelectionChanged(ASelection:
TComponentList); virtual;
property Active: Boolean;
property Designer: IFormDesigner;
end; |
As you can see this class has evolved over the last four
released of Delphi making it a bit of a challange to support all
versions with one class.
(To Be Continued...) |