xoreos  0.0.5
gui.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_JADE_GUI_GUI_H
26 #define ENGINES_JADE_GUI_GUI_H
27 
28 #include "src/common/scopedptr.h"
29 
30 #include "src/aurora/types.h"
31 #include "src/aurora/gff3file.h"
32 
35 
36 #include "src/engines/aurora/gui.h"
37 
39 
40 namespace Engines {
41 
42 class KotORJadeWidget;
43 
44 class WidgetPanel;
45 class WidgetLabel;
46 class WidgetProtoItem;
47 class WidgetButton;
48 class WidgetCheckBox;
49 class WidgetSlider;
50 class WidgetScrollbar;
51 class WidgetProgressbar;
52 class WidgetListBox;
53 
54 namespace Jade {
55 
57 class GUI : public Engines::GUI {
58 public:
59  GUI(::Engines::Console *console = 0);
60  ~GUI();
61 
62  virtual void show();
63  virtual void hide();
64 
70  void convertToXoreos(float &x, float &y, const float widgetHeight) const;
76  void convertToGUI(float &x, float &y, const float widgetHeight) const;
77 
78  Common::UString getName() const;
79 
80 protected:
81  enum WidgetType {
92  };
93 
94  virtual void mouseUp();
95  virtual void mouseDown();
96 
97  void load(const Common::UString &resref);
98 
99  virtual void initWidget(Widget &widget);
100 
101  WidgetPanel *getPanel (const Common::UString &tag, bool vital = false);
102  WidgetLabel *getLabel (const Common::UString &tag, bool vital = false);
103  WidgetProtoItem *getProtoItem (const Common::UString &tag, bool vital = false);
104  WidgetButton *getButton (const Common::UString &tag, bool vital = false);
105  WidgetCheckBox *getCheckBox (const Common::UString &tag, bool vital = false);
106  WidgetSlider *getSlider (const Common::UString &tag, bool vital = false);
107  WidgetScrollbar *getScrollbar (const Common::UString &tag, bool vital = false);
108  WidgetProgressbar *getProgressbar(const Common::UString &tag, bool vital = false);
109  WidgetListBox *getListBox (const Common::UString &tag, bool vital = false);
110 
111  void addBackground(const Common::UString &background, bool front = false);
112 
113  void setCheckBoxState(const Common::UString &tag, bool state);
114  bool getCheckBoxState(const Common::UString &tag);
115 
116 private:
117  struct WidgetContext {
119 
121 
124 
126 
128  };
129 
130  float _widgetZ;
131 
132  float _guiHeight;
133  float _guiWidth;
134 
136 
138 
140 
141  void loadWidget(const Aurora::GFF3Struct &strct, Widget *parent);
142 
143  void createWidget(WidgetContext &ctx);
144 };
145 
146 } // End of namespace Jade
147 
148 } // End of namespace Engines
149 
150 #endif // ENGINES_JADE_GUI_GUI_H
Handling version V3.2/V3.3 of BioWare&#39;s GFFs (generic file format).
A class holding an UTF-8 string.
Definition: ustring.h:48
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:218
WidgetScrollbar * getScrollbar(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:254
Common::UString _name
Definition: gui.h:139
void loadWidget(const Aurora::GFF3Struct &strct, Widget *parent)
Definition: gui.cpp:120
virtual void hide()
Hide the GUI.
Definition: gui.cpp:75
const Aurora::GFF3Struct * strct
Definition: gui.h:118
A GUI.
A simple scoped smart pointer template.
Common::UString getName() const
Definition: gui.cpp:91
KotORJadeWidget * widget
Definition: gui.h:123
WidgetContext(const Aurora::GFF3Struct &s, Widget *p)
Definition: gui.cpp:49
WidgetProtoItem * getProtoItem(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:206
A GUI.
Definition: gui.h:43
float _guiWidth
Definition: gui.h:133
The menu background.
Basic Aurora graphics types.
void addBackground(const Common::UString &background, bool front=false)
Definition: gui.cpp:290
A Jade Empire GUI.
Definition: gui.h:57
WidgetSlider * getSlider(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:242
GUI(::Engines::Console *console=0)
Definition: gui.cpp:63
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition: scopedptr.h:120
Common::ScopedPtr< Aurora::GFF3File > _gff
Definition: gui.h:137
void convertToGUI(float &x, float &y, const float widgetHeight) const
Converts Xoreos&#39; coordinates with a coordinate origin in the center to Jade Empire&#39;s GUI coordinates ...
Definition: gui.cpp:86
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
void load(const Common::UString &resref)
Definition: gui.cpp:103
virtual void show()
Show the GUI.
Definition: gui.cpp:69
A widget in a GUI.
Definition: widget.h:40
void setCheckBoxState(const Common::UString &tag, bool state)
Definition: gui.cpp:297
void createWidget(WidgetContext &ctx)
Definition: gui.cpp:152
A struct within a GFF3.
Definition: gff3file.h:164
virtual void mouseDown()
Definition: gui.cpp:95
virtual void initWidget(Widget &widget)
Definition: gui.cpp:179
void convertToXoreos(float &x, float &y, const float widgetHeight) const
Converts Jade Empire&#39; GUI coordinates with a coordinate origin in the upper left corner to the Xoreos...
Definition: gui.cpp:81
float _widgetZ
Definition: gui.h:130
WidgetListBox * getListBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:278
WidgetCheckBox * getCheckBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:230
Common::ScopedPtr< GUIBackground > _background
Definition: gui.h:135
virtual void mouseUp()
The mouse state has changed.
Definition: gui.cpp:99
bool getCheckBoxState(const Common::UString &tag)
Definition: gui.cpp:302
WidgetPanel * getPanel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:182
WidgetProgressbar * getProgressbar(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:266
float _guiHeight
Definition: gui.h:132
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:194