src/menu/menu.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Wormux is a convivial mass murder game.
00003  *  Copyright (C) 2001-2004 Lawrence Azzoug.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program 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
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00018  ******************************************************************************
00019  * Generic menu
00020  *****************************************************************************/
00021 
00022 #ifndef MENU_H
00023 #define MENU_H
00024 
00025 #include "../graphic/sprite.h"
00026 #include "../gui/button.h"
00027 #include "../gui/list_box.h"
00028 #include "../gui/list_box_w_label.h"
00029 #include "../gui/check_box.h"
00030 #include "../gui/spin_button.h"
00031 #include "../gui/spin_button_big.h"
00032 #include "../gui/spin_button_picture.h"
00033 #include "../gui/box.h"
00034 #include "../gui/question.h"
00035 #include "../gui/label.h"
00036 #include "../gui/null_widget.h"
00037 #include "../gui/picture_widget.h"
00038 #include "../gui/picture_text_cbox.h"
00039 #include "../gui/container.h"
00040 #include "../gui/text_box.h"
00041 
00042 typedef enum {
00043   vOkCancel,
00044   vOk,
00045   vCancel,
00046   vNo
00047 } t_action;
00048 
00049 class Menu : public Container
00050 {
00051 public:
00052    WidgetList widgets;
00053    const t_action actions;
00054 
00055    Menu(char* bg, t_action actions = vOkCancel); 
00056    virtual ~Menu();
00057 
00058    void Run ();
00059    virtual void Redraw(const Rectanglei& rect, Surface& surf);
00060 
00061 private:
00062    Sprite *background;
00063 
00064    /* Actions buttons  */
00065    HBox *actions_buttons;
00066 
00067    bool BasicOnClic(const Point2i &mousePosition);
00068 
00069 protected:
00070    Button *b_cancel;
00071    Button *b_ok;
00072    bool close_menu;
00073 
00074    virtual void sig_ok();
00075    virtual void sig_cancel();
00076    virtual void DrawBackground(const Point2i &mousePosition);
00077 
00078    virtual void key_ok() {};
00079    virtual void key_cancel() {};
00080    virtual void __sig_ok() = 0;
00081    virtual void __sig_cancel() = 0;
00082    virtual void Draw(const Point2i &mousePosition) = 0;   
00083    virtual void OnClic(const Point2i &mousePosition, int button) = 0;
00084    void SetActionButtonsXY(int x, int y);
00085    void Display(const Point2i& mousePosition);
00086 };
00087 
00088 #endif

Generated on Mon Jan 1 13:10:58 2007 for Wormux by  doxygen 1.4.7