home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / gamesystem / includes / gs_menuitem.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-07-09  |  2.2 KB  |  104 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    gsCMenuItem
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    12/03/00
  8. //
  9. // Base:    gsCObject
  10. //
  11. // Derived:    gsCMenuOption
  12. //            gsCMenuSlider
  13. //            gsCMenuSeperator
  14. //
  15. //-------------------------------------------------------------
  16.  
  17. #ifndef _INCLUDE_GS_MENUITEM_H
  18. #define _INCLUDE_GS_MENUITEM_H
  19.  
  20. //-------------------------------------------------------------
  21.  
  22. typedef enum
  23. {
  24.     gsMENU_OPTION_LIST,
  25.     gsMENU_SLIDER,
  26.     gsMENU_SEPERATOR
  27. } gsMenuItemType;
  28.  
  29. //-------------------------------------------------------------
  30.  
  31. class gsCMenuItem : public gsCObject
  32. {
  33.     protected:
  34.         const char *m_name;
  35.         int m_value;
  36.         
  37.     public:
  38.         gsCMenuItem(const char *name = 0);
  39.         virtual ~gsCMenuItem();
  40.  
  41.         virtual const gsMenuItemType getType() = 0;
  42.         virtual bool setValue(int value);
  43.         virtual void draw(gsCScreen *screen,gsCFont *font,int y,bool highlight);
  44.  
  45.         int getValue();
  46.         const char *getName();
  47. };
  48.  
  49. //-------------------------------------------------------------
  50.  
  51. class gsCMenuOptionList : public gsCMenuItem
  52. {
  53.     private:
  54.         gsCList<const char *> m_options;
  55.  
  56.     public:
  57.         gsCMenuOptionList(const char *name);
  58.         ~gsCMenuOptionList();
  59.  
  60.         const gsMenuItemType getType() { return gsMENU_OPTION_LIST; };
  61.  
  62.         bool setValue(int value);
  63.         void draw(gsCScreen *screen,gsCFont *font,int y,bool highlight);
  64.  
  65.         void addOption(const char *option);
  66. };
  67.  
  68. //-------------------------------------------------------------
  69.  
  70. class gsCMenuSlider : public gsCMenuItem
  71. {
  72.     private:
  73.         int m_size;
  74.         int m_min;
  75.         int m_max;
  76.         
  77.     public:
  78.         gsCMenuSlider(const char *name,int size,int min,int max);
  79.         ~gsCMenuSlider();
  80.  
  81.         const gsMenuItemType getType() { return gsMENU_SLIDER; };
  82.         
  83.         bool setValue(int value);
  84.         void draw(gsCScreen *screen,gsCFont *font,int y,bool highlight);
  85. };
  86.  
  87. //-------------------------------------------------------------
  88.  
  89. class gsCMenuSeperator : public gsCMenuItem
  90. {
  91.     public:
  92.         gsCMenuSeperator(const char *name = 0);
  93.         ~gsCMenuSeperator();
  94.  
  95.         const gsMenuItemType getType() { return gsMENU_SEPERATOR; };
  96. };
  97.  
  98. //-------------------------------------------------------------
  99.  
  100. #endif
  101.  
  102.  
  103.  
  104.