Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields

slider.h

00001 /***************************************************************************
00002                           slider.h  -  description
00003                              -------------------
00004     begin                : Thu Aug 28 2003
00005     copyright            : (C) 2003 by Gabor Torok
00006     email                : cctorok@yahoo.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef SLIDER_H
00019 #define SLIDER_H
00020 
00021 #include "../constants.h"
00022 #include "widget.h"
00023 #include "label.h"
00024 
00029 class Slider : public Widget {
00030  private:
00031   int x2;
00032   int minValue, maxValue;
00033   Label *label;
00034   bool inside; // was the last event inside the button?
00035   bool dragging;
00036   int pos;
00037   float alpha, alphaInc;
00038   GLint lastTick;
00039   GLuint highlight;
00040 
00041  public: 
00042 
00043   Slider(int x1, int y1, int x2, GLuint highlight, int minValue=0, int maxValue=100, char *label=NULL);
00044   ~Slider();
00045   bool handleEvent(Widget *parent, SDL_Event *event, int x, int y);
00046   void removeEffects(Widget *parent);
00047   void drawWidget(Widget *parent);
00048 
00049   inline int getValue() {
00050     return (int)((float)(pos * (maxValue - minValue)) / (float)getWidth());
00051   }
00052 
00053   void setValue(int n);
00054 
00055   inline int getStep() {
00056     return (int)((float)getWidth() / (float)(maxValue - minValue));
00057   }
00058 
00059   // don't play sound when the value changes
00060   virtual inline bool hasSound() { return false; }
00061 
00062 };
00063 
00064 #endif
00065 

Generated on Thu Jun 16 21:50:43 2005 for scourge by  doxygen 1.4.0