mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:19:16 +02:00
added a small text about IDE plugins
git-svn-id: trunk@4186 -
This commit is contained in:
parent
562671b13c
commit
74c562a083
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -182,6 +182,7 @@ designer/sizecompsdlg.pp svneol=native#text/pascal
|
||||
designer/taborderdlg.lfm svneol=native#text/plain
|
||||
designer/taborderdlg.lrs svneol=native#text/pascal
|
||||
designer/taborderdlg.pas svneol=native#text/pascal
|
||||
docs/ExtendingTheIDE.txt svneol=native#text/plain
|
||||
docs/LazarusIDEInternals.pdf -text svneol=unset#application/pdf
|
||||
docs/Packages.txt svneol=native#text/plain
|
||||
examples/bitbtnform.pp svneol=native#text/pascal
|
||||
|
119
docs/ExtendingTheIDE.txt
Normal file
119
docs/ExtendingTheIDE.txt
Normal file
@ -0,0 +1,119 @@
|
||||
Extending the IDE (Overview)
|
||||
============================
|
||||
|
||||
The IDE supports several types of plugins:
|
||||
|
||||
Components
|
||||
These are the items in the component palette. For a example TButton can be
|
||||
used to create Buttons.
|
||||
|
||||
Component Editors
|
||||
Component editors are used when you double click on a component in the
|
||||
designer or to add some extra items to the popup menu of the designer, when
|
||||
you right click on a component.
|
||||
|
||||
Property Editors
|
||||
These are used by the rows in the object inspector.
|
||||
|
||||
Experts
|
||||
These are all other types.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
There are two possibilities to add your own plugins to Lazarus:
|
||||
|
||||
1. Write a package, install it and register your plugins in the 'Register'
|
||||
procedure of a unit.
|
||||
2. Extend the lazarus code, and send your cvs diff to the lazarus mailing list.
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Writing components:
|
||||
|
||||
ToDo
|
||||
Hint: Create a new component via the package editor.
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Writing component editors:
|
||||
|
||||
ToDo
|
||||
Hint: see componenteditors.pas for examples
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Writing property editors
|
||||
|
||||
ToDo
|
||||
Hint: see propedits.pp for examples
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Register event handlers
|
||||
|
||||
There are several events in the IDE, where plugins can add their own handlers.
|
||||
In propedits.pp there is a GlobalDesignHook object, maintains several events
|
||||
for designing. Each event calls a list of handlers. The default handlers are
|
||||
added by the IDE. You can add your own handlers with the AddHandlerXXX and
|
||||
RemoveHandlerXXX methods. They will be called before the default handlers.
|
||||
Examples:
|
||||
|
||||
Adding your handler (this is normally done in the constructor of your object):
|
||||
GlobalDesignHook.AddHandlerComponentAdded(@YourOnComponentAdded);
|
||||
|
||||
Removing your handler:
|
||||
GlobalDesignHook.RemoveHandlerComponentAdded(@YourOnComponentAdded);
|
||||
|
||||
You can remove all handlers at once. For example, it is a good idea to add
|
||||
this line in the destructor of object:
|
||||
GlobalDesignHook.RemoveAllHandlersForObject(Self);
|
||||
|
||||
|
||||
The handlers of GlobalDesignHook:
|
||||
|
||||
// lookup root
|
||||
ChangeLookupRoot
|
||||
Called when the LookupRoot changed.
|
||||
The LookupRoot is the owner object of the currently selected components.
|
||||
Normally this is a TForm.
|
||||
|
||||
// methods
|
||||
CreateMethod
|
||||
GetMethodName
|
||||
GetMethods
|
||||
MethodExists
|
||||
RenameMethod
|
||||
ShowMethod
|
||||
Called
|
||||
MethodFromAncestor
|
||||
ChainCall
|
||||
|
||||
// components
|
||||
GetComponent
|
||||
GetComponentName
|
||||
GetComponentNames
|
||||
GetRootClassName
|
||||
ComponentRenamed
|
||||
Called when a component was renamed
|
||||
ComponentAdded
|
||||
Called when a new component was added to the LookupRoot
|
||||
ComponentDeleting
|
||||
Called before a component is freed.
|
||||
DeleteComponent
|
||||
Called by the IDE to delete a component.
|
||||
GetSelectedComponents
|
||||
Get the current selection of components.
|
||||
|
||||
// persistent objects
|
||||
GetObject
|
||||
GetObjectName
|
||||
GetObjectNames
|
||||
|
||||
// modifing
|
||||
Modified
|
||||
Revert
|
||||
RefreshPropertyValues
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user