comparison engine/core/gui/widgets/icon2.hpp @ 697:ecaa4d98f05f tip

Abstracted the GUI code and refactored the GUIChan-specific code into its own module. * Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring. * GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass. * The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class. * The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged. * Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author M. George Hansen <technopolitica@gmail.com>
date Sat, 18 Jun 2011 00:28:40 -1000
parents e201abd8c807
children
comparison
equal deleted inserted replaced
696:e201abd8c807 697:ecaa4d98f05f
1 /***************************************************************************
2 * Copyright (C) 2005-2008 by the FIFE team *
3 * http://www.fifengine.de *
4 * This file is part of FIFE. *
5 * *
6 * FIFE is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21
22 /* _______ __ __ __ ______ __ __ _______ __ __
23 * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
24 * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
25 * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
26 * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
27 * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
28 * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
29 *
30 * Copyright (c) 2004, 2005 darkbits Js_./
31 * Per Larsson a.k.a finalman _RqZ{a<^_aa
32 * Olof Naess�n a.k.a jansem/yakslem _asww7!uY`> )\a//
33 * _Qhm`] _f "'c 1!5m
34 * Visit: http://guichan.darkbits.org )Qk<P ` _: :+' .' "{[
35 * .)j(] .d_/ '-( P . S
36 * License: (BSD) <Td/Z <fP"5(\"??"\a. .L
37 * Redistribution and use in source and _dV>ws?a-?' ._/L #'
38 * binary forms, with or without )4d[#7r, . ' )d`)[
39 * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam'
40 * that the following conditions are met: j<<WP+k/);. _W=j f
41 * 1. Redistributions of source code must .$%w\/]Q . ."' . mj$
42 * retain the above copyright notice, ]E.pYY(Q]>. a J@\
43 * this list of conditions and the j(]1u<sE"L,. . ./^ ]{a
44 * following disclaimer. 4'_uomm\. )L);-4 (3=
45 * 2. Redistributions in binary form must )_]X{Z('a_"a7'<a"a, ]"[
46 * reproduce the above copyright notice, #}<]m7`Za??4,P-"'7. ).m
47 * this list of conditions and the ]d2e)Q(<Q( ?94 b- LQ/
48 * following disclaimer in the <B!</]C)d_, '(<' .f. =C+m
49 * documentation and/or other materials .Z!=J ]e []('-4f _ ) -.)m]'
50 * provided with the distribution. .w[5]' _[ /.)_-"+? _/ <W"
51 * 3. Neither the name of Guichan nor the :$we` _! + _/ . j?
52 * names of its contributors may be used =3)= _f (_yQmWW$#( "
53 * to endorse or promote products derived - W, sQQQQmZQ#Wwa]..
54 * from this software without specific (js, \[QQW$QWW#?!V"".
55 * prior written permission. ]y:.<\.. .
56 * -]n w/ ' [.
57 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT )/ )/ !
58 * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY < (; sac , '
59 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, ]^ .- %
60 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF c < r
61 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR aga< <La
62 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5% )P'-3L
63 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR _bQf` y`..)a
64 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ,J?4P'.P"_(\?d'.,
65 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES _Pa,)!f/<[]/ ?"
66 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT _2-..:. .r+_,.. .
67 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ?a.<%"' " -'.a_ _,
68 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ^
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
70 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
71 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
72 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
73 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
74 */
75
76 #ifndef GCN_ICON2_HPP
77 #define GCN_ICON2_HPP
78
79 // Standard C++ library includes
80
81 // 3rd party library includes
82 #include <guichan/image.hpp>
83 #include <guichan/platform.hpp>
84 #include <guichan/widget.hpp>
85
86 // FIFE includes
87 // These includes are split up in two parts, separated by one empty line
88 // First block: files included from the FIFE root src directory
89 // Second block: files included from the same folder
90
91 namespace gcn
92 {
93 /**
94 * An Icon for displaying images.
95 *
96 * \note Modified for FIFE.
97 */
98 class Icon2 : public Widget
99 {
100 public:
101 /**
102 * Constructor.
103 *
104 * @param image an Image to display.
105 */
106 Icon2(Image* image);
107 virtual ~Icon2() {}
108
109
110 // Inherited from Widget
111
112 virtual void draw(Graphics* graphics);
113
114 virtual void drawFrame(Graphics* graphics);
115
116 // added for FIFE
117 void setImage(Image* image);
118
119 // changed from private to allow derived instance access
120 protected:
121 Image* mImage;
122 };
123 }
124
125 #endif // end GCN_ICON2_HPP