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_KOTOR_GUI_GUI_H
26 #define ENGINES_KOTOR_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 KotOR {
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 KotOR
147 
148 } // End of namespace Engines
149 
150 #endif // ENGINES_KOTOR_GUI_GUI_H
Handling version V3.2/V3.3 of BioWare&#39;s GFFs (generic file format).
virtual void initWidget(Widget &widget)
Definition: gui.cpp:189
void load(const Common::UString &resref)
Definition: gui.cpp:103
void createWidget(WidgetContext &ctx)
Definition: gui.cpp:158
Common::UString _name
Definition: gui.h:139
A class holding an UTF-8 string.
Definition: ustring.h:48
WidgetContext(const Aurora::GFF3Struct &s, Widget *p)
Definition: gui.cpp:49
virtual void mouseDown()
Definition: gui.cpp:95
virtual void mouseUp()
The mouse state has changed.
Definition: gui.cpp:99
GUI(::Engines::Console *console=0)
Definition: gui.cpp:63
bool getCheckBoxState(const Common::UString &tag)
Definition: gui.cpp:312
virtual void hide()
Hide the GUI.
Definition: gui.cpp:75
A GUI.
A simple scoped smart pointer template.
float _widgetZ
Definition: gui.h:130
A GUI.
Definition: gui.h:43
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:228
Basic Aurora graphics types.
WidgetScrollbar * getScrollbar(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:264
Common::UString getName() const
Definition: gui.cpp:91
const Aurora::GFF3Struct * strct
Definition: gui.h:118
float _guiWidth
Definition: gui.h:133
WidgetProtoItem * getProtoItem(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:216
void convertToXoreos(float &x, float &y, const float widgetHeight) const
Converts Kotor&#39; GUI coordinates with a coordinate origin in the upper left corner to the Xoreos coord...
Definition: gui.cpp:81
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition: scopedptr.h:120
WidgetSlider * getSlider(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:252
void addBackground(const Common::UString &background, bool front=false)
Definition: gui.cpp:300
void loadWidget(const Aurora::GFF3Struct &strct, Widget *parent)
Definition: gui.cpp:126
Common::ScopedPtr< GUIBackground > _background
Definition: gui.h:135
virtual void show()
Show the GUI.
Definition: gui.cpp:69
KotORJadeWidget * widget
Definition: gui.h:123
void convertToGUI(float &x, float &y, const float widgetHeight) const
Converts Xoreos&#39; coordinates with a coordinate origin in the center to Kotor&#39;s GUI coordinates with t...
Definition: gui.cpp:86
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:204
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
A widget in a GUI.
Definition: widget.h:40
A struct within a GFF3.
Definition: gff3file.h:164
WidgetProgressbar * getProgressbar(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:276
WidgetCheckBox * getCheckBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:240
WidgetListBox * getListBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:288
A KotOR GUI.
Definition: gui.h:57
float _guiHeight
Definition: gui.h:132
WidgetPanel * getPanel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:192
Common::ScopedPtr< Aurora::GFF3File > _gff
Definition: gui.h:137
void setCheckBoxState(const Common::UString &tag, bool state)
Definition: gui.cpp:307
The menu background.