X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgui%2Fbutton.hpp;h=f66d8687315f9b99a9269906e90dad2d0b73eb59;hb=91039bc631c44989f2e967cc2309d0858503385d;hp=b81f51dbf3b453c64e88fffd42e6068f096913e5;hpb=fea3446f05e1e7673607b835c269d3e8d1929ab3;p=supertux.git diff --git a/src/gui/button.hpp b/src/gui/button.hpp index b81f51dbf..f66d86873 100644 --- a/src/gui/button.hpp +++ b/src/gui/button.hpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux // Copyright (C) 2006 Matthias Braun // -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -14,20 +12,19 @@ // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// along with this program. If not, see . -#ifndef SUPERTUX_BUTTON_H -#define SUPERTUX_BUTTON_H +#ifndef HEADER_SUPERTUX_GUI_BUTTON_HPP +#define HEADER_SUPERTUX_GUI_BUTTON_HPP -#include +#include #include #include "math/vector.hpp" -#include "video/drawing_context.hpp" class Surface; - +class DrawingContext; +class Font; class ButtonGroup; enum { @@ -35,14 +32,17 @@ enum { BT_HOVER, BT_SELECTED, BT_SHOW_INFO - }; +}; class Button { public: Button(Surface* image_, std::string info_, SDLKey binding_); + Button(const Button& rhs); ~Button(); + Button& operator=(const Button& rhs); + void draw(DrawingContext& context, bool selected); int event(SDL_Event& event, int x_offset = 0, int y_offset = 0); @@ -51,7 +51,9 @@ public: private: friend class ButtonGroup; - Vector pos, size; +private: + Vector pos; + Vector size; Surface* image; SDLKey binding; @@ -61,31 +63,6 @@ private: std::string info; }; -class ButtonGroup -{ -public: - ButtonGroup(Vector pos_, Vector size_, Vector button_box_); - ~ButtonGroup(); - - void draw(DrawingContext& context); - bool event(SDL_Event& event); - - void add_button(Button button, int id, bool select = false); - void add_pair_of_buttons(Button button1, int id1, Button button2, int id2); - - int selected_id(); - void set_unselected(); - bool is_hover(); - -private: - Vector pos, buttons_size, buttons_box; - typedef std::vector