00001 #ifndef _SLIDER_VERTICAL_H_ 00002 #define _SLIDER_VERTICAL_H_ 00003 00004 #include <nds.h> 00005 #include "gadget.h" 00006 #include "gadgeteventhandler.h" 00007 #include "sliderbase.h" 00008 00009 namespace WoopsiUI { 00010 00011 class SliderVerticalGrip; 00012 00018 class SliderVertical : public SliderBase, public Gadget, public GadgetEventHandler { 00019 00020 public: 00021 00029 SliderVertical(s16 x, s16 y, u16 width, u16 height); 00030 00035 inline const s16 getMinimumValue() const { return _minimumValue; }; 00036 00041 inline const s16 getMaximumValue() const { return _maximumValue; }; 00042 00047 inline const s16 getValue() const { return _value >> 16; }; 00048 00056 inline const s16 getPageSize() const { return _pageSize; }; 00057 00062 inline void setMinimumValue(const s16 value) { 00063 _minimumValue = value; 00064 _contentSize = _maximumValue - _minimumValue + 1; 00065 resizeGrip(); 00066 }; 00067 00072 inline void setMaximumValue(const s16 value) { 00073 _maximumValue = value; 00074 _contentSize = _maximumValue - _minimumValue + 1; 00075 resizeGrip(); 00076 }; 00077 00083 void setValue(const s16 value); 00084 00092 void setValueWithBitshift(const s32 value); 00093 00099 inline void setPageSize(const s16 pageSize) { 00100 _pageSize = pageSize; 00101 resizeGrip(); 00102 }; 00103 00108 virtual void handleDragEvent(const GadgetEventArgs& e); 00109 00116 s16 getMinimumStep() const; 00117 00118 protected: 00119 SliderVerticalGrip* _grip; 00120 s16 _minimumValue; 00121 s16 _maximumValue; 00122 s32 _value; 00123 s16 _minimumGripHeight; 00124 s16 _pageSize; 00125 s32 _gutterHeight; 00127 u32 _contentSize; 00137 s32 getPhysicalMaximumValueWithBitshift() const; 00138 00144 const s32 getGripValue() const; 00145 00152 virtual void drawContents(GraphicsPort* port); 00153 00160 virtual void drawBorder(GraphicsPort* port); 00161 00167 virtual void onResize(u16 width, u16 height); 00168 00174 virtual void onClick(s16 x, s16 y); 00175 00179 virtual inline ~SliderVertical() { }; 00180 00184 inline SliderVertical(const SliderVertical& sliderVertical) : Gadget(sliderVertical) { }; 00185 00189 void resizeGrip(); 00190 }; 00191 } 00192 00193 #endif