/
PropertyNotebook.h
70 lines (48 loc) · 1.5 KB
/
PropertyNotebook.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
62
63
64
65
66
67
68
69
70
#pragma once
#include "ui/iuserinterface.h"
#include <wx/aui/auibook.h>
#include "wxutil/menu/PopupMenu.h"
namespace ui
{
class AuiLayout;
class PropertyNotebook :
public wxAuiNotebook
{
private:
AuiLayout& _layout;
struct Page
{
// The name of the control
std::string controlName;
// If present into the image list, this is the bitmap index
int tabIconIndex = -1;
// the actual widget to be added
wxWindow* page = nullptr;
};
std::list<Page> _pages;
std::unique_ptr<wxImageList> _imageList;
wxutil::PopupMenuPtr _popupMenu;
wxFrame* _dropHint;
public:
PropertyNotebook(wxWindow* parent, AuiLayout& owner);
void addControl(const std::string& controlName);
void removeControl(const std::string& name);
// Returns true if the given control is loaded in a tab
bool controlExists(const std::string& controlName);
void focusControl(const std::string& controlName);
void saveState();
void restoreState();
void showDropHint(const wxRect& size);
void hideDropHint();
private:
std::string getSelectedPageName();
int findControlIndexByName(const std::string& controlName);
std::string findControlNameByWindow(wxWindow* window);
int getImageIndexForControl(const std::string& controlName);
std::string getSelectedControlName();
void onPageSwitch(wxBookCtrlEvent& ev);
void onTabRightClick(wxAuiNotebookEvent& ev);
void undockSelectedTab();
void closeSelectedTab();
};
}