xoreos  0.0.5
kotorjadewidget.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef ENGINES_AURORA_KOTORJADEGUI_KOTORJADEWIDGET_H
26 #define ENGINES_AURORA_KOTORJADEGUI_KOTORJADEWIDGET_H
27 
28 #include "src/common/scopedptr.h"
29 #include "src/common/ustring.h"
30 
31 #include "src/aurora/types.h"
32 
38 
40 
41 namespace Engines {
42 
43 class KotORJadeWidget : public Widget {
44 public:
45  KotORJadeWidget(GUI &gui, const Common::UString &tag);
47 
48  virtual void load(const Aurora::GFF3Struct &gff);
49 
51  void setClickable(bool clickable);
53  void setScissor(int x, int y, int width, int height);
54 
55  void setFill(const Common::UString &fill);
56  void setColor(float r, float g, float b, float a);
57  void setBorderColor(float r, float g, float b, float a);
58  void setWrapped(bool wrapped);
60 
61  float getBorderDimension() const;
62 
63  // .--- Highlighting
64 
65  void setHighlight(const Common::UString &hilight);
66 
68  void setHighlight(bool highlight);
70  bool isHighlight();
71 
72  // '---
73 
74  // .--- Text
76  void createText(const Common::UString &font, const Common::UString &str);
77 
79  void setFont(const Common::UString &fnt);
80 
81  void setText(const Common::UString &text);
82  void setTextColor(float r, float g, float b, float a);
83  void setHorizontalTextAlign(float halign);
84  void setVerticalTextAlign(float valign);
85 
86  float getTextHeight(const Common::UString &text) const;
87 
88  // '---
89 
90  void setTag(const Common::UString &tag);
91 
92  virtual void show();
93  virtual void hide();
94 
95  virtual void setPosition(float x, float y, float z);
96 
98  virtual void setRotation(float angle);
99 
100  // .--- Size
101 
103  virtual void setWidth(float width);
105  virtual void setHeight(float height);
106 
107  float getWidth () const;
108  float getHeight() const;
109 
110  // '---
111 
112  virtual void setInvisible(bool invisible);
113 
114 protected:
115  struct Extend {
116  float x, y, w, h;
117 
118  Extend();
119  };
120 
121  struct Border {
125 
129 
130  bool hasColor;
131  float r, g, b;
132 
133  bool pulsing;
134 
135  Border();
136  };
137 
138  struct Text {
142 
143  float halign;
144  float valign;
145 
146  float r, g, b;
147 
148  bool pulsing;
149 
150  Text();
151  };
152 
153  struct Hilight {
155 
156  Hilight();
157  };
158 
161 
162  float _width;
163  float _height;
165 
166  float _r, _g, _b, _a;
168 
169  bool _wrapped;
170 
175 
177 
179 
182  Text createText (const Aurora::GFF3Struct &gff);
184 };
185 
186 } // End of namespace Engines
187 
188 #endif // ENGINES_AURORA_KOTORJADEGUI_KOTORJADEWIDGET_H
virtual void setHeight(float height)
Set the height of the widget.
void setClickable(bool clickable)
Set the widget clickable, or not clickable.
void setScissor(int x, int y, int width, int height)
Create a scissor test over this widget.
Graphics::Aurora::Highlightable * getTextHighlightableComponent() const
void setFill(const Common::UString &fill)
Hilight createHilight(const Aurora::GFF3Struct &gff)
virtual void hide()
Hide the widget.
A class holding an UTF-8 string.
Definition: ustring.h:48
void setTextColor(float r, float g, float b, float a)
Common::ScopedPtr< Graphics::Aurora::BorderQuad > _border
void setHorizontalTextAlign(float halign)
void createText(const Common::UString &font, const Common::UString &str)
Initialize the text within this widget.
Common::ScopedPtr< Graphics::Aurora::GUIQuad > _highlight
Common::ScopedPtr< Graphics::Aurora::GUIQuad > _quad
void setHighlight(const Common::UString &hilight)
void setSubScene(Graphics::Aurora::SubSceneQuad *subscene)
virtual void setRotation(float angle)
Set the rotation of the widget in degrees.
KotORJadeWidget(GUI &gui, const Common::UString &tag)
A simple scoped smart pointer template.
A GUI.
Definition: gui.h:43
bool isHighlight()
If the widget is highlighted.
Basic Aurora graphics types.
float getTextHeight(const Common::UString &text) const
virtual void show()
Show the widget.
void setFont(const Common::UString &fnt)
Change the font for this widget.
A quad for generating borders.
void setTag(const Common::UString &tag)
Set the widget&#39;s tag.
A widget in a GUI.
Extend createExtend(const Aurora::GFF3Struct &gff)
Unicode string handling.
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
void setVerticalTextAlign(float valign)
A widget in a GUI.
Definition: widget.h:40
Graphics::Aurora::SubSceneQuad * _subScene
A struct within a GFF3.
Definition: gff3file.h:164
uint32_t uint32
Definition: types.h:204
virtual void setInvisible(bool invisible)
Make the widget invisible.
void setColor(float r, float g, float b, float a)
void setText(const Common::UString &text)
The quad for displaying a subscene.
void setWrapped(bool wrapped)
void setBorderColor(float r, float g, float b, float a)
Common::ScopedPtr< Graphics::Aurora::HighlightableText > _text
virtual void load(const Aurora::GFF3Struct &gff)
float getWidth() const
Get the widget&#39;s width.
virtual void setWidth(float width)
Set the width of the widget.
Border createBorder(const Aurora::GFF3Struct &gff)
virtual void setPosition(float x, float y, float z)
Set the widget&#39;s position.
float getHeight() const
Get the widget&#39;s height.
Graphics::Aurora::Highlightable * getQuadHighlightableComponent() const