Changeset ef81b0 for src/Menu


Ignore:
Timestamp:
Dec 16, 2009, 2:40:09 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
Branches:
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
Children:
68c50b
Parents:
f82ac4e
Message:

Improved documentation for menu framework.

Location:
src/Menu
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/Menu/ActionMenuItem.hpp

    rf82ac4e ref81b0  
    1515class Action;
    1616
     17/**
     18 * Produce MenuItems that take an appropriate action when called.
     19 */
    1720class ActionMenuItem : public MenuItem
    1821{
     
    2427
    2528private:
    26   Action* action;
     29  Action* action; //!< this action will be called when the trigger matches
    2730};
    2831
  • src/Menu/DisplayMenuItem.hpp

    rf82ac4e ref81b0  
    1414class StringView;
    1515
     16/**
     17 * Display any kind of StringView within a Menu
     18 *
     19 * Any trigger are ignored for this type of Item
     20 */
    1621class DisplayMenuItem : public MenuItem
    1722{
  • src/Menu/Menu.hpp

    rf82ac4e ref81b0  
    1313class MenuItem;
    1414
     15/**
     16 * Base class for all Types of menus
     17 * contains basic abstract functionality to add Items, remove Items and display the menu
     18 *
     19 * TODO: Make sure all items are only added once.
     20 */
    1521class Menu
    1622{
     
    1925  virtual ~Menu();
    2026
     27
     28  /**
     29   * Adding and removing should be handled by the items.
     30   */
    2131  virtual void addItem(MenuItem*)=0;
     32  /**
     33   * Adding and removing should be handled by the items.
     34   */
    2235  virtual void removeItem(MenuItem*)=0;
    2336  virtual void display()=0;
  • src/Menu/MenuItem.cpp

    rf82ac4e ref81b0  
    1313#include <iostream>
    1414
     15/**
     16 * produce a new MenuItem using with a description and a trigger.
     17 * The MenuItem is then added to the menu passed to it.
     18 */
    1519MenuItem::MenuItem(char _trigger, const char* _description,Menu* menu) :
    1620trigger(_trigger),
     
    2630}
    2731
     32/**
     33 * check if the trigger matches and call doTrigger if it does.
     34 */
    2835void MenuItem::checkTrigger(char key) {
    2936  if(key == trigger)
     
    3946}
    4047
     48/**
     49 * Produce a formated output of this item containing trigger and description
     50 * Normal format is: "<trigger> - <description>"
     51 */
    4152const string MenuItem::formatEntry(){
    4253  stringstream s;
     
    4657}
    4758
     59
     60/**
     61 * check if this item is within a menu and add to menu if it is not yet contained anywhere
     62 *
     63 * TODO: include funtionality to move Items from one menu to another
     64 */
    4865void MenuItem::add_to_menu(Menu* menu) {
    4966  if(!wasAdded()) {
  • src/Menu/MenuItem.hpp

    rf82ac4e ref81b0  
    1515class Menu;
    1616
     17/**
     18 * Base class for all kinds of MenuItems
     19 *
     20 * This class takes care of checking the triggers and performing appropriate actions.
     21 */
    1722class MenuItem {
    1823private:
  • src/Menu/SeperatorItem.hpp

    rf82ac4e ref81b0  
    1111#include "Menu/MenuItem.hpp"
    1212
     13/**
     14 * Produce a Seperator within a Menu.
     15 *
     16 * All triggers are ignored for this Item.
     17 */
    1318class SeperatorItem : public MenuItem
    1419{
  • src/Menu/TextMenu.cpp

    rf82ac4e ref81b0  
    99#include <iostream>
    1010#include <cmath>
    11 #include "defs.hpp"
    1211#include "Menu/TextMenu.hpp"
    1312#include "Menu/MenuItem.hpp"
    1413
     14
     15/**
     16 * produce a text menu with a given title.
     17 * The text will later be displayed using the stream passed to the constructor.
     18 */
    1519TextMenu::TextMenu(ostream& _outputter, string _title, char _spacer,int _length) :
    1620outputter(_outputter),
     
    1822spacer(_spacer),
    1923length(_length),
    20 quit(false)
    21 {
    22 }
    23 
    24 TextMenu::TextMenu(ostream& _outputter, string _title) :
    25 outputter(_outputter),
    26 title(_title),
    27 spacer(STD_MENU_TITLE_SPACER),
    28 length(STD_MENU_LENGTH),
    2924quit(false)
    3025{
  • src/Menu/TextMenu.hpp

    rf82ac4e ref81b0  
    1414
    1515#include "Menu/Menu.hpp"
     16#include "defs.hpp"
    1617
    1718class MenuItem;
    1819
     20/**
     21 * Used to produce any kind of text menu
     22 *
     23 * All Items are displayed and user is prompted for a key. The item corresponding to that key is then activated.
     24 */
    1925class TextMenu : public Menu
    2026{
    2127public:
    22   TextMenu(ostream&,string,char,int);
    23   TextMenu(ostream&,string);
     28  TextMenu(ostream& _outputter, string _title, char _spacer=STD_MENU_TITLE_SPACER,int _length=STD_MENU_LENGTH);
    2429  virtual ~TextMenu();
    2530
     
    2833  virtual void display();
    2934
     35  /**
     36   * Call doQuit if you want to return from this menu.
     37   */
    3038  virtual void doQuit();
     39  /**
     40   * Check wether someone has chosen to quit
     41   */
    3142  virtual bool hasQuit();
    3243
Note: See TracChangeset for help on using the changeset viewer.