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 * Vertical or Horizontal Box 00020 *****************************************************************************/ 00021 00022 #ifndef GUI_BOX_H 00023 #define GUI_BOX_H 00024 00025 #include "widget_list.h" 00026 #include <list> 00027 #include "../tool/point.h" 00028 00029 class Box : public WidgetList 00030 { 00031 protected: 00032 bool visible; 00033 uint margin; 00034 Point2i border; 00035 00036 public: 00037 Box(const Rectanglei &rect, bool _visible=true); 00038 virtual ~Box(); 00039 00040 void Update(const Point2i &mousePosition, 00041 const Point2i &lastMousePosition, 00042 Surface& surf); 00043 void Draw(const Point2i &mousePosition, 00044 Surface& surf) const; 00045 void Redraw(const Rectanglei& rect, 00046 Surface& surf); 00047 Widget* Clic(const Point2i &mousePosition, uint button); 00048 00049 void SetMargin(uint _margin); 00050 void SetBorder(const Point2i &newBorder); 00051 00052 virtual void AddWidget(Widget *a_widget) = 0; 00053 }; 00054 00055 class VBox : public Box 00056 { 00057 public: 00058 VBox(const Rectanglei &rect, bool _visible=true); 00059 void DelFirstWidget(); 00060 void SetSizePosition(const Rectanglei &rect); 00061 void AddWidget(Widget *a_widget); 00062 }; 00063 00064 class HBox : public Box 00065 { 00066 public: 00067 HBox(const Rectanglei &rect, bool _visible=true); 00068 void SetSizePosition(const Rectanglei &rect); 00069 void AddWidget(Widget *a_widget); 00070 }; 00071 00072 #endif 00073