BT-MatML-Editor 0.1.4
Editor for the MatML 3.1 XML Schema
BT_MatML_Data1_GUI.h
1
2// Name: BT_MatML_Data1_GUI.h
3// Purpose: Classes of Data1_GUI Base and Derived.
4// Author: Paul McGrath
5// Modified by:
6// Created:
7// Copyright: (c) Paul McGrath
8// Licence: CC licence
10#pragma once
11
12// For compilers that support precompilation, includes "wx/wx.h".
13#include "wx/wxprec.h"
14
15
16#ifndef WX_PRECOMP
17#include "wx/wx.h"
18#endif
19
20#include "wx/dcsvg.h"
21#include "wx/notebook.h"
22#include <wx/statline.h>
23#include <wx/checkbox.h>
24
25#include <boost/shared_ptr.hpp>
26#include <boost/lexical_cast.hpp>
27#include <boost/algorithm/string.hpp>
28#include <boost/algorithm/string/classification.hpp>
29
30#include <math.h>
31#include "StringStream.h"
32#include "matml31.hxx"
33
34#include "BT_MatML_Base_GUI.h"
35#include "BT_MatML_MatMLInfo_GUI.h"
36
37#include "BT_MatML_GUI.h"
38#include "BT_MatML_MatMLTreeItemData.h"
39#include "BT_MatML_TreeCtrlSorted.h"
40
41#include "BT_MatML_StringValidator.h"
42
43namespace bellshire {
44
46 {
47 public:
48 wxNotebook* m_GUI;
49 wxTextCtrl* m_Data1TextCtrl;
50 wxChoice* m_FormatChoice;
51 wxButton* m_ValidationButton;
52 wxCheckBox* m_ValidationNewLineRemovalCheckBox;
53
54 Data1_GUI_Base();//ctor
55 Data1_GUI_Base(wxWindow* parent);//ctor
56 virtual ~Data1_GUI_Base();//dtor
57
58 static wxNotebook* Create(wxWindow* parent,
59 wxTextCtrl*& DataTextCtrl,
60 wxChoice*& FormatChoice,
61 wxButton*& ValidationButton,
62 wxCheckBox*& ValidationNewLineRemovalCheckBox
63 );
64
65 void Show(bool show = true) { if (m_GUI != nullptr) m_GUI->Show(show); };
66 bool IsShown() { return m_GUI->IsShown(); };
67 wxNotebook* get() { return m_GUI; };
68
69 void Update( Data1* element);
70 static wxTreeItemId SetupMatMLTreeCtrl(TreeCtrlSorted*& MatMLTreeCtrl,
71 const wxTreeItemId& ParentId,
72 Data1& Element,
73 const wxTreeItemId& PreviousId
74 );
75
76 void SetConnect();
77 virtual void OnData1TextCtrlKillFocus(wxCommandEvent& event) { event.Skip(); }
78 virtual void OnFormatChoiceKillFocus(wxCommandEvent& event) { event.Skip(); }
79 virtual void OnValidationButtonButton(wxCommandEvent& event) { event.Skip(); }
80
81 private:
82 };
83
85 {
86 public:
87
88 Data1_GUI();//ctor
89 Data1_GUI(wxWindow* parent);//ctor
90
91 virtual ~Data1_GUI();//dtor
92
93 void SetEvtHandlerVar(TreeCtrlSorted*& MatMLTreeCtrl);//Required before Event Handling.
94
95 // Overwrites the base class functions
96 void OnData1TextCtrlKillFocus(wxCommandEvent& event);
97 void OnFormatChoiceKillFocus(wxCommandEvent& event);
98 void OnValidationButtonButton(wxCommandEvent& event);
99
100 // validator for wxWidget Data1textCtrl
101 class Data1TextCtrlValidator : public wxValidator, public StringValidator
102 {
103 public:
104 TreeCtrlSorted* m_MatMLTreeCtrl;
105 wxCheckBox* m_ValidationNewLineRemovalCheckBox;
106
108 wxCheckBox* ValidationNewLineRemovalCheckBox
109 ) : m_MatMLTreeCtrl(MatMLTreeCtrl),
110 m_ValidationNewLineRemovalCheckBox(ValidationNewLineRemovalCheckBox)
111 { };
112
113 virtual bool Validate(wxWindow* parent) wxOVERRIDE;
114 virtual wxObject* Clone() const wxOVERRIDE { return new Data1TextCtrlValidator(*this); }
115
116 // Called to transfer data to the window
117 virtual bool TransferToWindow() wxOVERRIDE;
118
119 // Called to transfer data from the window
120 virtual bool TransferFromWindow() wxOVERRIDE;
121
122 private:
123
124 };
125
126 // validator for wxWidget FormatChoice
127 class FormatChoiceValidator : public wxValidator
128 {
129 public:
130 TreeCtrlSorted* m_MatMLTreeCtrl;
131
132 FormatChoiceValidator(TreeCtrlSorted* MatMLTreeCtrl) { m_MatMLTreeCtrl = MatMLTreeCtrl; }
133
134 virtual bool Validate(wxWindow* parent) wxOVERRIDE;
135 virtual wxObject* Clone() const wxOVERRIDE { return new FormatChoiceValidator(*this); }
136
137 // Called to transfer data to the window
138 virtual bool TransferToWindow() wxOVERRIDE;
139
140 // Called to transfer data from the window
141 virtual bool TransferFromWindow() wxOVERRIDE;
142
143 private:
144
145 };
146
147 private:
148 Data1TextCtrlValidator* m_Data1TextCtrlValidator;
149 FormatChoiceValidator* m_FormatChoiceValidator;
150
151 };
152
153}; //namespace bellshire end
154
Definition: matml31.hxx:5863
Definition: matml31.hxx:1705
Definition: BT_MatML_Data1_GUI.h:102
Definition: BT_MatML_Data1_GUI.h:128
Definition: BT_MatML_Data1_GUI.h:46
static wxTreeItemId SetupMatMLTreeCtrl(TreeCtrlSorted *&MatMLTreeCtrl, const wxTreeItemId &ParentId, Data1 &Element, const wxTreeItemId &PreviousId)
This set-up the Parent MatML Data into a wxTreeCtrl element and then call on the Children to do the s...
Definition: BT_MatML_Data1_GUI.cpp:144
static wxNotebook * Create(wxWindow *parent, wxTextCtrl *&DataTextCtrl, wxChoice *&FormatChoice, wxButton *&ValidationButton, wxCheckBox *&ValidationNewLineRemovalCheckBox)
Create the GUI for the Data MatML Data and Info
Definition: BT_MatML_Data1_GUI.cpp:56
Definition: BT_MatML_Data1_GUI.h:85
Data1_GUI()
Constructor for the derived class
Definition: BT_MatML_Data1_GUI.cpp:182
void SetEvtHandlerVar(TreeCtrlSorted *&MatMLTreeCtrl)
Function used to set up this objects member variables which is used in the EventHandler's functions....
Definition: BT_MatML_Data1_GUI.cpp:219
virtual ~Data1_GUI()
Destructor for the derived class
Definition: BT_MatML_Data1_GUI.cpp:207
Definition: BT_MatML_Base_GUI.h:163
Definition: BT_MatML_StringValidator.h:23
Definition: BT_MatML_TreeCtrlSorted.h:19
Contains the GUI and GUI associated classes. OnInit() calls the creation of the MaterialFrame GUI
Definition: BT_MatML_App.h:39