00001 #ifndef _CYCLE_BUTTON_H_ 00002 #define _CYCLE_BUTTON_H_ 00003 00004 #include <nds.h> 00005 #include "button.h" 00006 00007 namespace WoopsiUI { 00008 00013 class CycleButton : public Button { 00014 public: 00015 00019 typedef struct { 00020 char* text; 00021 u32 value; 00022 } CycleButtonOption; 00023 00032 CycleButton(s16 x, s16 y, u16 width, u16 height, FontBase* font = NULL); 00033 00039 virtual void draw(Rect clipRect); 00040 00046 void addOption(const char* text, const u32 value); 00047 00052 inline const u32 getValue() const { return _options[_selectedIndex]->value; }; 00053 00060 virtual bool release(s16 x, s16 y); 00061 00069 virtual void getPreferredDimensions(Rect& rect) const; 00070 00071 protected: 00072 WoopsiArray<CycleButtonOption*> _options; 00073 s16 _selectedIndex; 00078 virtual inline void calculateTextPosition() { }; 00079 00083 virtual ~CycleButton(); 00084 00088 inline CycleButton(const CycleButton& cycleButton) : Button(cycleButton) { }; 00089 }; 00090 } 00091 00092 #endif