src/gui/widget_list.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  * Widget list : store all widgets displayed on one screen
00020  * It is a fake widget
00021  *****************************************************************************/
00022 #ifndef WIDGET_LIST_H
00023 #define WIDGET_LIST_H
00024 
00025 #include <list>
00026 #include <SDL_keyboard.h>
00027 #include "widget.h"
00028 #include "container.h"
00029 
00030 class WidgetList : public Widget, public Container
00031 {
00032 private:
00033   Point2i lastMousePosition;
00034   Widget* last_clicked;
00035 
00036 protected:
00037   std::list<Widget*> widget_list;
00038   virtual void DelFirstWidget(); // usefull only for message_box
00039 
00040 public:
00041   WidgetList();
00042   WidgetList(const Rectanglei &rect);
00043   virtual ~WidgetList();
00044 
00045   void Update(const Point2i &mousePosition, Surface& surf);
00046 
00047   // methods specialized from Widget to manage the list of widgets
00048   virtual void SendKey(SDL_keysym key);
00049   virtual Widget* Clic(const Point2i &mousePosition, uint button);
00050   virtual void Draw(const Point2i &mousePosition, Surface& surf) const;
00051 
00052   // needed to implements Widget
00053   virtual void SetSizePosition(const Rectanglei &rect) {};  
00054 
00055   // to add a widget
00056   virtual void AddWidget(Widget*);
00057 
00058   // redraw bottom layer container
00059   virtual void Redraw(const Rectanglei& rect, Surface& surf);
00060   
00061   // set need_redrawing to true for all sub widgets;
00062   void ForceRedraw(); 
00063 
00064   // set focus on a widget
00065   void SetFocusOn(Widget*);
00066 };
00067 
00068 #endif // WIDGET_LIST_H

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