NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
grouppanel.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2019 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#include <wx/wx.h>
20#include <wx/spinctrl.h>
21#include <wx/listctrl.h>
22#include <wx/treelist.h>
23#include <wx/collpane.h>
24
25#ifndef GROUPPANEL_HPP
26#define GROUPPANEL_HPP
27
28#include "../controls/treelistctrl.h"
29
30
31
37class SpinBut : public wxSpinCtrl
38{
39 public:
40 wxStaticText* m_label;
41
42 SpinBut(wxWindow* parent, wxWindowID id, const wxSize& size, int nMin, int nMax, int nInitial) : wxSpinCtrl(parent, id, wxEmptyString, wxDefaultPosition, size, wxSP_ARROW_KEYS, nMin, nMax, nInitial), m_label(nullptr)
43 {}
44
52 void SetLabel(const wxString& label)
53 {
54 if (m_label)
55 m_label->SetLabel(label);
56 }
57
64 wxString GetLabel()
65 {
66 if (m_label)
67 return m_label->GetLabel();
68
69 return "";
70 }
71
80 virtual bool Show(bool show)
81 {
82 if (m_label)
83 m_label->Show(show);
84
85 return wxSpinCtrl::Show(show);
86 }
87
96 virtual bool Enable(bool enable)
97 {
98 if (m_label)
99 m_label->Enable(enable);
100
101 return wxSpinCtrl::Enable(enable);
102 }
103};
104
105
106
112class TextField : public wxTextCtrl
113{
114 public:
115 wxStaticText* m_label;
116
117 TextField(wxWindow* parent, wxWindowID id, const wxString& sDefault,const wxSize& size, int nStyle) : wxTextCtrl(parent, id, sDefault, wxDefaultPosition, size, nStyle), m_label(nullptr)
118 {}
119
127 void SetLabel(const wxString& label)
128 {
129 if (m_label)
130 m_label->SetLabel(label);
131 }
132
139 wxString GetLabel()
140 {
141 if (m_label)
142 return m_label->GetLabel();
143
144 return "";
145 }
146
155 virtual bool Show(bool show)
156 {
157 if (m_label)
158 m_label->Show(show);
159
160 return wxTextCtrl::Show(show);
161 }
162
171 virtual bool Enable(bool enable)
172 {
173 if (m_label)
174 m_label->Enable(enable);
175
176 return wxTextCtrl::Enable(enable);
177 }
178};
179
180
181
187class GroupPanel : public wxScrolledWindow
188{
189 private:
190 wxBoxSizer* verticalSizer;
191 wxBoxSizer* horizontalSizer;
192 wxBoxSizer* mainSizer;
193
194 public:
195 GroupPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, bool useVerticalSizer = true);
196
197 wxBoxSizer* getVerticalSizer();
198 wxBoxSizer* getHorizontalSizer();
199 wxBoxSizer* getMainSizer();
200 void AddSpacer(int nSize = 10, wxSizer* sizer = nullptr);
201 wxStaticText* AddStaticText(wxWindow* parent, wxSizer* sizer, const wxString& text, int id = wxID_STATIC, int alignment = wxALIGN_CENTER_VERTICAL);
202
203 wxStaticBoxSizer* createGroup(const wxString& sGroupName, int orient = wxVERTICAL, wxWindow* parent = nullptr, wxSizer* sizer = nullptr, int expand = 0);
204 wxBoxSizer* createGroup(int orient = wxVERTICAL, wxSizer* sizer = nullptr, int expand = 0);
205 wxCollapsiblePane* createCollapsibleGroup(const wxString& label, wxWindow* parent = nullptr, wxSizer* sizer = nullptr);
206
207 wxTextCtrl* CreatePathInput(wxWindow* parent, wxSizer* sizer, const wxString& description, int buttonID, int id = wxID_ANY);
208 TextField* CreateTextInput(wxWindow* parent, wxSizer* sizer, const wxString& description, const wxString& sDefault = wxEmptyString, int nStyle = 0, int id = wxID_ANY, const wxSize& size = wxSize(310,-1), int alignment = wxALIGN_CENTER_VERTICAL);
209 wxCheckBox* CreateCheckBox(wxWindow* parent, wxSizer* sizer, const wxString& description, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
210 SpinBut* CreateSpinControl(wxWindow* parent, wxSizer* sizer, const wxString& description, int nMin, int nMax, int nInitial, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
211 wxListView* CreateListView(wxWindow* parent, wxSizer* sizer, int nStyle = wxLC_REPORT, wxSize size = wxDefaultSize, int id = wxID_ANY);
212 wxTreeListCtrl* CreateTreeListCtrl(wxWindow* parent, wxSizer* sizer, int nStyle = wxTL_SINGLE, wxSize size = wxDefaultSize, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
213 wxcode::wxTreeListCtrl* CreateWxcTreeListCtrl(wxWindow* parent, wxSizer* sizer, int nStyle = wxTR_TWIST_BUTTONS | wxTR_FULL_ROW_HIGHLIGHT | wxTR_EXTENDED, wxSize size = wxDefaultSize, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
214 wxButton* CreateButton(wxWindow* parent, wxSizer* sizer, const wxString& description, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
215 wxRadioBox* CreateRadioBox(wxWindow* parent, wxSizer* sizer, const wxString& description, const wxArrayString& choices, int style = wxHORIZONTAL, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
216 wxChoice* CreateChoices(wxWindow* parent, wxSizer* sizer, const wxArrayString& choices, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
217 wxComboBox* CreateComboBox(wxWindow* parent, wxSizer* sizer, const wxArrayString& choices, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
218 wxGauge* CreateGauge(wxWindow* parent, wxSizer* sizer, int style, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
219 wxStaticBitmap* CreateBitmap(wxWindow* parent, wxSizer* sizer, const wxString& filename, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
220 wxSlider* CreateSlider(wxWindow* parent, wxSizer* sizer, int nMin, int nMax, int nInitial, int style, int id = wxID_ANY, int alignment = wxALIGN_CENTER_VERTICAL);
221};
222
223
224#endif // GROUPPANEL_HPP
225
This class simplifies the creation of simple windows and creates a common layout among all windows.
Definition: grouppanel.hpp:188
wxStaticText * AddStaticText(wxWindow *parent, wxSizer *sizer, const wxString &text, int id=wxID_STATIC, int alignment=wxALIGN_CENTER_VERTICAL)
Add some static test to the current sizer and window.
Definition: grouppanel.cpp:140
wxBoxSizer * mainSizer
Definition: grouppanel.hpp:192
wxListView * CreateListView(wxWindow *parent, wxSizer *sizer, int nStyle=wxLC_REPORT, wxSize size=wxDefaultSize, int id=wxID_ANY)
This member function creates the layout for a listview control.
Definition: grouppanel.cpp:376
wxGauge * CreateGauge(wxWindow *parent, wxSizer *sizer, int style, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a progress bar.
Definition: grouppanel.cpp:545
wxStaticBitmap * CreateBitmap(wxWindow *parent, wxSizer *sizer, const wxString &filename, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a static bitmap.
Definition: grouppanel.cpp:566
SpinBut * CreateSpinControl(wxWindow *parent, wxSizer *sizer, const wxString &description, int nMin, int nMax, int nInitial, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a spin control including the assigned text.
Definition: grouppanel.cpp:342
wxTreeListCtrl * CreateTreeListCtrl(wxWindow *parent, wxSizer *sizer, int nStyle=wxTL_SINGLE, wxSize size=wxDefaultSize, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a treelist control.
Definition: grouppanel.cpp:399
wxTextCtrl * CreatePathInput(wxWindow *parent, wxSizer *sizer, const wxString &description, int buttonID, int id=wxID_ANY)
This member function creates the layout for a path input dialog including the "choose" button.
Definition: grouppanel.cpp:245
void AddSpacer(int nSize=10, wxSizer *sizer=nullptr)
Add extra space between the last added (main) element and the next element to be added.
Definition: grouppanel.cpp:120
wxChoice * CreateChoices(wxWindow *parent, wxSizer *sizer, const wxArrayString &choices, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a dropdown list.
Definition: grouppanel.cpp:495
wxRadioBox * CreateRadioBox(wxWindow *parent, wxSizer *sizer, const wxString &description, const wxArrayString &choices, int style=wxHORIZONTAL, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a radio box.
Definition: grouppanel.cpp:474
wxBoxSizer * horizontalSizer
Definition: grouppanel.hpp:191
wxcode::wxTreeListCtrl * CreateWxcTreeListCtrl(wxWindow *parent, wxSizer *sizer, int nStyle=wxTR_TWIST_BUTTONS|wxTR_FULL_ROW_HIGHLIGHT|wxTR_EXTENDED, wxSize size=wxDefaultSize, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a treelist control in the wxCode variant.
Definition: grouppanel.cpp:424
wxSlider * CreateSlider(wxWindow *parent, wxSizer *sizer, int nMin, int nMax, int nInitial, int style, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a slider.
Definition: grouppanel.cpp:590
wxCheckBox * CreateCheckBox(wxWindow *parent, wxSizer *sizer, const wxString &description, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a usual checkbox.
Definition: grouppanel.cpp:316
wxBoxSizer * getMainSizer()
Return the pointer to the current main layout sizer.
Definition: grouppanel.cpp:104
wxStaticBoxSizer * createGroup(const wxString &sGroupName, int orient=wxVERTICAL, wxWindow *parent=nullptr, wxSizer *sizer=nullptr, int expand=0)
Member function to create a group (a static box with a label) in the panel.
Definition: grouppanel.cpp:161
wxComboBox * CreateComboBox(wxWindow *parent, wxSizer *sizer, const wxArrayString &choices, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a combobox.
Definition: grouppanel.cpp:520
wxBoxSizer * getVerticalSizer()
Return the pointer to the vertical sizer.
Definition: grouppanel.cpp:78
wxBoxSizer * getHorizontalSizer()
Return the pointer to the horizontal sizer.
Definition: grouppanel.cpp:91
wxCollapsiblePane * createCollapsibleGroup(const wxString &label, wxWindow *parent=nullptr, wxSizer *sizer=nullptr)
Member function to create a collapsible group.
Definition: grouppanel.cpp:215
wxButton * CreateButton(wxWindow *parent, wxSizer *sizer, const wxString &description, int id=wxID_ANY, int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a button.
Definition: grouppanel.cpp:447
TextField * CreateTextInput(wxWindow *parent, wxSizer *sizer, const wxString &description, const wxString &sDefault=wxEmptyString, int nStyle=0, int id=wxID_ANY, const wxSize &size=wxSize(310,-1), int alignment=wxALIGN_CENTER_VERTICAL)
This member function creates the layout for a text input.
Definition: grouppanel.cpp:285
GroupPanel(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, bool useVerticalSizer=true)
Constructor.
Definition: grouppanel.cpp:35
wxBoxSizer * verticalSizer
Definition: grouppanel.hpp:190
This class is a extension to the standard wxSpinCtrl to combine it with a read- and changeable label.
Definition: grouppanel.hpp:38
wxString GetLabel()
Get the current label.
Definition: grouppanel.hpp:64
void SetLabel(const wxString &label)
Set a new label.
Definition: grouppanel.hpp:52
SpinBut(wxWindow *parent, wxWindowID id, const wxSize &size, int nMin, int nMax, int nInitial)
Definition: grouppanel.hpp:42
wxStaticText * m_label
Definition: grouppanel.hpp:40
virtual bool Enable(bool enable)
Enable or disable the label and the control.
Definition: grouppanel.hpp:96
virtual bool Show(bool show)
Show or hide the label and the control.
Definition: grouppanel.hpp:80
This class is a extension to the standard wxTextCtrl to combine it with a read- and changeable label.
Definition: grouppanel.hpp:113
wxStaticText * m_label
Definition: grouppanel.hpp:115
wxString GetLabel()
Get the current label.
Definition: grouppanel.hpp:139
virtual bool Show(bool show)
Show or hide the label and the control.
Definition: grouppanel.hpp:155
void SetLabel(const wxString &label)
Set a new label.
Definition: grouppanel.hpp:127
virtual bool Enable(bool enable)
Enable or disable the label and the control.
Definition: grouppanel.hpp:171
TextField(wxWindow *parent, wxWindowID id, const wxString &sDefault, const wxSize &size, int nStyle)
Definition: grouppanel.hpp:117