Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

sdlscrollbar.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: pipelka $
00023     Update Date:      $Date: 2001/01/31 17:23:16 $
00024     Source File:      $Source: /usr/local/CVSROOT/linux/paragui/doc/html/sdlscrollbar_h-source.html,v $
00025     CVS/RCS Revision: $Revision: 1.34 $
00026     Status:           $State: Exp $
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     //int scroll_windowsize;
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