BT-MatML-Editor 0.1.4
Editor for the MatML 3.1 XML Schema
BT_MatML_Value_GUI.h
1
2// Name: BT_MatML_Value_GUI.h
3// Purpose: Classes of Value_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/statline.h>
24
25#include <boost/shared_ptr.hpp>
26#include <math.h>
27#include "StringStream.h"
28#include "matml31.hxx"
29
30#include "BT_MatML_Base_GUI.h"
31#include "BT_MatML_MatMLInfo_GUI.h"
32
33#include "BT_MatML_GUI.h"
34#include "BT_MatML_MatMLTreeItemData.h"
35#include "BT_MatML_TreeCtrlSorted.h"
36
37#include "BT_MatML_StringValidator.h"
38
39
40
41namespace bellshire {
42
44 {
45 public:
46 wxNotebook* m_GUI;
47 wxTextCtrl* m_TextCtrl;
48 wxChoice* m_FormatChoice;
49 wxButton* m_ValidationButton;
50 wxCheckBox* m_ValidationNewLineRemovalCheckBox;
51
52 Value_GUI_Base();//ctor
53 Value_GUI_Base(wxWindow* parent);//ctor
54
55 virtual ~Value_GUI_Base();//dtor
56
57 static wxNotebook* Create(wxWindow* parent,
58 wxTextCtrl*& TextCtrl,
59 wxChoice*& FormatChoice,
60 wxButton*& ValidationButton,
61 wxCheckBox*& ValidationNewLineRemovalCheckBox
62 );
63
64 void Show(bool show = true) { if (m_GUI != nullptr) m_GUI->Show(show); };
65 bool IsShown() { return m_GUI->IsShown(); };
66 wxNotebook* get() { return m_GUI; };
67
68 void Update( Value* element);
69 static wxTreeItemId SetupMatMLTreeCtrl(TreeCtrlSorted*& MatMLTreeCtrl,
70 const wxTreeItemId& ParentId,
71 Value& Element,
72 const wxTreeItemId& PreviousId
73 );
74
75 void SetConnect();
76 virtual void OnTextCtrlKillFocus(wxCommandEvent& event) { event.Skip(); }
77 virtual void OnFormatChoiceKillFocus(wxCommandEvent& event) { event.Skip(); }
78 virtual void OnValidationButtonButton(wxCommandEvent& event) { event.Skip(); }
79
80 private:
81 };
82
84 {
85 public:
86
87 TreeCtrlSorted* m_MatMLTreeCtrl;//Required before Event Handling.
88
89 Value_GUI();
90 Value_GUI(wxWindow* parent);
91
92 virtual ~Value_GUI();
93
94 void SetEvtHandlerVar(TreeCtrlSorted*& MatMLTreeCtrl);//Required before Event Handling.
95
96 //Overwrites the base class functions
97 void OnTextCtrlKillFocus(wxCommandEvent& event);
98 void OnFormatChoiceKillFocus(wxCommandEvent& event);
99 void OnValidationButtonButton(wxCommandEvent& event);
100
101 // validator for wxWidget Data1textCtrl
102 class TextCtrlValidator : public wxValidator, public StringValidator
103 {
104 public:
105 TreeCtrlSorted* m_MatMLTreeCtrl;
106 wxCheckBox* m_ValidationNewLineRemovalCheckBox;
107
108 TextCtrlValidator(TreeCtrlSorted* MatMLTreeCtrl,
109 wxCheckBox* ValidationNewLineRemovalCheckBox
110 ) : m_MatMLTreeCtrl(MatMLTreeCtrl),
111 m_ValidationNewLineRemovalCheckBox(ValidationNewLineRemovalCheckBox)
112 { };
113
114 virtual bool Validate(wxWindow* parent) wxOVERRIDE;
115 virtual wxObject* Clone() const wxOVERRIDE { return new TextCtrlValidator(*this); }
116
117 // Called to transfer data to the window
118 virtual bool TransferToWindow() wxOVERRIDE;
119
120 // Called to transfer data from the window
121 virtual bool TransferFromWindow() wxOVERRIDE;
122
123 private:
124
125 };
126
127 // validator for wxWidget FormatChoice
128 class FormatChoiceValidator : public wxValidator
129 {
130 public:
131 TreeCtrlSorted* m_MatMLTreeCtrl;
132
133 FormatChoiceValidator(TreeCtrlSorted* MatMLTreeCtrl) { m_MatMLTreeCtrl = MatMLTreeCtrl; }
134
135 virtual bool Validate(wxWindow* parent) wxOVERRIDE;
136 virtual wxObject* Clone() const wxOVERRIDE { return new FormatChoiceValidator(*this); }
137
138 // Called to transfer data to the window
139 virtual bool TransferToWindow() wxOVERRIDE;
140
141 // Called to transfer data from the window
142 virtual bool TransferFromWindow() wxOVERRIDE;
143
144 private:
145
146 };
147
148 private:
149 TextCtrlValidator* m_TextCtrlValidator;
150 FormatChoiceValidator* m_FormatChoiceValidator;
151 };
152
153}; //namespace bellshire end
154
Definition: matml31.hxx:1705
Definition: matml31.hxx:4140
Definition: BT_MatML_Base_GUI.h:163
Definition: BT_MatML_StringValidator.h:23
Definition: BT_MatML_TreeCtrlSorted.h:19
Definition: BT_MatML_Value_GUI.h:129
Definition: BT_MatML_Value_GUI.h:103
Definition: BT_MatML_Value_GUI.h:44
static wxNotebook * Create(wxWindow *parent, wxTextCtrl *&TextCtrl, wxChoice *&FormatChoice, wxButton *&ValidationButton, wxCheckBox *&ValidationNewLineRemovalCheckBox)
Create the GUI for the Value MatML Data and Info
Definition: BT_MatML_Value_GUI.cpp:43
static wxTreeItemId SetupMatMLTreeCtrl(TreeCtrlSorted *&MatMLTreeCtrl, const wxTreeItemId &ParentId, Value &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_Value_GUI.cpp:129
Definition: BT_MatML_Value_GUI.h:84
virtual ~Value_GUI()
Destructor for the derived class
Definition: BT_MatML_Value_GUI.cpp:188
Value_GUI()
Constructor for the derived class
Definition: BT_MatML_Value_GUI.cpp:162
void SetEvtHandlerVar(TreeCtrlSorted *&MatMLTreeCtrl)
Function used to set up this objects member variables which is used in the EventHandler's functions....
Definition: BT_MatML_Value_GUI.cpp:199
Contains the GUI and GUI associated classes. OnInit() calls the creation of the MaterialFrame GUI
Definition: BT_MatML_App.h:39