BT-MatML-Editor 0.1.4
Editor for the MatML 3.1 XML Schema
BT_MatML_Data_GUI.h
1
2// Name: BT_MatML_Data_GUI.h
3// Purpose: Classes of Data_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
13// For compilers that support precompilation, includes "wx/wx.h".
14#include "wx/wxprec.h"
15
16
17#ifndef WX_PRECOMP
18#include "wx/wx.h"
19#endif
20
21#include "wx/dcsvg.h"
22#include "wx/notebook.h"
23#include <wx/checkbox.h>
24
25#include <boost/lexical_cast.hpp>
26#include <boost/algorithm/string.hpp>
27#include <boost/algorithm/string/classification.hpp>
28
29#include <math.h>
30#include "StringStream.h"
31#include "matml31.hxx"
32
33#include "BT_MatML_Base_GUI.h"
34#include "BT_MatML_MatMLInfo_GUI.h"
35#include "BT_MatML_ID_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 {
48 public:
49 wxNotebook* m_GUI;
50 wxTextCtrl* m_DataTextCtrl;
51 wxButton* m_ValidationButton;
52 wxCheckBox* m_ValidationNewLineRemovalCheckBox;
53
55 Data_GUI_Base(wxWindow* parent);
56
57 virtual ~Data_GUI_Base();
58
59 static wxNotebook* Create(wxWindow* parent,
60 wxTextCtrl*& DataTextCtrl,
61 wxButton*& ValidationButton,
62 wxCheckBox*& ValidationNewLineRemovalCheckBox
63 );
64
65 void Show(bool show = true) { if (m_GUI != nullptr) m_GUI->Show(show); };
66 wxNotebook* get() { return m_GUI; };
67
68 void Update( Data* element);
69 static wxTreeItemId SetupMatMLTreeCtrl(TreeCtrlSorted*& MatMLTreeCtrl,
70 const wxTreeItemId& ParentId,
72 const wxTreeItemId& PreviousId
73 );
74
75 void SetConnect();
76 virtual void OnDataTextCtrlKillFocus(wxCommandEvent& event) { event.Skip(); }
77 virtual void OnValidationButtonButton(wxCommandEvent& event) { event.Skip(); }
78
79 private:
80 };
81
82 class Data_GUI : public Data_GUI_Base
83 {
84 public:
85
86 //TreeCtrlSorted* m_MatMLTreeCtrl;//Required before Event Handling.
87
88 Data_GUI();
89 Data_GUI(wxWindow* parent);
90
91 virtual ~Data_GUI();
92
93 void SetEvtHandlerVar(TreeCtrlSorted*& MatMLTreeCtrl);//Required before Event Handling.
94
95 //Overwrites the base class functions
96 void OnDataTextCtrlKillFocus(wxCommandEvent& event);
97 void OnValidationButtonButton(wxCommandEvent& event);
98
99 // validator for wxWidget Data1textCtrl
100 class DataTextCtrlValidator : public wxValidator, public StringValidator
101 {
102 public:
103 TreeCtrlSorted* m_MatMLTreeCtrl;
104 wxCheckBox* m_ValidationNewLineRemovalCheckBox;
105
107 wxCheckBox* ValidationNewLineRemovalCheckBox
108 ) : m_MatMLTreeCtrl(MatMLTreeCtrl),
109 m_ValidationNewLineRemovalCheckBox(ValidationNewLineRemovalCheckBox)
110 { };
111
112 virtual bool Validate(wxWindow* parent) wxOVERRIDE;
113
114 //bool ValidateString(
115 // ::std::string input,
116 // ::std::string Format="float",
117 // ::std::string Delimiter=",",
118 // bool NewLineRemoval=false,
119 // ::std::string* msg=nullptr
120 //);
121
122 virtual wxObject* Clone() const wxOVERRIDE { return new DataTextCtrlValidator(*this); }
123
124 // Called to transfer data to the window
125 virtual bool TransferToWindow() wxOVERRIDE;
126
127 // Called to transfer data from the window
128 virtual bool TransferFromWindow() wxOVERRIDE;
129
130 //template<typename T>
131 //bool isValid(const string& num);
132
133 private:
134
135 };
136
137
138 private:
139 DataTextCtrlValidator* m_DataTextCtrlValidator;
140 };
141
142}; //namespace bellshire end
Definition: matml31.hxx:5800
Definition: matml31.hxx:1705
Definition: BT_MatML_Data_GUI.h:101
Definition: BT_MatML_Data_GUI.h:47
static wxTreeItemId SetupMatMLTreeCtrl(TreeCtrlSorted *&MatMLTreeCtrl, const wxTreeItemId &ParentId, Data &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_Data_GUI.cpp:116
static wxNotebook * Create(wxWindow *parent, wxTextCtrl *&DataTextCtrl, wxButton *&ValidationButton, wxCheckBox *&ValidationNewLineRemovalCheckBox)
Create the GUI for the Data MatML Data and Info
Definition: BT_MatML_Data_GUI.cpp:39
Definition: BT_MatML_Data_GUI.h:83
virtual ~Data_GUI()
Destructor for the derived class
Definition: BT_MatML_Data_GUI.cpp:174
Data_GUI()
Constructor for the derived class
Definition: BT_MatML_Data_GUI.cpp:151
void SetEvtHandlerVar(TreeCtrlSorted *&MatMLTreeCtrl)
Function used to set up this objects member variables which is used in the EventHandler's functions....
Definition: BT_MatML_Data_GUI.cpp:184
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