| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "imodule.h" |
| 4 |
class wxToolBar; |
| 5 |
class wxWindow; |
| 6 |
|
| 7 |
namespace ui |
| 8 |
{ |
| 9 |
|
| 10 |
/** |
| 11 |
* \brief |
| 12 |
* Manager object which constructs toolbars from XML files. |
| 13 |
* |
| 14 |
* The IToolbarManager is responsible for parsing toolbar declarations from |
| 15 |
* user.xml and constructing wxToolBar objects containing the specified tool |
| 16 |
* buttons. |
| 17 |
* |
| 18 |
* Note however that the IToolbarManager does not own or keep track of the |
| 19 |
* constructed wxToolBars; these are packed into and owned by the IMainFrame |
| 20 |
* and made available with IMainFrame::getToolbar(). |
| 21 |
*/ |
| 22 |
class IToolbarManager : |
| 23 |
public RegisterableModule |
| 24 |
{ |
| 25 |
public: |
| 26 |
virtual ~IToolbarManager() {} |
| 27 |
|
| 28 |
/** |
| 29 |
* \brief |
| 30 |
* Create a wxToolBar corresponding to the given named toolbar declaration |
| 31 |
* in the user.xml file. |
| 32 |
* |
| 33 |
* The toolbar's tool buttons will be registered with the event manager on |
| 34 |
* construction, and deregistered when the wxToolbar widget is destroyed. |
| 35 |
* |
| 36 |
* Calling this method more than once with the same toolbarName will create |
| 37 |
* a new wxToolBar each time, which will possibly result in duplicate event |
| 38 |
* manager registrations unless the first toolbar widget has already been |
| 39 |
* destroyed. |
| 40 |
* |
| 41 |
* \param name |
| 42 |
* Name of the toolbar to create. This must correspond to a <toolbar> |
| 43 |
* section in the user.xml file. |
| 44 |
* |
| 45 |
* \param parent |
| 46 |
* Parent window for the constructed wxToolBar widget. |
| 47 |
*/ |
| 48 |
virtual wxToolBar* createToolbar(const std::string& name, wxWindow* parent) = 0; |
| 49 |
}; |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
constexpr const char* const MODULE_TOOLBARMANAGER = "ToolBarManager"; |
| 54 |
|
| 55 |
inline ui::IToolbarManager& GlobalToolBarManager() |
| 56 |
{ |
| 57 |
static module::InstanceReference<ui::IToolbarManager> _reference(MODULE_TOOLBARMANAGER); |
| 58 |
return _reference; |
| 59 |
} |