/
LayerControl.h
68 lines (54 loc) · 1.43 KB
/
LayerControl.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
#pragma once
#include <wx/event.h>
#include <memory>
#include <wx/colour.h>
class wxWindow;
class wxButton;
class wxToggleButton;
class wxSizer;
class wxPanel;
namespace ui
{
/**
* greebo: A LayerControl contains a set of widgets needed
* to control an associated layer.
*
* Multiple LayerControls can be packed as children into the
* owning LegacyLayerControlDialog.
*/
class LayerControl :
public wxEvtHandler
{
private:
// The ID of the associated layer
int _layerID;
wxToggleButton* _toggle;
wxPanel* _statusWidget;
wxButton* _labelButton;
wxButton* _deleteButton;
wxButton* _renameButton;
wxSizer* _buttonHBox;
wxColour _activeColour;
wxColour _inactiveColour;
// Locks down the callbacks during widget update
bool _updateActive;
public:
LayerControl(wxWindow* parent, int layerID);
// Returns the widgets for packing this object into a container/table
wxButton* getLabelButton();
wxWindow* getStatusWidget();
wxSizer* getButtons();
wxToggleButton* getToggle();
// Updates the state of all widgets,
// except for the usage status widget which is reset to the "inactive" default
void update();
int getLayerId() const;
void updateUsageStatusWidget(std::size_t numUsedObjectsInLayer);
private:
void onToggle(wxCommandEvent& ev);
void onDelete(wxCommandEvent& ev);
void onRename(wxCommandEvent& ev);
void onLayerSelect(wxCommandEvent& ev);
};
typedef std::shared_ptr<LayerControl> LayerControlPtr;
} // namespace ui