Yesno_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 _YESNO_GUMP_H_
00020 #define _YESNO_GUMP_H_
00021 
00022 #include <string>
00023 
00024 #include "Modal_gump.h"
00025 
00026 class Yesno_button;
00027 
00028 /*
00029  *  A yes/no box.  
00030  */
00031 class Yesno_gump : public Modal_gump
00032 {
00033   UNREPLICATABLE_CLASS_I(Yesno_gump,Modal_gump(0,0,0,0));
00034 
00035 protected:
00036   static short yesx, yesnoy, nox; // Coords. of the buttons.
00037   const std::string text;     // Text of question.  It is drawn in
00038           //   object_area.
00039   int answer;     // 1 for yes, 0 for no.
00040   Yesno_button *yes_button, *no_button;
00041   void set_answer(int y)    // Done from 'yes'/'no' button.
00042     {
00043     answer = (y != 0);
00044     done = 1;
00045     }
00046 
00047 public:
00048   friend class Yesno_button;
00049   Yesno_gump(const std::string &txt);
00050   ~Yesno_gump();
00051   int get_answer()
00052     { return answer; }
00053           // Paint it and its contents.
00054   virtual void paint();
00055           // Handle events:
00056   virtual void mouse_down(int mx, int my);
00057   virtual void mouse_up(int mx, int my);
00058   virtual void key_down(int chr); // Character typed.
00059   static int ask(const char *txt);  // Ask question, get answer.
00060 };
00061 
00062 #endif

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