/
ColourSchemeEditor.h
82 lines (60 loc) · 1.96 KB
/
ColourSchemeEditor.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
#pragma once
#include "wxutil/dialog/DialogBase.h"
#include <string>
#include "icommandsystem.h"
#include "icolourscheme.h"
#include "wxutil/TreeModel.h"
class wxButton;
class wxPanel;
class wxDataViewEvent;
class wxColourPickerEvent;
class wxSizer;
namespace wxutil { class TreeView; }
namespace ui
{
/// Dialog for choosing and editing colour schemes
class ColourSchemeEditor :
public wxutil::DialogBase
{
// The list of available colour schemes
wxDataViewListCtrl* _schemeList = nullptr;
// The vbox containing the colour buttons and its frame
wxPanel* _colourFrame;
// The "delete scheme" button
wxButton* _deleteButton;
public:
// Constructor
ColourSchemeEditor();
// Command target
static void DisplayDialog(const cmd::ArgumentList& args);
int ShowModal();
// Signal for client code to get notified on colour changes
static sigc::signal<void>& signal_ColoursChanged();
private:
// private helper functions
void populateTree();
void constructWindow();
wxBoxSizer* constructListButtons();
wxSizer* constructColourSelector(colours::IColourItem& colour, const std::string& name);
void updateColourSelectors();
// Queries the user for a string and returns it
// Returns "" if the user aborts or nothing is entered
std::string inputDialog(const std::string& title, const std::string& label);
// Puts the cursor on the currently active scheme
void selectActiveScheme();
// Updates the colour selectors after a selection change
void selectionChanged();
// Returns the name of the currently selected scheme
std::string getSelectedScheme();
// Deletes or copies a scheme
void deleteScheme();
void copyScheme();
// Deletes a scheme from the list store (called from deleteScheme())
void deleteSchemeFromList();
// Callbacks
void callbackSelChanged(wxDataViewEvent& ev);
void callbackColorChanged(wxColourPickerEvent& ev, colours::IColourItem& item);
// Updates the windows after a colour change
static void updateWindows();
};
} // namespace ui