source: src/UIElements/Menu/TextMenu.hpp@ 9ee38b

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 9ee38b was 0b2ce9, checked in by Frederik Heber <heber@…>, 15 years ago

Implemented macros for automatically generating repetitive stuff around Actions.

The idea is that only the following items have to be provided for by the user

  • parameters (i.e. for each the following tupel: type, token and reference)
  • perform...(), ...Undo(), ...

Therefore, we have three new files:

  • Action_impl_header.hpp: Is for the declarations in the header
  • Action_impl_pre.hpp: Is before definition of functions
  • Action_impl_post.hpp: is after definition of functions (cleanup)

Changes:

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 * TextMenu.h
3 *
4 * Created on: Dec 10, 2009
5 * Author: crueger
6 */
7
8#ifndef TEXTMENU_H_
9#define TEXTMENU_H_
10
11#include <list>
12#include <iosfwd>
13#include <string>
14
15#include "Menu/Menu.hpp"
16#include "Actions/Action.hpp"
17#include "defs.hpp"
18
19class MenuItem;
20
21/**
22 * Used to produce any kind of text menu
23 *
24 * All Items are displayed and user is prompted for a key. The item corresponding to that key is then activated.
25 */
26class TextMenu : public Menu
27{
28public:
29 class LeaveAction : public Action {
30 public:
31 LeaveAction(TextMenu*);
32 virtual ~LeaveAction();
33
34 bool canUndo();
35 bool shouldUndo();
36
37 protected:
38 virtual Dialog* fillDialog(Dialog *dialog);
39 private:
40 virtual void getParametersfromValueStorage();
41 virtual Action::state_ptr performCall();
42 virtual Action::state_ptr performUndo(Action::state_ptr);
43 virtual Action::state_ptr performRedo(Action::state_ptr);
44
45 TextMenu* menu;
46
47 static const string nameBase;
48 };
49
50 TextMenu(ostream& _outputter, string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH);
51 virtual ~TextMenu();
52
53 virtual void addItem(MenuItem*);
54 virtual void removeItem(MenuItem*);
55 virtual void display();
56 virtual string getTitle();
57
58 /**
59 * Call doQuit if you want to return from this menu.
60 */
61 virtual void doQuit();
62 /**
63 * Check whether someone has chosen to quit
64 */
65 virtual bool hasQuit();
66
67 virtual void addDefault(MenuItem*);
68
69protected:
70 virtual void showEntry(MenuItem*);
71
72private:
73 list<MenuItem*> items;
74
75 MenuItem* defaultItem;
76
77 ostream& outputter;
78 string title;
79 char spacer;
80 int length;
81
82 bool quit;
83};
84
85#endif /* TEXTMENU_H_ */
Note: See TracBrowser for help on using the repository browser.