-
Notifications
You must be signed in to change notification settings - Fork 1
/
ControlView.cpp
66 lines (52 loc) · 2.74 KB
/
ControlView.cpp
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
// ControlView.cpp
#include "wx/wxprec.h"
#include "ControlView.h"
#include "ControlButton.h"
BEGIN_EVENT_TABLE(CControlView, wxWindow)
END_EVENT_TABLE()
enum{
ID_BUTTON1 = 1000,
ID_BUTTON2,
ID_BUTTON_XMINUS,
ID_BUTTON_XPLUS,
ID_BUTTON_YMINUS,
ID_BUTTON_YPLUS,
ID_BUTTON_ZMINUS,
ID_BUTTON_ZPLUS,
};
CControlView::CControlView(wxWindow *parent):
wxWindow(parent, wxID_ANY)
{
wxPanel* panel = new wxPanel(this, wxID_ANY);
// create buttons
wxButton *button1 = new wxButton(panel, ID_BUTTON1, _T("test1"));
wxButton *button2 = new wxButton(panel, ID_BUTTON2, _T("test2"));
wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer *gridsizer = new wxFlexGridSizer(3, 4, 5, 5);
gridsizer->Add(new wxStaticText(panel, wxID_ANY, _("")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new CControlButton(panel, ID_BUTTON_YPLUS, ControlButtonTypeYPlus), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(panel, wxID_ANY, _("")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new CControlButton(panel, ID_BUTTON_ZPLUS, ControlButtonTypeZPlus), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new CControlButton(panel, ID_BUTTON_XMINUS, ControlButtonTypeXMinus), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(panel, wxID_ANY, _("")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new CControlButton(panel, ID_BUTTON_XPLUS, ControlButtonTypeXPlus), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(panel, wxID_ANY, _("")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(panel, wxID_ANY, _("")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new CControlButton(panel, ID_BUTTON_YMINUS, ControlButtonTypeYMinus), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(panel, wxID_ANY, _("")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new CControlButton(panel, ID_BUTTON_ZMINUS, ControlButtonTypeZMinus), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL));
wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL );
bottomsizer->Add( button1, 0, wxALL, 10 );
bottomsizer->Add( button2, 0, wxALL, 10 );
mainsizer->Add( gridsizer, wxSizerFlags().Align(wxALIGN_CENTER).Border(wxALL, 10).Expand() );
mainsizer->Add( bottomsizer, wxSizerFlags().Align(wxALIGN_CENTER) );
// tell frame to make use of sizer (or constraints, if any)
panel->SetAutoLayout( true );
panel->SetSizer( mainsizer );
#ifndef __WXWINCE__
mainsizer->SetSizeHints( this );
#endif
mainsizer->Layout();
mainsizer->SetSizeHints( panel ); // set size hints to honour minimum size
Show(true);
}