1 ///////////////////////////////////////// 2 // 3 // OpenLieroX 4 // 5 // code under LGPL, based on JasonBs work, 6 // enhanced by Dark Charlie and Albert Zeyer 7 // 8 // 9 ///////////////////////////////////////// 10 11 12 // gui scrollbar class 13 // Created 30/6/02 14 // Jason Boettcher 15 16 17 #ifndef __CSCROLLBAR_H__DEPRECATED_GUI__ 18 #define __CSCROLLBAR_H__DEPRECATED_GUI__ 19 20 21 #include "InputEvents.h" 22 #include "DeprecatedGUI/CWidget.h" 23 #include "DeprecatedGUI/CGuiLayout.h" 24 25 namespace DeprecatedGUI { 26 27 // Scrollbar events 28 enum { 29 SCR_NONE=-1, 30 SCR_CHANGE=0 31 }; 32 33 // Scrollbar messages 34 enum { 35 SCM_GETVALUE, 36 SCM_SETVALUE, 37 SCM_SETITEMSPERBOX, 38 SCM_SETMAX, 39 SCM_SETMIN 40 }; 41 42 43 class CScrollbar : public CWidget { 44 public: 45 // Constructor CScrollbar()46 CScrollbar() { 47 iType = wid_Scrollbar; 48 iMin = 0; 49 iMax = 1; 50 iValue = 0; 51 iItemsperbox = 1; 52 iVar = NULL; 53 iWidth = 16; 54 } 55 56 57 private: 58 // Attributes 59 int iMin; 60 int iMax; 61 int iValue; 62 63 int iScrollPos; 64 int iItemsperbox; 65 bool bSliderGrabbed; 66 int iSliderGrabPos; 67 68 bool bTopButton; 69 bool bBotButton; 70 71 int nButtonsDown; 72 AbsTime fMouseNext[3]; 73 74 int *iVar; 75 76 public: 77 // Methods 78 79 void Create(); Destroy()80 void Destroy() { } 81 82 //These events return an event id, otherwise they return -1 83 int MouseOver(mouse_t *tMouse); 84 int MouseUp(mouse_t *tMouse, int nDown); 85 int MouseDown(mouse_t *tMouse, int nDown); 86 int MouseWheelDown(mouse_t *tMouse); 87 int MouseWheelUp(mouse_t *tMouse); KeyDown(UnicodeChar c,int keysym,const ModifiersState & modstate)88 int KeyDown(UnicodeChar c, int keysym, const ModifiersState& modstate) { return SCR_NONE; } KeyUp(UnicodeChar c,int keysym,const ModifiersState & modstate)89 int KeyUp(UnicodeChar c, int keysym, const ModifiersState& modstate) { return SCR_NONE; } 90 91 void Draw(SDL_Surface * bmpDest); 92 93 void UpdatePos(); 94 95 setMin(int _min)96 void setMin(int _min) { iMin = _min; UpdatePos(); } setMax(int _max)97 void setMax(int _max) { iMax = _max; UpdatePos(); } // TODO: that should the max possible value! setValue(int _value)98 void setValue(int _value) { iValue = _value; UpdatePos(); } 99 setItemsperbox(int _i)100 void setItemsperbox(int _i) { iItemsperbox = _i; } getItemsperbox()101 int getItemsperbox() { return iItemsperbox; } 102 getValue()103 int getValue() { return iValue; } getMax()104 int getMax() { return iMax; } // TODO: that should return the max possible value!! getGrabbed()105 bool getGrabbed() { return bSliderGrabbed; } 106 107 DWORD SendMessage(int iMsg, DWORD Param1, DWORD Param2); SendMessage(int iMsg,const std::string & sStr,DWORD Param)108 DWORD SendMessage(int iMsg, const std::string& sStr, DWORD Param) { return 0; } SendMessage(int iMsg,std::string * sStr,DWORD Param)109 DWORD SendMessage(int iMsg, std::string *sStr, DWORD Param) { return 0; } 110 }; 111 112 } // namespace DeprecatedGUI 113 114 #endif // __CSCROLLBAR_H__DEPRECATED_GUI__ 115