source: src/UIElements/Dialog.hpp@ 952f38

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 952f38 was 57f243, checked in by Frederik Heber <heber@…>, 14 years ago

Created libMolecuilderLinearAlgebra.

  • is shared.
  • contains the following classes: Line, Plane, Space, Vector, Matrix, gslvector, gslmatrix, linearsystemofequations
  • had to change include path almost everywhere
  • change linkin in src/ and src/unittests/Makefile.am
  • Property mode set to 100644
File size: 7.4 KB
Line 
1/*
2 * Dialog.hpp
3 *
4 * Created on: Jan 5, 2010
5 * Author: crueger
6 */
7
8#ifndef DIALOG_HPP_
9#define DIALOG_HPP_
10
11#include<string>
12#include<list>
13#include<vector>
14
15#include "Box.hpp"
16#include "LinearAlgebra/Vector.hpp"
17
18class atom;
19class Box;
20class element;
21class molecule;
22
23
24/** Dialog is one of the two main classes of the UIFactory base class.
25 *
26 * The Dialog is meant for asking the user for information needed to perform actions he
27 * desires, such as asking for a position in space or a length.
28 *
29 * For this purpose there is the base class Query and numerous specializations for each
30 * of the types to be asked. There are primitives integer, doubles and string, but also
31 * advanced types such as element, molecule or Vector. There is also an empty query for
32 * displaying text.
33 */
34class Dialog
35{
36public:
37 Dialog();
38 virtual ~Dialog();
39
40 virtual void queryEmpty(const char *, std::string = "")=0;
41 virtual void queryBoolean(const char *, std::string = "")=0;
42 virtual void queryInt(const char *, std::string = "")=0;
43 virtual void queryInts(const char *, std::string = "")=0;
44 virtual void queryDouble(const char*, std::string = "")=0;
45 virtual void queryDoubles(const char*, std::string = "")=0;
46 virtual void queryString(const char*, std::string = "")=0;
47 virtual void queryStrings(const char*, std::string = "")=0;
48 virtual void queryAtom(const char*,std::string = "")=0;
49 virtual void queryAtoms(const char*,std::string = "")=0;
50 virtual void queryMolecule(const char*, std::string = "")=0;
51 virtual void queryMolecules(const char*, std::string = "")=0;
52 virtual void queryVector(const char*,bool, std::string = "")=0;
53 virtual void queryVectors(const char*,bool, std::string = "")=0;
54 virtual void queryBox(const char*, std::string = "")=0;
55 virtual void queryElement(const char*, std::string = "")=0;
56 virtual void queryElements(const char*, std::string = "")=0;
57
58 virtual bool display();
59
60 virtual bool checkAll();
61 virtual void setAll();
62
63 virtual bool hasQueries();
64
65protected:
66 // methodology for handling queries
67 // all queries are stored and then performed at appropriate times
68
69 //these queries can be handled by this dialog
70
71 //TODO: Find a way to reduce complexity...
72 //needs O(N*M) query classes, where N is the number of query types and M is the number of GUIs
73 //usual approach for reducing inheritance complexity (strategy pattern) does not work,
74 //due to lack of common code for query types as well as GUI-Types (all subtypes differ a lot)
75
76 //base class for all queries
77 class Query {
78 friend class Dialog;
79 public:
80 Query(std::string _title, std::string _description = "");
81 virtual ~Query();
82 virtual bool handle()=0;
83 virtual void setResult()=0;
84 protected:
85 const std::string getTitle() const;
86 const std::string getDescription() const;
87 private:
88 std::string title; //!< short title of the query
89 std::string description; //!< longer description for tooltips or for help
90 };
91
92 // Empty Query is just meant for showing text, such as version, help, initial message or alike
93 class EmptyQuery : public Query {
94 public:
95 EmptyQuery(std::string title, std::string _description = "");
96 virtual ~EmptyQuery();
97 virtual bool handle()=0;
98 virtual void setResult();
99 };
100
101 //Specialized classes for certain types. GUI-Types are not specialized at this time
102 class BooleanQuery : public Query {
103 public:
104 BooleanQuery(std::string title, std::string _description = "");
105 virtual ~BooleanQuery();
106 virtual bool handle()=0;
107 virtual void setResult();
108 protected:
109 bool tmp;
110 };
111
112 class IntQuery : public Query {
113 public:
114 IntQuery(std::string title, std::string _description = "");
115 virtual ~IntQuery();
116 virtual bool handle()=0;
117 virtual void setResult();
118 protected:
119 int tmp;
120 };
121
122 class IntsQuery : public Query {
123 public:
124 IntsQuery(std::string title, std::string _description = "");
125 virtual ~IntsQuery();
126 virtual bool handle()=0;
127 virtual void setResult();
128 protected:
129 int temp;
130 std::vector<int> tmp;
131 };
132
133 class DoubleQuery : public Query {
134 public:
135 DoubleQuery(std::string title, std::string _description = "");
136 virtual ~DoubleQuery();
137 virtual bool handle()=0;
138 virtual void setResult();
139 protected:
140 double tmp;
141 };
142
143 class DoublesQuery : public Query {
144 public:
145 DoublesQuery(std::string title, std::string _description = "");
146 virtual ~DoublesQuery();
147 virtual bool handle()=0;
148 virtual void setResult();
149 protected:
150 double temp;
151 std::vector<double> tmp;
152 };
153
154 class StringQuery : public Query {
155 public:
156 StringQuery(std::string title, std::string _description = "");
157 virtual ~StringQuery();
158 virtual bool handle()=0;
159 virtual void setResult();
160 protected:
161 std::string tmp;
162 };
163
164 class StringsQuery : public Query {
165 public:
166 StringsQuery(std::string title, std::string _description = "");
167 virtual ~StringsQuery();
168 virtual bool handle()=0;
169 virtual void setResult();
170 protected:
171 std::string temp;
172 std::vector<std::string> tmp;
173 };
174
175 class MoleculeQuery : public Query {
176 public:
177 MoleculeQuery(std::string title, std::string _description = "");
178 virtual ~MoleculeQuery();
179 virtual bool handle()=0;
180 virtual void setResult();
181 protected:
182 molecule *tmp;
183 };
184
185 class MoleculesQuery : public Query {
186 public:
187 MoleculesQuery(std::string title, std::string _description = "");
188 virtual ~MoleculesQuery();
189 virtual bool handle()=0;
190 virtual void setResult();
191 protected:
192 molecule * temp;
193 std::vector<molecule *> tmp;
194 };
195
196 class AtomQuery : public Query {
197 public:
198 AtomQuery(std::string title, std::string _description = "");
199 virtual ~AtomQuery();
200 virtual bool handle()=0;
201 virtual void setResult();
202 protected:
203 atom *tmp;
204 };
205
206 class AtomsQuery : public Query {
207 public:
208 AtomsQuery(std::string title, std::string _description = "");
209 virtual ~AtomsQuery();
210 virtual bool handle()=0;
211 virtual void setResult();
212 protected:
213 atom *temp;
214 std::vector<atom *> tmp;
215 };
216
217 class VectorQuery : public Query {
218 public:
219 VectorQuery(std::string title,bool _check, std::string _description = "");
220 virtual ~VectorQuery();
221 virtual bool handle()=0;
222 virtual void setResult();
223 protected:
224 Vector tmp;
225 bool check;
226 };
227
228 class VectorsQuery : public Query {
229 public:
230 VectorsQuery(std::string title,bool _check, std::string _description = "");
231 virtual ~VectorsQuery();
232 virtual bool handle()=0;
233 virtual void setResult();
234 protected:
235 Vector temp;
236 std::vector<Vector> tmp;
237 bool check;
238 };
239
240 class BoxQuery : public Query {
241 public:
242 BoxQuery(std::string title, std::string _description = "");
243 virtual ~BoxQuery();
244 virtual bool handle()=0;
245 virtual void setResult();
246 protected:
247 Box tmp;
248 };
249
250 class ElementQuery : public Query {
251 public:
252 ElementQuery(std::string title, std::string _description = "");
253 virtual ~ElementQuery();
254 virtual bool handle()=0;
255 virtual void setResult();
256 protected:
257 element * tmp;
258 };
259
260 class ElementsQuery : public Query {
261 public:
262 ElementsQuery(std::string title, std::string _description = "");
263 virtual ~ElementsQuery();
264 virtual bool handle()=0;
265 virtual void setResult();
266 protected:
267 element *temp;
268 std::vector<element *> tmp;
269 };
270
271void registerQuery(Query* query);
272
273private:
274 std::list<Query*> queries;
275
276};
277
278
279#endif /* DIALOG_HPP_ */
Note: See TracBrowser for help on using the repository browser.