| 1 |
/* |
| 2 |
* This file is part of wxSmithFoldbar plugin for Code::Blocks Studio |
| 3 |
* Copyright (C) 2007 Bartlomiej Swiecki |
| 4 |
* |
| 5 |
* wxSmith is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* wxSmith is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with wxSmith; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef WXSSMITHSTC_H_INCLUDED |
| 22 |
#define WXSSMITHSTC_H_INCLUDED |
| 23 |
|
| 24 |
// For compilers that support precompilation, includes <wx/wx.h> |
| 25 |
#include <wx/wxprec.h> |
| 26 |
|
| 27 |
#ifndef WX_PRECOMP |
| 28 |
#include <wx/wx.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
#include <cbplugin.h> // for "class cbPlugin" |
| 32 |
|
| 33 |
class wxsSmithSTC : public cbPlugin |
| 34 |
{ |
| 35 |
public: |
| 36 |
/** Constructor. */ |
| 37 |
wxsSmithSTC(); |
| 38 |
/** Destructor. */ |
| 39 |
virtual ~wxsSmithSTC(); |
| 40 |
|
| 41 |
|
| 42 |
/** This method is called by Code::Blocks and is used by the plugin |
| 43 |
* to add any menu items it needs on Code::Blocks's menu bar.\n |
| 44 |
* It is a pure virtual method that needs to be implemented by all |
| 45 |
* plugins. If the plugin does not need to add items on the menu, |
| 46 |
* just do nothing ;) |
| 47 |
* @param menuBar the wxMenuBar to create items in |
| 48 |
*/ |
| 49 |
virtual void BuildMenu(wxMenuBar* menuBar){} |
| 50 |
|
| 51 |
/** This method is called by Code::Blocks core modules (EditorManager, |
| 52 |
* ProjectManager etc) and is used by the plugin to add any menu |
| 53 |
* items it needs in the module's popup menu. For example, when |
| 54 |
* the user right-clicks on a project file in the project tree, |
| 55 |
* ProjectManager prepares a popup menu to display with context |
| 56 |
* sensitive options for that file. Before it displays this popup |
| 57 |
* menu, it asks all attached plugins (by asking PluginManager to call |
| 58 |
* this method), if they need to add any entries |
| 59 |
* in that menu. This method is called.\n |
| 60 |
* If the plugin does not need to add items in the menu, |
| 61 |
* just do nothing ;) |
| 62 |
* @param type the module that's preparing a popup menu |
| 63 |
* @param menu pointer to the popup menu |
| 64 |
* @param data pointer to FileTreeData object (to access/modify the file tree) |
| 65 |
*/ |
| 66 |
virtual void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = 0){} |
| 67 |
|
| 68 |
/** This method is called by Code::Blocks and is used by the plugin |
| 69 |
* to add any toolbar items it needs on Code::Blocks's toolbar.\n |
| 70 |
* It is a pure virtual method that needs to be implemented by all |
| 71 |
* plugins. If the plugin does not need to add items on the toolbar, |
| 72 |
* just do nothing ;) |
| 73 |
* @param toolBar the wxToolBar to create items on |
| 74 |
* @return The plugin should return true if it needed the toolbar, false if not |
| 75 |
*/ |
| 76 |
virtual bool BuildToolBar(wxToolBar* toolBar){ return false; } |
| 77 |
protected: |
| 78 |
/** Any descendent plugin should override this virtual method and |
| 79 |
* perform any necessary initialization. This method is called by |
| 80 |
* Code::Blocks (PluginManager actually) when the plugin has been |
| 81 |
* loaded and should attach in Code::Blocks. When Code::Blocks |
| 82 |
* starts up, it finds and <em>loads</em> all plugins but <em>does |
| 83 |
* not</em> activate (attaches) them. It then activates all plugins |
| 84 |
* that the user has selected to be activated on start-up.\n |
| 85 |
* This means that a plugin might be loaded but <b>not</b> activated...\n |
| 86 |
* Think of this method as the actual constructor... |
| 87 |
*/ |
| 88 |
virtual void OnAttach(); |
| 89 |
|
| 90 |
/** Any descendent plugin should override this virtual method and |
| 91 |
* perform any necessary de-initialization. This method is called by |
| 92 |
* Code::Blocks (PluginManager actually) when the plugin has been |
| 93 |
* loaded, attached and should de-attach from Code::Blocks.\n |
| 94 |
* Think of this method as the actual destructor... |
| 95 |
* @param appShutDown If true, the application is shutting down. In this |
| 96 |
* case *don't* use Manager::Get()->Get...() functions or the |
| 97 |
* behaviour is undefined... |
| 98 |
*/ |
| 99 |
virtual void OnRelease(bool appShutDown); |
| 100 |
}; |
| 101 |
|
| 102 |
#endif // WXSSMITHSTC_H_INCLUDED |
| 103 |
|