/
ToolbarManager.h
61 lines (48 loc) · 1.54 KB
/
ToolbarManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <set>
#include <string>
#include "iuimanager.h"
#include "xmlutil/Node.h"
#include <memory>
/* The Toolbarmanager parses the specified XML file on construction of the class
* and creates the according toolbars.
*
* All existing events are automatically connected to the widgets.
*
* Obtain a loaded toolbar by calling getToolbar(<toolbarName>);
*/
class wxToolBarToolBase;
class wxWindowDestroyEvent;
namespace ui {
class ToolbarManager :
public IToolbarManager
{
// This is where the available Toolbar names are stored after parsing the XML file
typedef std::set<std::string> ToolbarList;
ToolbarList _toolbars;
static int _nextToolItemId;
public:
// Returns the toolbar that is named toolbarName
wxToolBar* getToolbar(const std::string& toolbarName, wxWindow* parent);
// Load toolbars from registry
void initialise();
private:
/**
* Parses the XML Document for toolbars and instantiates them
* Returns nothing, toolbars can be obtained via GetToolbar()
*/
void loadToolbars();
/**
* Creates a toolbar based on the data found in the passed xmlNode
* Returns the fully populated wxToolBar.
*/
wxToolBar* createToolbar(xml::Node& node, wxWindow* parent);
/**
* Checks the passed xmlNode for a recognized item (ToolButton, ToggleToolButton, Separator)
* Returns the widget or NULL if nothing useful is found.
*/
wxToolBarToolBase* createToolItem(wxToolBar* toolbar, xml::Node& node);
bool toolbarExists(const std::string& toolbarName);
void onToolbarDestroy(wxWindowDestroyEvent& ev);
};
} // namespace ui