option.hh
Go to the documentation of this file.
00001 #ifndef _OPTION_H_
00002 #define _OPTION_H_
00003 
00004 #include <string>
00005 #include "worldfile.hh"
00006 
00007 #include <FL/Fl_Menu_Bar.H>
00008 #include <FL/Fl_Menu_Item.H>
00009 
00010 namespace Stg {
00011         class World;
00019         class Option {
00020         private:
00021                 friend bool compare( const Option* lhs, const Option* rhs );
00022 
00023                 std::string optName;
00024                 bool value;
00026                 std::string wf_token; 
00027                 std::string shortcut;
00028                 Fl_Menu_* menu;
00029                 int menuIndex;
00030                 Fl_Callback* menuCb;
00031                 Fl_Widget* menuCbWidget;
00032                 World* _world;
00033           
00034         public:
00035                 Option( const std::string& n, 
00036                                                 const std::string& tok,
00037                                                 const std::string& key, 
00038                                                 bool v, 
00039                                                 World *world );   
00040 
00041                 const std::string name() const { return optName; }
00042                 inline bool isEnabled() const { return value; }
00043                 inline bool val() const { return value; }
00044                 inline operator bool() { return val(); }
00045                 inline bool operator<( const Option& rhs ) const
00046                         {
00047                           puts( "comparing" );
00048                           return optName<rhs.optName; 
00049                         } 
00050                 void set( bool val );
00051                 void invert() { set( !value ); }
00052 
00053 //              // Comparator to dereference Option pointers and compare their strings
00054 //              struct optComp {
00055 //                      inline bool operator()( const Option* a, const Option* b ) const
00056 //                      //{ return lhs->operator<(*rhs); } 
00057 //                              { return a->optName < b->optName; } 
00058 //              };
00059 
00060 
00061                 void createMenuItem( Fl_Menu_Bar* menu, std::string path );
00062                 void menuCallback( Fl_Callback* cb, Fl_Widget* w );
00063                 static void toggleCb( Fl_Widget* w, void* p );
00064                 void Load( Worldfile* wf, int section );
00065                 void Save( Worldfile* wf, int section );          
00066 
00067                 std::string htname;
00068         };
00069 }
00070         
00071 #endif


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Thu Aug 27 2015 15:20:57