Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

HelpControl.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_HelpControl_h_
00003 #define INCLUDED_HelpControl_h_
00004 
00005 #include "NullControl.h"
00006 
00007 //! Recurses through the menu system and outputs the name and description of each item
00008 class HelpControl : public NullControl{
00009 public:
00010   //!< constructor
00011   HelpControl(ControlBase* r, unsigned int depth=-1U)
00012     : NullControl("Help","Recurses through the menu system and outputs the name and description of each item"),
00013       maxDepth(depth), root(r)
00014   {}
00015 
00016   //! displays global Controller commands (hardcoded as strings, will need updates) as well as recursing the menu system (dynamic)
00017   virtual ControlBase * activate(MC_ID disp_id, Socket * gui);
00018 
00019   //! displays the menu items of @a r and their descriptions, recursing on submenus
00020   /*! @a prefix is what should be displayed before each menu item (like a bullet point)
00021    *  this is itself prefixed by 2 spaces for each level of recursion.  Word wrapping
00022    *  is performed to maintain the clean indenting */
00023   void report(ControlBase* r, const std::string& prefix, unsigned int max_depth);
00024 
00025   //! sets #maxDepth
00026   void setReportDepth(unsigned int depth) { maxDepth=depth; }
00027 
00028   //! gets #maxDepth
00029   unsigned int getReportDepth() const { return maxDepth; }
00030 
00031 protected:
00032   static const unsigned int term_width=80; //!< number of character to word wrap the display
00033   
00034   unsigned int maxDepth; //!< default maximum recursion depth for reporting from activation
00035 
00036   ControlBase * root; //!< stores root node to begin recursion (this item is not displayed)
00037   
00038 private:
00039   HelpControl(const HelpControl&); //!< don't call
00040   HelpControl operator=(const HelpControl&); //!< don't call
00041 };
00042 
00043 /*! @file
00044  * @brief Describes HelpControl, which recurses through the menu system and outputs the name and description of each item
00045  * @author ejt (Creator)
00046  */
00047 
00048 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:41 2016 by Doxygen 1.6.3