00001 /* $Id: image.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2008 - 2012 by Mark de Wever <koraq@xs4all.nl> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 00016 #ifndef GUI_WIDGETS_IMAGE_HPP_INCLUDED 00017 #define GUI_WIDGETS_IMAGE_HPP_INCLUDED 00018 00019 #include "gui/widgets/control.hpp" 00020 00021 namespace gui2 { 00022 00023 /** An image. */ 00024 class timage : public tcontrol 00025 { 00026 public: 00027 00028 timage() 00029 : tcontrol(COUNT) 00030 { 00031 } 00032 00033 /** 00034 * Wrapper for set_label. 00035 * 00036 * Some people considered this function missing and confusing so added 00037 * this forward version. 00038 * 00039 * @param label The filename image to show. 00040 */ 00041 void set_image(const t_string& label) 00042 { 00043 set_label(label); 00044 } 00045 00046 /** 00047 * Wrapper for label. 00048 * 00049 * Some people considered this function missing and confusing so added 00050 * this forward version. 00051 * 00052 * @returns The filename of the image shown. 00053 */ 00054 t_string get_image() const 00055 { 00056 return label(); 00057 } 00058 00059 /***** ***** ***** ***** layout functions ***** ***** ***** *****/ 00060 00061 private: 00062 /** Inherited from tcontrol. */ 00063 tpoint calculate_best_size() const; 00064 public: 00065 00066 /***** ***** ***** ***** Inherited ***** ***** ***** *****/ 00067 00068 /** Inherited from tcontrol. */ 00069 void set_active(const bool /*active*/) {} 00070 00071 /** Inherited from tcontrol. */ 00072 bool get_active() const { return true; } 00073 00074 /** Inherited from tcontrol. */ 00075 unsigned get_state() const { return ENABLED; } 00076 00077 /** Inherited from tcontrol. */ 00078 bool disable_click_dismiss() const { return false; } 00079 00080 private: 00081 00082 /** 00083 * Possible states of the widget. 00084 * 00085 * Note the order of the states must be the same as defined in settings.hpp. 00086 */ 00087 enum tstate { ENABLED, COUNT }; 00088 00089 /** Inherited from tcontrol. */ 00090 const std::string& get_control_type() const; 00091 }; 00092 00093 } // namespace gui2 00094 00095 #endif 00096
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:55 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |