Slider_gump.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2000 The Exult Team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef _SLIDER_GUMP_H_
00020 #define _SLIDER_GUMP_H_
00021 
00022 #include "Modal_gump.h"
00023 
00024 class Slider_button;
00025 
00026 /*
00027  *  A slider for choosing a number.
00028  */
00029 class Slider_gump : public Modal_gump
00030 {
00031   UNREPLICATABLE_CLASS_I(Slider_gump,Modal_gump(0,0,0,0));
00032 
00033 protected:
00034           // The arrows at each end:
00035   Slider_button *left_arrow, *right_arrow;
00036   int diamondx;     // Rel. pos. where diamond is shown.
00037   static short diamondy;
00038   int min_val, max_val;   // Max., min. values to choose from.
00039   int step_val;     // Amount to step by.
00040   int val;      // Current value.
00041   unsigned char dragging;   // 1 if dragging the diamond.
00042   int prev_dragx;     // Prev. x-coord. of mouse.
00043   void set_val(int newval); // Set to new value.
00044           // Coords:
00045   static short leftbtnx, rightbtnx, btny;
00046   static short xmin, xmax;
00047 
00048   ShapeID diamond;    // Diamond
00049 
00050 public:
00051   Slider_gump(int mival, int mxval, int step, int defval);
00052   ~Slider_gump();
00053   int get_val()     // Get last value set.
00054     { return val; }
00055           // An arrow was clicked on.
00056   void clicked_arrow(Slider_button *arrow);
00057 
00058   void move_diamond(int dir);
00059 
00060           // Paint it and its contents.
00061   virtual void paint();
00062   virtual void close()
00063     { done = 1; }
00064           // Handle events:
00065   virtual void mouse_down(int mx, int my);
00066   virtual void mouse_up(int mx, int my);
00067   virtual void mouse_drag(int mx, int my);
00068   virtual void key_down(int chr); // Character typed.
00069 
00070   virtual void mousewheel_up();
00071   virtual void mousewheel_down();
00072 };
00073 
00074 #endif

Generated on Mon Jul 9 14:42:47 2007 for ExultEngine by  doxygen 1.5.1