1 /* 2 * client/GraphicMenuItem.hpp 3 * 4 * This file is part of Leges Motus, a networked, 2D shooter set in zero gravity. 5 * 6 * Copyright 2009-2010 Andrew Ayer, Nathan Partlan, Jeffrey Pfau 7 * 8 * Leges Motus is free and open source software. You may redistribute it and/or 9 * modify it under the terms of version 2, or (at your option) version 3, of the 10 * GNU General Public License (GPL), as published by the Free Software Foundation. 11 * 12 * Leges Motus is distributed in the hope that it will be useful, but WITHOUT ANY 13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 * PARTICULAR PURPOSE. See the full text of the GNU General Public License for 15 * further detail. 16 * 17 * For a full copy of the GNU General Public License, please see the COPYING file 18 * in the root of the source code tree. You may also retrieve a copy from 19 * <http://www.gnu.org/licenses/gpl-2.0.txt>, or request a copy by writing to the 20 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 21 * 02111-1307 USA 22 * 23 */ 24 25 #ifndef LM_CLIENT_GRAPHICMENUITEM_HPP 26 #define LM_CLIENT_GRAPHICMENUITEM_HPP 27 28 #include "Graphic.hpp" 29 #include "MenuItem.hpp" 30 31 namespace LM { 32 class GraphicMenuItem : public MenuItem { 33 public: 34 static const Color PLAIN_COLOR; 35 static const Color HOVER_COLOR; 36 static const Color DISABLED_COLOR; 37 private: 38 Graphic* m_graphic; 39 Color m_plain; 40 Color m_hover; 41 Color m_disabled; 42 double m_hover_scale; 43 double m_normal_scale; 44 45 protected: 46 virtual void state_changed(State old_state, State new_state); 47 48 public: 49 GraphicMenuItem(Graphic* graphic, std::string value, State state = NORMAL); 50 51 void set_plain_color(const Color& color); 52 void set_hover_color(const Color& color); 53 void set_disabled_color(const Color& color); 54 55 void set_scale(double factor); 56 void set_hover_scale(double factor); 57 58 void set_graphic(Graphic* graphic); 59 virtual const Graphic* get_graphic() const; 60 virtual Graphic* get_graphic(); 61 }; 62 } 63 64 #endif 65