/
MapExpressionEntry.h
55 lines (43 loc) · 1.18 KB
/
MapExpressionEntry.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
#pragma once
#include <wx/panel.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include "ui/common/ImageFileSelector.h"
namespace ui
{
class MapExpressionEntry :
public wxPanel
{
private:
wxTextCtrl* _textEntry;
wxButton* _browseButton;
public:
MapExpressionEntry(wxWindow* parent = nullptr) :
wxPanel(parent, wxID_ANY)
{
SetSizer(new wxBoxSizer(wxHORIZONTAL));
_textEntry = new wxTextCtrl(this, wxID_ANY);
_browseButton = new wxButton(this, wxID_ANY, "...");
_browseButton->SetMaxSize(wxSize(40, -1));
_browseButton->Bind(wxEVT_BUTTON, &MapExpressionEntry::onBrowseButtonClick, this);
GetSizer()->Add(_textEntry, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL, 6);
GetSizer()->Add(_browseButton, 0, wxALIGN_CENTER_VERTICAL, 0);
}
wxString GetValue()
{
return _textEntry->GetValue();
}
void SetValue(const wxString& value)
{
_textEntry->SetValue(value);
}
private:
void onBrowseButtonClick(wxCommandEvent& ev)
{
auto selector = new ImageFileSelector(this, _textEntry);
selector->ShowModal();
selector->Destroy();
}
};
}