Code::Blocks
SVN r11506
|
Base class for plugins. More...
#include <cbplugin.h>
Public Member Functions | |
cbPlugin () | |
In default cbPlugin's constructor the associated PluginInfo structure is filled with default values. More... | |
~cbPlugin () override | |
cbPlugin destructor. More... | |
virtual PluginType | GetType () const |
The plugin must return its type on request. More... | |
virtual int | GetConfigurationPriority () const |
Return the plugin's configuration priority. More... | |
virtual int | GetConfigurationGroup () const |
Return the configuration group for this plugin. More... | |
virtual cbConfigurationPanel * | GetConfigurationPanel (cb_optional wxWindow *parent) |
Return plugin's configuration panel. More... | |
virtual cbConfigurationPanel * | GetProjectConfigurationPanel (cb_optional wxWindow *parent, cb_optional cbProject *project) |
Return plugin's configuration panel for projects. More... | |
virtual void | BuildMenu (cb_optional wxMenuBar *menuBar) |
This method is called by Code::Blocks and is used by the plugin to add any menu items it needs on Code::Blocks's menu bar. More... | |
virtual void | BuildModuleMenu (cb_optional const ModuleType type, cb_optional wxMenu *menu, cb_optional const FileTreeData *data=nullptr) |
This method is called by Code::Blocks core modules (EditorManager, ProjectManager etc) and is used by the plugin to add any menu items it needs in the module's popup menu. More... | |
virtual bool | BuildToolBar (cb_optional wxToolBar *toolBar) |
This method is called by Code::Blocks and is used by the plugin to add any toolbar items it needs on Code::Blocks's toolbar. More... | |
virtual int | GetToolBarPriority () |
This method return the priority of the plugin's toolbar, the less value indicates a more preceding position when C::B starts with no configuration file. More... | |
virtual void | CreateStatusField (cbStatusBar *statusBar) |
This method is called by Code::Blocks and is used by the plugin to add a field on Code::Blocks's statusbar. More... | |
bool | IsAttached () const |
See whether this plugin is attached or not. More... | |
virtual bool | CanDetach () const |
See whether this plugin can be detached (unloaded) or not. More... | |
Protected Member Functions | |
virtual void | OnAttach () |
Any descendent plugin should override this virtual method and perform any necessary initialization. More... | |
virtual void | OnRelease (cb_optional bool appShutDown) |
Any descendent plugin should override this virtual method and perform any necessary de-initialization. More... | |
virtual void | NotImplemented (const wxString &log) const |
This method logs a "Not implemented" message and is provided for convenience only. More... | |
Protected Attributes | |
PluginType | m_Type |
Holds the plugin's type. More... | |
bool | m_IsAttached |
Holds the "attached" state. More... | |
Private Member Functions | |
void | Attach () |
Attach is not a virtual function, so you can't override it. More... | |
void | Release (bool appShutDown) |
Release is not a virtual function, so you can't override it. More... | |
Friends | |
class | PluginManager |
Base class for plugins.
This is the most basic class a plugin must descend from. cbPlugin descends from wxEvtHandler, so it provides its methods as well...
It's not enough to create a new plugin. You must also provide a resource zip file containing a file named "manifest.xml". Check the manifest.xml file of existing plugins to see how to create one (it's ultra-simple).
Definition at line 84 of file cbplugin.h.
cbPlugin::cbPlugin | ( | ) |
In default cbPlugin's constructor the associated PluginInfo structure is filled with default values.
If you inherit from cbPlugin, you should fill the m_PluginInfo members with the appropriate values.
Definition at line 51 of file cbplugin.cpp.
|
override |
cbPlugin destructor.
Definition at line 58 of file cbplugin.cpp.
|
private |
Attach is not a virtual function, so you can't override it.
The default implementation hooks the plugin to Code::Block's event handling system, so that the plugin can receive (and process) events from Code::Blocks core library. Use OnAttach() for any initialization specific tasks.
Definition at line 62 of file cbplugin.cpp.
References cbEVT_PLUGIN_ATTACHED, Manager::Get(), Manager::GetAppWindow(), m_IsAttached, OnAttach(), and Manager::ProcessEvent().
Referenced by PluginManager::AttachPlugin().
|
inlinevirtual |
This method is called by Code::Blocks and is used by the plugin to add any menu items it needs on Code::Blocks's menu bar.
It is a pure virtual method that needs to be implemented by all plugins. If the plugin does not need to add items on the menu, just do nothing ;)
menuBar | the wxMenuBar to create items in |
Definition at line 138 of file cbplugin.h.
Referenced by MainFrame::CreateMenubar(), and MainFrame::DoAddPlugin().
|
inlinevirtual |
This method is called by Code::Blocks core modules (EditorManager, ProjectManager etc) and is used by the plugin to add any menu items it needs in the module's popup menu.
For example, when the user right-clicks on a project file in the project tree, ProjectManager prepares a popup menu to display with context sensitive options for that file. Before it displays this popup menu, it asks all attached plugins (by asking PluginManager to call this method), if they need to add any entries in that menu. This method is called.
If the plugin does not need to add items in the menu, just do nothing ;)
type | the module that's preparing a popup menu |
menu | pointer to the popup menu |
data | pointer to FileTreeData object (to access/modify the file tree) |
Definition at line 155 of file cbplugin.h.
Referenced by PluginManager::AskPluginsForModuleMenu().
|
inlinevirtual |
This method is called by Code::Blocks and is used by the plugin to add any toolbar items it needs on Code::Blocks's toolbar.
It is a pure virtual method that needs to be implemented by all plugins. If the plugin does not need to add items on the toolbar, just do nothing ;)
toolBar | the wxToolBar to create items on |
Definition at line 165 of file cbplugin.h.
Referenced by MainFrame::DoAddPluginToolbar().
|
inlinevirtual |
See whether this plugin can be detached (unloaded) or not.
This function is called usually when the user requests to uninstall or disable a plugin. Before disabling/uninstalling it, Code::Blocks asks the plugin if it can be detached or not. In other words, it checks to see if it can be disabled/uninstalled safely...
Definition at line 198 of file cbplugin.h.
|
inlinevirtual |
This method is called by Code::Blocks and is used by the plugin to add a field on Code::Blocks's statusbar.
If the plugin does not need to add items on the statusbar, just do nothing ;)
statusBar | the cbStatusBar to create items on |
Definition at line 179 of file cbplugin.h.
Referenced by MainFrame::DoAddPluginStatusField().
|
inlinevirtual |
Return the configuration group for this plugin.
Default is cgUnknown. Notice that you can logically AND more than one configuration groups, so you could set it, for example, as "cgCompiler | cgContribPlugin".
Reimplemented in CompilerGCC, and CodeCompletion.
Definition at line 110 of file cbplugin.h.
References cgUnknown.
Referenced by PluginManager::GetConfigurationPanels().
|
inlinevirtual |
Return plugin's configuration panel.
parent | The parent window. |
Definition at line 116 of file cbplugin.h.
Referenced by PluginManager::GetConfigurationPanels().
|
inlinevirtual |
Return the plugin's configuration priority.
This is a number (default is 50) that is used to sort plugins in configuration dialogs. Lower numbers mean the plugin's configuration is put higher in the list.
Reimplemented in CompilerGCC.
Definition at line 104 of file cbplugin.h.
|
inlinevirtual |
Return plugin's configuration panel for projects.
The panel returned from this function will be added in the project's configuration dialog.
parent | The parent window. |
project | The project that is being edited. |
Definition at line 125 of file cbplugin.h.
Referenced by PluginManager::GetProjectConfigurationPanels().
|
inlinevirtual |
This method return the priority of the plugin's toolbar, the less value indicates a more preceding position when C::B starts with no configuration file.
Reimplemented in CodeCompletion, and CompilerGCC.
Definition at line 170 of file cbplugin.h.
Referenced by MainFrame::DoAddPluginToolbar().
|
inlinevirtual |
The plugin must return its type on request.
Definition at line 97 of file cbplugin.h.
Referenced by MainFrame::CreateMenubar(), MainFrame::DoAddPlugin(), PluginManager::ExecutePlugin(), PluginManager::GetOffersFor(), PluginManager::LoadPlugin(), and PluginManager::UnloadPlugin().
|
inline |
See whether this plugin is attached or not.
A plugin should not perform any of its tasks, if not attached...
Definition at line 187 of file cbplugin.h.
Referenced by PluginManager::AskPluginsForModuleMenu(), PluginManager::AttachPlugin(), cbDebuggerPlugin::BuildMenu(), cbDebuggerPlugin::BuildModuleMenu(), CompilerSettingsDlg::CompilerSettingsDlg(), MainFrame::CreateMenubar(), MainFrame::CreateToolbars(), cbDebuggerPlugin::DebugLog(), PluginManager::DetachPlugin(), PluginsConfigurationDlg::FillList(), PluginManager::GetConfigurationPanels(), PluginManager::GetOffersFor(), PluginManager::GetProjectConfigurationPanels(), PluginManager::LoadAllPlugins(), cbDebuggerPlugin::Log(), PluginsConfigurationDlg::OnToggle(), and PluginsConfigurationDlg::OnUpdateUI().
|
protectedvirtual |
This method logs a "Not implemented" message and is provided for convenience only.
Definition at line 109 of file cbplugin.cpp.
References _T, LogManager::DebugLog(), Manager::Get(), and Manager::GetLogManager().
|
inlineprotectedvirtual |
Any descendent plugin should override this virtual method and perform any necessary initialization.
This method is called by Code::Blocks (PluginManager actually) when the plugin has been loaded and should attach in Code::Blocks. When Code::Blocks starts up, it finds and loads all plugins but does not activate (attaches) them. It then activates all plugins that the user has selected to be activated on start-up.
This means that a plugin might be loaded but not activated...
Think of this method as the actual constructor...
Reimplemented in cbSmartIndentPlugin, cbDebuggerPlugin, Wiz, CompilerGCC, and CodeCompletion.
Definition at line 210 of file cbplugin.h.
Referenced by Attach().
|
inlineprotectedvirtual |
Any descendent plugin should override this virtual method and perform any necessary de-initialization.
This method is called by Code::Blocks (PluginManager actually) when the plugin has been loaded, attached and should de-attach from Code::Blocks.
Think of this method as the actual destructor...
appShutDown | If true, the application is shutting down. In this case don't use Manager::Get()->Get...() functions or the behaviour is undefined... |
Definition at line 221 of file cbplugin.h.
Referenced by Release().
|
private |
Release is not a virtual function, so you can't override it.
The default implementation un-hooks the plugin from Code::Blocks's event handling system. Use OnRelease() for any clean-up specific tasks.
appShutDown | If true, the application is shutting down. In this case don't use Manager::Get()->Get...() functions or the behaviour is undefined... |
Definition at line 82 of file cbplugin.cpp.
References cbEVT_PLUGIN_RELEASED, Manager::Get(), Manager::GetAppWindow(), m_IsAttached, OnRelease(), and Manager::ProcessEvent().
Referenced by PluginManager::DetachPlugin().
|
friend |
Definition at line 235 of file cbplugin.h.
|
protected |
Holds the "attached" state.
Definition at line 232 of file cbplugin.h.
|
protected |
Holds the plugin's type.
Set in the default constructor.
Definition at line 229 of file cbplugin.h.
Referenced by cbCodeCompletionPlugin::cbCodeCompletionPlugin(), cbCompilerPlugin::cbCompilerPlugin(), cbDebuggerPlugin::cbDebuggerPlugin(), cbMimePlugin::cbMimePlugin(), cbSmartIndentPlugin::cbSmartIndentPlugin(), cbToolPlugin::cbToolPlugin(), and cbWizardPlugin::cbWizardPlugin().