src/gui/button.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_GUI_BUTTON_HPP
00018 #define HEADER_SUPERTUX_GUI_BUTTON_HPP
00019 
00020 #include <SDL.h>
00021 #include <string>
00022 
00023 #include "math/vector.hpp"
00024 #include "video/font_ptr.hpp"
00025 #include "video/surface_ptr.hpp"
00026 
00027 class DrawingContext;
00028 class Font;
00029 class ButtonGroup;
00030 
00031 enum {
00032   BT_NONE,
00033   BT_HOVER,
00034   BT_SELECTED,
00035   BT_SHOW_INFO
00036 };
00037 
00038 class Button
00039 {
00040 public:
00041   Button(SurfacePtr image_, std::string info_, SDLKey binding_);
00042   Button(const Button& rhs);
00043   ~Button();
00044 
00045   Button& operator=(const Button& rhs);
00046 
00047   void draw(DrawingContext& context, bool selected);
00048   int event(SDL_Event& event, int x_offset = 0, int y_offset = 0);
00049 
00050   static FontPtr info_font;
00051 
00052 private:
00053   friend class ButtonGroup;
00054 
00055 private:
00056   Vector pos;
00057   Vector size;
00058 
00059   SurfacePtr image;
00060   SDLKey binding;
00061 
00062   int id;
00063   int state;
00064   std::string info;
00065 };
00066 
00067 #endif
00068 
00069 /* EOF */

Generated on Mon Jun 9 03:38:18 2014 for SuperTux by  doxygen 1.5.1