source: src/UIElements/Dialog.hpp@ 11428f

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 Candidate_v1.7.0 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 11428f was 13892b, checked in by Frederik Heber <heber@…>, 15 years ago

Merge branch 'UIElementsExplained' into stable

  • Property mode set to 100644
File size: 5.7 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
[97ebf8]15class atom;
16class element;
[7aa000]17class molecule;
[2ededc2]18class Vector;
[45f5d6]19
[de8e45]20
21/** Dialog is one of the two main classes of the UIFactory base class.
22 *
23 * The Dialog is meant for asking the user for information needed to perform actions he
24 * desires, such as asking for a position in space or a length.
25 *
26 * For this purpose there is the base class Query and numerous specializations for each
27 * of the types to be asked. There are primitives integer, doubles and string, but also
28 * advanced types such as element, molecule or Vector. There is also an empty query for
29 * displaying text.
30 */
[f5a86a]31class Dialog
32{
33public:
34 Dialog();
35 virtual ~Dialog();
36
[86466e]37 virtual void queryEmpty(const char *, std::string = "")=0;
[97ebf8]38 virtual void queryBoolean(const char *, bool *, std::string = "")=0;
[a2ab15]39 virtual void queryInt(const char *, int *, std::string = "")=0;
40 virtual void queryDouble(const char*,double *, std::string = "")=0;
41 virtual void queryString(const char*, std::string *, std::string = "")=0;
[97ebf8]42 virtual void queryAtom(const char*,atom**,std::string = "")=0;
43 virtual void queryMolecule(const char*,molecule**, std::string = "")=0;
[a2ab15]44 virtual void queryVector(const char*,Vector *,const double *const,bool, std::string = "")=0;
[97ebf8]45 virtual void queryBox(const char*,double ** const, std::string = "")=0;
[104524]46 virtual void queryElement(const char*, std::vector<element *> *, std::string = "")=0;
[f5a86a]47
[45f5d6]48 virtual bool display();
[f5a86a]49
[d3a5ea]50 virtual bool checkAll();
51 virtual void setAll();
52
[f5a86a]53protected:
54 // methodology for handling queries
55 // all queries are stored and then performed at appropriate times
56
57 //these queries can be handled by this dialog
[45f5d6]58
59 //TODO: Find a way to reduce complexity...
60 //needs O(N*M) query classes, where N is the number of query types and M is the number of GUIs
61 //usual approach for reducing inheritance complexity (strategy pattern) does not work,
62 //due to lack of common code for query types as well as GUI-Types (all subtypes differ a lot)
63
64 //base class for all queries
65 class Query {
[94d131]66 friend class Dialog;
[45f5d6]67 public:
[a2ab15]68 Query(std::string _title, std::string _description = "");
[5a7243]69 virtual ~Query();
[45f5d6]70 virtual bool handle()=0;
71 virtual void setResult()=0;
72 protected:
73 const std::string getTitle() const;
[a2ab15]74 const std::string getDescription() const;
[45f5d6]75 private:
[a2ab15]76 std::string title; //!< short title of the query
77 std::string description; //!< longer description for tooltips or for help
[f5a86a]78 };
79
[86466e]80 // Empty Query is just meant for showing text, such as version, help, initial message or alike
81 class EmptyQuery : public Query {
82 public:
83 EmptyQuery(std::string title, std::string _description = "");
84 virtual ~EmptyQuery();
85 virtual bool handle()=0;
86 virtual void setResult();
[f5a86a]87 };
88
[45f5d6]89 //Specialized classes for certain types. GUI-Types are not specialized at this time
[97ebf8]90 class BooleanQuery : public Query {
91 public:
92 BooleanQuery(std::string title,bool *_target, std::string _description = "");
93 virtual ~BooleanQuery();
94 virtual bool handle()=0;
95 virtual void setResult();
96 protected:
97 bool tmp;
98 private:
99 bool *target;
100 };
101
[45f5d6]102 class IntQuery : public Query {
103 public:
[a2ab15]104 IntQuery(std::string title,int *_target, std::string _description = "");
[5a7243]105 virtual ~IntQuery();
[45f5d6]106 virtual bool handle()=0;
107 virtual void setResult();
108 protected:
109 int tmp;
110 private:
111 int *target;
112 };
113
[2ededc2]114 class DoubleQuery : public Query {
115 public:
[a2ab15]116 DoubleQuery(std::string title,double *_target, std::string _description = "");
[5a7243]117 virtual ~DoubleQuery();
[2ededc2]118 virtual bool handle()=0;
119 virtual void setResult();
120 protected:
121 double tmp;
122 private:
123 double *target;
124 };
125
[45f5d6]126 class StringQuery : public Query {
127 public:
[a2ab15]128 StringQuery(std::string title,std::string *_target, std::string _description = "");
[5a7243]129 virtual ~StringQuery();
[45f5d6]130 virtual bool handle()=0;
131 virtual void setResult();
132 protected:
133 std::string tmp;
134 private:
135 std::string *target;
136 };
137
[7aa000]138 class MoleculeQuery : public Query {
139 public:
[97ebf8]140 MoleculeQuery(std::string title, molecule **_target, std::string _description = "");
[5a7243]141 virtual ~MoleculeQuery();
[7aa000]142 virtual bool handle()=0;
143 virtual void setResult();
144 protected:
145 molecule *tmp;
146 private:
147 molecule **target;
148 };
149
[97ebf8]150 class AtomQuery : public Query {
151 public:
152 AtomQuery(std::string title, atom **_target, std::string _description = "");
153 virtual ~AtomQuery();
154 virtual bool handle()=0;
155 virtual void setResult();
156 protected:
157 atom *tmp;
158 private:
159 atom **target;
160 };
161
[2ededc2]162 class VectorQuery : public Query {
163 public:
[a2ab15]164 VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = "");
[5a7243]165 virtual ~VectorQuery();
[2ededc2]166 virtual bool handle()=0;
167 virtual void setResult();
168 protected:
169 Vector *tmp;
170 const double *const cellSize;
171 bool check;
172 private:
173 Vector *target;
174 };
175
[97ebf8]176 class BoxQuery : public Query {
177 public:
178 BoxQuery(std::string title,double ** const _cellSize, std::string _description = "");
179 virtual ~BoxQuery();
180 virtual bool handle()=0;
181 virtual void setResult();
182 protected:
183 double *tmp;
184 private:
185 double **target;
186 };
187
[5a7243]188 class ElementQuery : public Query {
189 public:
[104524]190 ElementQuery(std::string title, std::vector<element *> *_target, std::string _description = "");
[5a7243]191 virtual ~ElementQuery();
192 virtual bool handle()=0;
193 virtual void setResult();
194 protected:
[104524]195 std::vector<element *> elements;
[5a7243]196 private:
[104524]197 std::vector<element *> * const target;
[5a7243]198 };
199
[45f5d6]200void registerQuery(Query* query);
201
202private:
203 std::list<Query*> queries;
[f5a86a]204
205};
206
[a2ab15]207
[f5a86a]208#endif /* DIALOG_HPP_ */
Note: See TracBrowser for help on using the repository browser.