/
FavouritesBrowser.h
91 lines (73 loc) · 2.08 KB
/
FavouritesBrowser.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once
#include "imodule.h"
#include "icommandsystem.h"
#include "idecltypes.h"
#include <wx/panel.h>
#include <wx/listctrl.h>
#include <wx/imaglist.h>
#include <wx/toolbar.h>
#include <wx/checkbox.h>
#include <sigc++/connection.h>
#include "wxutil/menu/PopupMenu.h"
namespace ui
{
class FavouritesBrowser :
public wxPanel
{
private:
// Holds the data used to construct the wxListItem
struct FavouriteItem
{
std::string typeName;
std::string fullPath;
std::string leafName;
};
wxListView* _listView;
std::unique_ptr<wxImageList> _iconList;
struct FavouriteCategory
{
std::string typeName;
std::string displayName;
std::string iconName;
int iconIndex;
wxToolBarToolBase* checkButton;
};
// Maps decl type to icon index
std::list<FavouriteCategory> _categories;
std::list<sigc::connection> changedConnections;
std::list<FavouriteItem> _listItems;
wxCheckBox* _showFullPath;
bool _updateNeeded;
wxutil::PopupMenuPtr _popupMenu;
public:
FavouritesBrowser(wxWindow* parent);
~FavouritesBrowser();
private:
wxToolBar* createLeftToolBar();
wxToolBar* createRightToolBar();
void onMainFrameConstructed();
void onFavouritesChanged();
void reloadFavourites();
void setupCategories();
void constructPopupMenu();
void clearItems();
void onRemoveFromFavourite();
void onCategoryToggled(wxCommandEvent& ev);
void onShowFullPathToggled(wxCommandEvent& ev);
void onListCtrlPaint(wxPaintEvent& ev);
void onContextMenu(wxContextMenuEvent& ev);
void onItemActivated(wxListEvent& ev);
// Returns the list of all selected item indices
std::vector<long> getSelectedItems();
std::string getSelectedTypeName();
void onApplyTextureToSelection();
bool testSingleTextureSelected();
void onApplySoundToSelection();
bool testApplySoundToSelection();
void onCreateEntity();
bool testCreateEntity();
void onCreateSpeaker();
bool testCreateSpeaker();
bool selectionAllowsEntityCreation();
};
}