ToolMap
Loading...
Searching...
No Matches
tmaattribctrls.h
1/***************************************************************************
2 tmaattribctrls.h
3 Controls for the tmAAttribTree
4 -------------------
5 copyright : (C) 2009 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17// comment doxygen
18
19#ifndef _TM_AATTRIBCTRLS_H_
20#define _TM_AATTRIBCTRLS_H_
21
22// For compilers that support precompilation, includes "wx/wx.h".
23#include <wx/wxprec.h>
24
25// Include wxWidgets' headers
26#ifndef WX_PRECOMP
27#include <wx/wx.h>
28#endif
29
30#include <wx/spinctrl.h> // for spin ctrl
31
32#include "../core/projectdefmemory.h" // for fields definitions
33// #include <wx/generic/spinctrg.h> // for float spin ctrl
34#include <wx/datectrl.h> // for date picker ctrl
35
36const wxString LABELDEFAULT = _T("MyLabel");
37
38/***************************************************************************/
50class tmAAttribCtrl : public wxPanel {
51 private:
52 protected:
53 wxStaticText* m_Label;
54
55 public:
57 m_Label = nullptr;
58 }
59
60 tmAAttribCtrl(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
61 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
62 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrl")) {
63 ;
64 }
65
66 virtual void Create(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
67 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
68 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrl")) = 0;
69
71 ;
72 }
73
74 // label operations
75 virtual void SetLabel(const wxString& labeltext);
76
77 virtual wxString GetLabel() const;
78
79 // control operations
80 virtual void SetControlValue(const wxString& value) = 0;
81
82 virtual wxString GetControlValue() = 0;
83
84 virtual void SetEmptyValue() {
85 ;
86 }
87};
88
89// Creating a list of Ctrls
90class tmAAttribCtrlStruct : public wxObject {
91 public:
93 m_Ctrl = nullptr;
94 }
95
96 tmAAttribCtrl* m_Ctrl;
97};
98
99WX_DECLARE_OBJARRAY(tmAAttribCtrlStruct, tmAAttribCtrlArray);
100
101class tmFullSelectTextCtrl : public wxTextCtrl {
102 private:
103 bool m_bDoSelectAll;
104
105 void OnFocus(wxFocusEvent& event);
106
107 void OnIdle(wxIdleEvent& event);
108
109 DECLARE_EVENT_TABLE();
110
111 protected:
112 public:
114
115 tmFullSelectTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString,
116 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
117 const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
118
119 void Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString,
120 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
121 const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr);
122
124};
125
126class tmFullSelectSpinCtrl : public wxSpinCtrl {
127 private:
128 bool m_bDoSelectAll;
129
130 void OnFocus(wxFocusEvent& event);
131
132 void OnLooseFocus(wxFocusEvent& event);
133
134 void OnIdle(wxIdleEvent& event);
135
136 DECLARE_EVENT_TABLE();
137
138 protected:
139 public:
141
142 tmFullSelectSpinCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString,
143 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
144 long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0,
145 const wxString& name = _T("tmFullSelectSpinCtrl"));
146
147 void Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString,
148 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
149 long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0,
150 const wxString& name = _T("tmFullSelectSpinCtrl"));
151
153};
154
155/***************************************************************************/
164 private:
165 tmFullSelectTextCtrl* m_Control;
166 wxStaticText* m_ControlInfo;
167
168 void SetProperties(const ProjectDefMemoryFields& fieldinfo);
169
170 protected:
171 public:
173
174 tmAAttribCtrlText(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
175 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
176 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlText"));
177
178 void Create(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
179 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
180 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlText"));
181
183
184 // control operations
185 virtual void SetControlValue(const wxString& value);
186
187 virtual wxString GetControlValue();
188};
189
191 private:
192 tmFullSelectSpinCtrl* m_Control;
193
194 void SetProperties(const ProjectDefMemoryFields& fieldinfo);
195
196 protected:
197 public:
199
200 tmAAttribCtrlInteger(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
201 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
202 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlInteger"));
203
204 void Create(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
205 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
206 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlInteger"));
207
209
210 // control operations
211 virtual void SetControlValue(const wxString& value);
212
213 virtual wxString GetControlValue();
214
215 virtual void SetEmptyValue();
216};
217
219 private:
220 tmFullSelectTextCtrl* m_Control;
221 wxStaticText* m_ControlInfo;
222
223 void SetProperties(const ProjectDefMemoryFields& fieldinfo);
224
225 protected:
226 public:
228
229 tmAAttribCtrlFloat(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
230 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
231 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlFloat"));
232
233 void Create(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
234 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
235 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlFloat"));
236
238
239 // control operations
240 virtual void SetControlValue(const wxString& value);
241
242 virtual wxString GetControlValue();
243
244 virtual void SetEmptyValue();
245};
246
247const unsigned int AATTRIB_ENUM_RADIO_NUMBER = 3;
248
250 private:
251 wxChoice* m_ControlChoice;
252 wxRadioButton* m_ControlRadios[AATTRIB_ENUM_RADIO_NUMBER];
253 int m_iNumRadios;
255
256 // private init function
257 void InitMemberValues();
258
259 bool IsChoiceList();
260
261 // control creating
262 wxSizer* CreateChoiceControl(const PrjMemFieldCodedValArray& valarray);
263
264 protected:
265 public:
267
268 tmAAttribCtrlEnum(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
269 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
270 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlEnum"));
271
272 void Create(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
273 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
274 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlEnum"));
275
277
278 // control operations
279 virtual void SetControlValue(const wxString& value);
280
281 virtual wxString GetControlValue();
282
283 virtual void SetEmptyValue();
284};
285
287 private:
288 wxDatePickerCtrl* m_Control;
289
290 protected:
291 public:
293
294 tmAAttribCtrlDate(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
295 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
296 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlDate"));
297
298 void Create(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
299 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
300 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlDate"));
301
303
304 // control operations
305 virtual void SetControlValue(const wxString& value);
306
307 virtual wxString GetControlValue();
308};
309
311 private:
312 tmFullSelectTextCtrl* m_Control;
313 wxStaticText* m_ControlInfo;
314
315 void SetProperties(const ProjectDefMemoryFields& fieldinfo);
316
317 protected:
318 public:
320
321 tmAAttribCtrlSafeDate(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
322 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
323 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlSafeDate"));
324
325 void Create(wxWindow* parent, const ProjectDefMemoryFields& fieldinfo, wxWindowID id = wxID_ANY,
326 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
327 long style = wxTAB_TRAVERSAL, const wxString& name = _T("tmAAttribCtrlSafeDate"));
328
330
331 // control operations
332 virtual void SetControlValue(const wxString& value);
333
334 virtual wxString GetControlValue();
335
336 virtual void SetEmptyValue();
337};
338
339#endif
Storing Fields property in memory.
Definition projectdefmemory.h:198
Definition tmaattribctrls.h:286
Definition tmaattribctrls.h:249
Definition tmaattribctrls.h:218
Definition tmaattribctrls.h:190
Definition tmaattribctrls.h:310
Definition tmaattribctrls.h:90
tmAAttribTree item of type TextCtrl
Definition tmaattribctrls.h:163
Abstract class for tmAAttribTree Items.
Definition tmaattribctrls.h:50
Definition tmaattribctrls.h:126
Definition tmaattribctrls.h:101