1 #ifndef BTANKS_MENU_Button_H__ 2 #define BTANKS_MENU_Button_H__ 3 4 5 /* Battle Tanks Game 6 * Copyright (C) 2006-2009 Battle Tanks team 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 */ 22 23 /* 24 * Additional rights can be granted beyond the GNU General Public License 25 * on the terms provided in the Exception. If you modify this file, 26 * you may extend this exception to your version of the file, 27 * but you are not obligated to do so. If you do not wish to provide this 28 * exception without modification, you must delete this exception statement 29 * from your version and license this file solely under the GPL without exception. 30 */ 31 32 namespace sdlx { 33 class Surface; 34 class Font; 35 } 36 37 #include <string> 38 #include "control.h" 39 #include "box.h" 40 #include "export_btanks.h" 41 42 class BTANKSAPI Button : public Control { 43 public: 44 Button(const std::string &font, const std::string &label); 45 void get_size(int &w, int &h) const; 46 virtual void render(sdlx::Surface& surface, const int x, const int y) const; 47 virtual bool onMouse(const int button, const bool pressed, const int x, const int y); 48 virtual void on_mouse_enter(bool enter); 49 50 private: 51 int _w; 52 Box _background; 53 const sdlx::Font * _font; 54 const std::string _label; 55 }; 56 57 #endif 58 59