Modal_gump.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2000-2002 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 _MODAL_GUMP_H_
00020 #define _MODAL_GUMP_H_
00021 
00022 #include "Gump.h"
00023 #include "SDL_events.h"
00024 
00025 /*
00026  *  A modal gump object represents a 'dialog' that grabs the mouse until
00027  *  the user clicks okay.
00028  */
00029 class Modal_gump : public Gump
00030 {
00031   UNREPLICATABLE_CLASS(Modal_gump);
00032 
00033 protected:
00034   bool done;      // true when user clicks checkmark.
00035   Gump_button *pushed;    // Button currently being pushed.
00036 
00037 public:
00038   Modal_gump(Container_game_object *cont, int initx, int inity, 
00039          int shnum, ShapeFile shfile = SF_GUMPS_VGA)
00040     : Gump(cont, initx, inity, shnum, shfile), done(false),
00041       pushed(0)
00042     {  }
00043           // Create centered.
00044   Modal_gump(Container_game_object *cont, int shnum, 
00045          ShapeFile shfile = SF_GUMPS_VGA)
00046     : Gump(cont, shnum, shfile), done(false), pushed(0)
00047     {  }
00048   bool is_done()
00049     { return done; }
00050           // Handle events:
00051   virtual void mouse_down(int mx, int my) = 0;
00052   virtual void mouse_up(int mx, int my) = 0;
00053   virtual void mousewheel_down() { }
00054   virtual void mousewheel_up() { }
00055   virtual void mouse_drag(int mx, int my)
00056     {  }
00057   virtual void key_down(int chr) // Key pressed
00058     {  }
00059   virtual void text_input(int chr, int unicode) // Character typed (unicode)
00060     { }
00061   virtual bool is_modal() const { return true; }
00062 };
00063 
00064 #endif

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