Menu.hh

00001 /*
00002 ** TowBowlTactics, an adaptation of the tabletop game Blood Bowl.
00003 ** 
00004 ** Copyright (C) 2006 The TBT Team.
00005 ** 
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 ** 
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 ** 
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
00015 */
00016 
00017 #ifndef MENU_H
00018 # define MENU_H
00019 
00020 # include <vector>
00021 # include <SDL_gfxPrimitives.h>
00022 
00023 # include "Colors.hh"
00024 # include "Global.hh"
00025 # include "Widget.hh"
00026 
00027 # define MENU_WIDTH 200
00028 # define MENU_ALPHA 170
00029 # define MENU_WIDGET_HEIGHT 30
00030 # define MENU_WIDGET_WIDTH 150
00031 
00042 class Menu: public Widget
00043 {
00044   SDL_Color fgColor;            // foreground color
00045   SDL_Color bgColor;            // background color
00046   TTF_Font *font;
00047   ushort padx, pady;
00048   string title;         // title of the menu
00049   vector <Widget*> list_widget;
00050 
00051     public:
00052 
00060   Menu(const uint x, const uint y, SDL_Surface * screen,
00061    const ushort width = MENU_WIDTH, const string title = "");
00062 
00071   Menu(const uint x, const uint y, SDL_Surface * screen,
00072    const ushort width, const ushort height, const string title = "");
00073 
00075   ~Menu();
00076 
00079   void draw();
00080 
00083   void refresh();
00084 
00086   void erase();
00087 
00088   // events
00094   ushort mousebuttondown(const uint mousex=0, const uint mousey=0);
00095 
00102   void mousemotion(const uint mousex, const uint mousey);
00103 
00104   // Widgets list
00105 
00110   void addWidget(Widget* widget);
00111 
00118   void addWidget(Widget* widget, const uint x, const uint y);
00119 
00123   void deleteWidget(const ushort indice);
00124 
00125   // graphic
00130   void setbgColor(SDL_Color bgColor);
00131 
00135   SDL_Color getbgColor()
00136   {
00137     return(bgColor);
00138   }
00139 
00143   void setfgColor(SDL_Color fgColor);
00144 
00148   SDL_Color getfgColor()
00149   {
00150     return(fgColor);
00151   }
00152 
00153   ushort getwidth()
00154   {
00155     return(w);
00156   }
00157 
00158   ushort getheight()
00159   {
00160     return(h);
00161   }
00162 
00163   ushort getnbwidget()
00164   {
00165     return(list_widget.size ());
00166   }
00167 
00168   ushort getpadx()
00169   {
00170     return(padx);
00171   }
00172 
00173   ushort getpady()
00174   {
00175     return(pady);
00176   }
00177 };
00178 
00179 #endif

Generated on Sat Jun 23 16:07:23 2007 for Stechec/TBT by  doxygen 1.4.7