Small OpenGL based c++ rendering library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

menuitems.h 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef __MENUITEMS_H
  2. #define __MENUITEMS_H
  3. #include <string>
  4. #include <vector>
  5. #include <SDL.h>
  6. #include "menuitem.h"
  7. namespace segl {
  8. class MISendSDLEvent : public MenuItem {
  9. private:
  10. SDL_Event sendevent;
  11. public:
  12. MISendSDLEvent(std::string str, SDL_Event event);
  13. void select();
  14. void resetEvent(SDL_Event event);
  15. };
  16. class MITextLabel : public MenuItem {
  17. private:
  18. public:
  19. MITextLabel(std::string str);
  20. };
  21. class MIValueLabel : public MenuItem {
  22. private:
  23. public:
  24. MIValueLabel(std::string str);
  25. void setValue(std::string);
  26. };
  27. class MIToggle : public MenuItem {
  28. private:
  29. std::vector<std::string> toggles;
  30. int togglepos;
  31. public:
  32. MIToggle(std::string);
  33. void left();
  34. void right();
  35. void select();
  36. void addToggle(std::string);
  37. int getMaxValueLen();
  38. int getValueInt();
  39. void setValueInt(int val);
  40. std::string getValueString();
  41. void setValueString(std::string str);
  42. };
  43. class MIStringInput : public MenuItem {
  44. private:
  45. int maxlen;
  46. public:
  47. MIStringInput(std::string str, int _maxlen=0);
  48. void charInput(char c);
  49. void setValue(std::string str);
  50. int getMaxValueLen();
  51. std::string getValue();
  52. void setMaxLen(int _maxlen);
  53. };
  54. class MICheckBox : public MenuItem {
  55. private:
  56. bool state;
  57. void updateValue();
  58. public:
  59. MICheckBox(std::string str);
  60. bool isChecked();
  61. int getMaxValueLen();
  62. void setState(bool _state);
  63. void select();
  64. void right();
  65. void left();
  66. };
  67. class MIEventOnToggle : public MIToggle {
  68. private:
  69. SDL_Event sendevent;
  70. void sendEvent();
  71. public:
  72. MIEventOnToggle(std::string str, SDL_Event event);
  73. void select();
  74. void left();
  75. void right();
  76. void resetEvent(SDL_Event event);
  77. };
  78. } // namespace segl
  79. #endif