00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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;
00045 SDL_Color bgColor;
00046 TTF_Font *font;
00047 ushort padx, pady;
00048 string title;
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
00094 ushort mousebuttondown(const uint mousex=0, const uint mousey=0);
00095
00102 void mousemotion(const uint mousex, const uint mousey);
00103
00104
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
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