00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SDLSCROLLBAR_H
00030 #define SDLSCROLLBAR_H
00031
00032 #ifdef SWIG
00033 %include "swigcommon.h"
00034 %module sdlscrollbar
00035 %{
00036 #include "sdlscrollbar.h"
00037 %}
00038 #endif
00039
00040 #include "sdlwidget.h"
00041 #include "sdlbutton.h"
00042 #include "sdlgradientwidget.h"
00043
00053 class DECLSPEC SDLScrollBar : public SDLGradientWidget {
00054
00055 protected:
00056
00057 #ifndef SWIG
00058 class ScrollButton : public SDLButton {
00059 public:
00060
00061 ScrollButton(SDLScrollBar* parent, int id, SDL_Rect& r);
00062 virtual ~ScrollButton();
00063
00064 void SetTickMode(bool on);
00065
00066 protected:
00067
00069 bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00071 bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
00073 SDLScrollBar* GetParent();
00075 bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00077 int GetPosFromPoint(SDL_Point p);
00078
00079 private:
00080
00082 SDL_Point offset;
00083
00085 bool my_tickMode;
00086
00087 int my_tempPos;
00088 };
00089 #endif // SWIG
00090
00091
00092 public:
00093
00095 SDLScrollBar(SDLWidget* parent, int id, SDL_Rect& r, int direction = SDL_SB_VERTICAL);
00096
00098 virtual ~SDLScrollBar();
00099
00100 void LoadThemeStyle(const char* widgettype);
00101
00103 void SetPosition(Uint32 pos);
00104
00106 int GetPosition();
00107
00109 void SetWindowSize(Uint32 wsize);
00110
00112 void SetRange(Uint32 min, Uint32 max);
00113
00115 void SetLineSize(int ls);
00116
00117 protected:
00118
00120 void eventSizeWindow(int w, int h);
00121
00123 bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
00124
00126 bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00127
00129 bool eventButtonClick(int id, SDLWidget* widget);
00130
00132 bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00133
00134 Uint32 scroll_min;
00135 Uint32 scroll_max;
00136 Uint32 scroll_current;
00137 Uint32 my_linesize;
00138 Uint32 my_pagesize;
00139
00140
00141
00142 SDLButton* scrollbutton[2];
00143 ScrollButton* dragbutton;
00144 SDL_Rect position[4];
00145
00146 int sb_direction;
00147 int id;
00148
00149 friend class ScrollButton;
00150
00151 private:
00152
00153 SDLScrollBar(const SDLScrollBar&);
00154 SDLScrollBar& operator=(SDLScrollBar&);
00155
00156 };
00157
00158 #endif // SDLSCROLLBAR_H