source: src/UIElements/Dialog.hpp@ 2d292d

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 2d292d 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
RevLine 
[f5a86a]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>
[104524]13#include<vector>
[f5a86a]14
[8bc733]15#include "Box.hpp"
[57f243]16#include "LinearAlgebra/Vector.hpp"
[7cd6e7]17
[97ebf8]18class atom;
[84c494]19class Box;
[97ebf8]20class element;
[7aa000]21class molecule;
[45f5d6]22
[de8e45]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 */
[f5a86a]34class Dialog
35{
36public:
37 Dialog();
38 virtual ~Dialog();
39
[86466e]40 virtual void queryEmpty(const char *, std::string = "")=0;
[75dc28]41 virtual void queryBoolean(const char *, std::string = "")=0;
42 virtual void queryInt(const char *, std::string = "")=0;
[7cd6e7]43 virtual void queryInts(const char *, std::string = "")=0;
[75dc28]44 virtual void queryDouble(const char*, std::string = "")=0;
[7cd6e7]45 virtual void queryDoubles(const char*, std::string = "")=0;
[75dc28]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;
[7cd6e7]49 virtual void queryAtoms(const char*,std::string = "")=0;
[75dc28]50 virtual void queryMolecule(const char*, std::string = "")=0;
[7cd6e7]51 virtual void queryMolecules(const char*, std::string = "")=0;
[75dc28]52 virtual void queryVector(const char*,bool, std::string = "")=0;
[7cd6e7]53 virtual void queryVectors(const char*,bool, std::string = "")=0;
[75dc28]54 virtual void queryBox(const char*, std::string = "")=0;
55 virtual void queryElement(const char*, std::string = "")=0;
[7cd6e7]56 virtual void queryElements(const char*, std::string = "")=0;
[f5a86a]57
[45f5d6]58 virtual bool display();
[f5a86a]59
[d3a5ea]60 virtual bool checkAll();
61 virtual void setAll();
62
[c508ef5]63 virtual bool hasQueries();
64
[f5a86a]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
[45f5d6]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 {
[94d131]78 friend class Dialog;
[45f5d6]79 public:
[a2ab15]80 Query(std::string _title, std::string _description = "");
[5a7243]81 virtual ~Query();
[45f5d6]82 virtual bool handle()=0;
83 virtual void setResult()=0;
84 protected:
85 const std::string getTitle() const;
[a2ab15]86 const std::string getDescription() const;
[45f5d6]87 private:
[a2ab15]88 std::string title; //!< short title of the query
89 std::string description; //!< longer description for tooltips or for help
[f5a86a]90 };
91
[86466e]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();
[f5a86a]99 };
100
[45f5d6]101 //Specialized classes for certain types. GUI-Types are not specialized at this time
[97ebf8]102 class BooleanQuery : public Query {
103 public:
[75dc28]104 BooleanQuery(std::string title, std::string _description = "");
[97ebf8]105 virtual ~BooleanQuery();
106 virtual bool handle()=0;
107 virtual void setResult();
108 protected:
109 bool tmp;
110 };
111
[45f5d6]112 class IntQuery : public Query {
113 public:
[75dc28]114 IntQuery(std::string title, std::string _description = "");
[5a7243]115 virtual ~IntQuery();
[45f5d6]116 virtual bool handle()=0;
117 virtual void setResult();
118 protected:
119 int tmp;
120 };
121
[7cd6e7]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
[2ededc2]133 class DoubleQuery : public Query {
134 public:
[75dc28]135 DoubleQuery(std::string title, std::string _description = "");
[5a7243]136 virtual ~DoubleQuery();
[2ededc2]137 virtual bool handle()=0;
138 virtual void setResult();
139 protected:
140 double tmp;
141 };
142
[7cd6e7]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
[45f5d6]154 class StringQuery : public Query {
155 public:
[75dc28]156 StringQuery(std::string title, std::string _description = "");
[5a7243]157 virtual ~StringQuery();
[45f5d6]158 virtual bool handle()=0;
159 virtual void setResult();
160 protected:
161 std::string tmp;
162 };
163
[cd8e55]164 class StringsQuery : public Query {
165 public:
[75dc28]166 StringsQuery(std::string title, std::string _description = "");
[cd8e55]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
[7aa000]175 class MoleculeQuery : public Query {
176 public:
[75dc28]177 MoleculeQuery(std::string title, std::string _description = "");
[5a7243]178 virtual ~MoleculeQuery();
[7aa000]179 virtual bool handle()=0;
180 virtual void setResult();
181 protected:
182 molecule *tmp;
183 };
184
[7cd6e7]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
[97ebf8]196 class AtomQuery : public Query {
197 public:
[75dc28]198 AtomQuery(std::string title, std::string _description = "");
[97ebf8]199 virtual ~AtomQuery();
200 virtual bool handle()=0;
201 virtual void setResult();
202 protected:
203 atom *tmp;
204 };
205
[7cd6e7]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
[2ededc2]217 class VectorQuery : public Query {
218 public:
[75dc28]219 VectorQuery(std::string title,bool _check, std::string _description = "");
[5a7243]220 virtual ~VectorQuery();
[2ededc2]221 virtual bool handle()=0;
222 virtual void setResult();
223 protected:
[7cd6e7]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;
[2ededc2]237 bool check;
238 };
239
[97ebf8]240 class BoxQuery : public Query {
241 public:
[75dc28]242 BoxQuery(std::string title, std::string _description = "");
[97ebf8]243 virtual ~BoxQuery();
244 virtual bool handle()=0;
245 virtual void setResult();
246 protected:
[8bc733]247 Box tmp;
[97ebf8]248 };
249
[5a7243]250 class ElementQuery : public Query {
251 public:
[75dc28]252 ElementQuery(std::string title, std::string _description = "");
[5a7243]253 virtual ~ElementQuery();
254 virtual bool handle()=0;
255 virtual void setResult();
256 protected:
[7cd6e7]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;
[3731b4]268 std::vector<element *> tmp;
[5a7243]269 };
270
[45f5d6]271void registerQuery(Query* query);
272
273private:
274 std::list<Query*> queries;
[f5a86a]275
276};
277
[a2ab15]278
[f5a86a]279#endif /* DIALOG_HPP_ */
Note: See TracBrowser for help on using the repository browser.