src/gui/button_group.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_GROUP_HPP
00018 #define HEADER_SUPERTUX_GUI_BUTTON_GROUP_HPP
00019 
00020 #include <SDL.h>
00021 #include <string>
00022 #include <vector>
00023 
00024 #include "math/vector.hpp"
00025 #include "gui/button.hpp"
00026 
00027 class DrawingContext;
00028 
00029 class ButtonGroup
00030 {
00031 public:
00032   ButtonGroup(Vector pos_, Vector size_, Vector button_box_);
00033   ~ButtonGroup();
00034 
00035   void draw(DrawingContext& context);
00036   bool event(SDL_Event& event);
00037 
00038   void add_button(Button button, int id, bool select = false);
00039   void add_pair_of_buttons(Button button1, int id1, Button button2, int id2);
00040 
00041   int selected_id();
00042   void set_unselected();
00043   bool is_hover();
00044 
00045 private:
00046   typedef std::vector <Button> Buttons;
00047 
00048   Vector pos;
00049   Vector buttons_size;
00050   Vector buttons_box;
00051   Buttons buttons;
00052 
00053   int button_selected;
00054   int row;
00055   bool mouse_hover;
00056   bool mouse_left_button;
00057 
00058   int buttons_pair_nb;
00059 
00060 private:
00061   ButtonGroup(const ButtonGroup&);
00062   ButtonGroup& operator=(const ButtonGroup&);
00063 };
00064 
00065 #endif
00066 
00067 /* EOF */

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