-
Notifications
You must be signed in to change notification settings - Fork 0
/
ColourInput.h
43 lines (31 loc) · 1.27 KB
/
ColourInput.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
#pragma once
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "InputGeneral.h"
#include <wx/clrpicker.h>
// Handles both a colour picker for some colour input and also a static text label that
// describes what the input is for.
class ColourInput {
public:
typedef std::function<void(wxColour)> ColourChangeFunc;
// public because the calling frame will want to know what height the control is
static constexpr int Height = InputControlHeight;
ColourInput(wxWindow* parent, wxWindowID colourCtrlId, std::string labelText, wxColour initialColour, wxPoint topLeft,
ColourChangeFunc colourChangeFunc = [](wxColour) {return; }, int labelWidth = DefaultLabelWidth, int textInputWidth = DefaultInputWidth);
private:
// Calls upon the window to update the preliminary name data based on
// the result of the GetString() method of "event".
void updateColour(wxColourPickerEvent& event);
ColourChangeFunc colourChangeFunc;
wxWindow* parent;
wxStaticText* staticText;
wxColourPickerCtrl* colourCtrl;
};