GG: StaticGraphic.h Source File

GG

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

StaticGraphic.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /* GG is a GUI for SDL and OpenGL.
3 Copyright (C) 2003-2008 T. Zachary Laine
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License
7 as published by the Free Software Foundation; either version 2.1
8 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA
19
20 If you do not wish to comply with the terms of the LGPL please
21 contact the author as other terms are available for a fee.
22
23 Zach Laine
24 whatwasthataddress@gmail.com */
25
29 #ifndef _GG_StaticGraphic_h_
30 #define _GG_StaticGraphic_h_
31
32 #include <GG/Control.h>
33 #include <GG/Texture.h>
34
35
36 namespace GG {
37
39 GG_FLAG_TYPE(GraphicStyle);
40 extern GG_API const GraphicStyle GRAPHIC_NONE;
41 extern GG_API const GraphicStyle GRAPHIC_VCENTER;
42 extern GG_API const GraphicStyle GRAPHIC_TOP;
43 extern GG_API const GraphicStyle GRAPHIC_BOTTOM;
44 extern GG_API const GraphicStyle GRAPHIC_CENTER;
45 extern GG_API const GraphicStyle GRAPHIC_LEFT;
46 extern GG_API const GraphicStyle GRAPHIC_RIGHT;
47 extern GG_API const GraphicStyle GRAPHIC_FITGRAPHIC;
48 extern GG_API const GraphicStyle GRAPHIC_SHRINKFIT;
49 extern GG_API const GraphicStyle GRAPHIC_PROPSCALE;
50
51
57 class GG_API StaticGraphic : public Control
58 {
59 public:
61 StaticGraphic(X x, Y y, X w, Y h, const boost::shared_ptr<Texture>& texture, Flags<GraphicStyle> style = GRAPHIC_NONE, Flags<WndFlag> flags = Flags<WndFlag>());
62 StaticGraphic(X x, Y y, X w, Y h, const SubTexture& subtexture, Flags<GraphicStyle> style = GRAPHIC_NONE, Flags<WndFlag> flags = Flags<WndFlag>());
63
64
66
67 Flags<GraphicStyle> Style() const;
68
72 Rect RenderedArea() const;
74
76 virtual void Render();
77
80 void SetStyle(Flags<GraphicStyle> style);
82
83 protected:
85 StaticGraphic();
86
87
88 private:
89 void Init(const SubTexture& subtexture);
90 void ValidateStyle();
91
92 SubTexture m_graphic;
93 Flags<GraphicStyle> m_style;
94 };
95
96 } // namespace GG
97
98 #endif