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_NWN_GUI_GUI_H
26 #define ENGINES_NWN_GUI_GUI_H
27 
28 #include "src/aurora/types.h"
29 
31 
32 #include "src/engines/aurora/gui.h"
33 
34 namespace Engines {
35 
36 namespace NWN {
37 
38 class ModelWidget;
39 class NWNWidgetWithCaption;
40 class QuadWidget;
41 
42 class WidgetFrame;
43 class WidgetClose;
44 class WidgetCheckBox;
45 class WidgetPanel;
46 class WidgetLabel;
47 class WidgetSlider;
48 class WidgetEditBox;
49 class WidgetButton;
50 class WidgetListBox;
51 class WidgetScrollbar;
52 
54 class GUI : public ::Engines::GUI {
55 public:
56  GUI(::Engines::Console *console = 0);
57  ~GUI();
58 
59 protected:
60  enum WidgetType {
72  };
73 
74  void load(const Common::UString &resref);
75 
76  virtual void fixWidgetType(const Common::UString &tag, WidgetType &type);
77 
78  virtual void initWidget(Widget &widget);
79 
80  WidgetFrame *getFrame (const Common::UString &tag, bool vital = false);
81  WidgetClose *getClose (const Common::UString &tag, bool vital = false);
82  WidgetCheckBox *getCheckBox (const Common::UString &tag, bool vital = false);
83  WidgetPanel *getPanel (const Common::UString &tag, bool vital = false);
84  WidgetLabel *getLabel (const Common::UString &tag, bool vital = false);
85  WidgetSlider *getSlider (const Common::UString &tag, bool vital = false);
86  WidgetEditBox *getEditBox (const Common::UString &tag, bool vital = false);
87  WidgetButton *getButton (const Common::UString &tag, bool vital = false);
88  WidgetListBox *getListBox (const Common::UString &tag, bool vital = false);
89  WidgetScrollbar *getScrollbar(const Common::UString &tag, bool vital = false);
90 
91 private:
92  struct WidgetContext {
94 
96 
99 
101 
103 
105  };
106 
108 
109  void loadWidget(const Aurora::GFF3Struct &strct, Widget *parent);
110 
111  void createWidget(WidgetContext &ctx);
112  void initWidget(WidgetContext &ctx);
113  void initWidget(WidgetContext &ctx, WidgetLabel &widget);
114  void initWidget(WidgetContext &ctx, ModelWidget &widget);
115  void initCaption(WidgetContext &ctx, NWNWidgetWithCaption &widget);
116 };
117 
118 } // End of namespace NWN
119 
120 } // End of namespace Engines
121 
122 #endif // ENGINES_NWN_GUI_GUI_H
A NWN panel widget.
Definition: panel.h:41
A NWN checkbox widget.
Definition: checkbox.h:41
A class holding an UTF-8 string.
Definition: ustring.h:48
A NWN scrollbar widget.
Definition: scrollbar.h:95
virtual void fixWidgetType(const Common::UString &tag, WidgetType &type)
Definition: gui.cpp:216
WidgetListBox * getListBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:318
A NWN frame widget.
Definition: frame.h:41
WidgetFrame * getFrame(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:222
void initCaption(WidgetContext &ctx, NWNWidgetWithCaption &widget)
Definition: gui.cpp:187
const Aurora::GFF3Struct * strct
Definition: gui.h:93
A NWN slider widget.
Definition: slider.h:41
WidgetCheckBox * getCheckBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:246
WidgetContext(const Aurora::GFF3Struct &s, Widget *p)
Definition: gui.cpp:55
A GUI.
A NWN button widget.
Definition: button.h:39
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:306
A GUI.
Definition: gui.h:43
WidgetClose * getClose(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:234
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:270
A NWN close button widget.
Definition: close.h:41
Basic Aurora graphics types.
A NWN GUI.
Definition: gui.h:54
WidgetSlider * getSlider(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:282
WidgetPanel * getPanel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:258
void load(const Common::UString &resref)
Definition: gui.cpp:77
A NWN listbox widget.
Definition: listbox.h:116
Common::UString _name
Definition: gui.h:107
WidgetEditBox * getEditBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:294
A NWN label widget.
Definition: label.h:41
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
Common::UString model
Definition: gui.h:102
A widget in a GUI.
Definition: widget.h:40
A NWN model widget.
Definition: modelwidget.h:45
A struct within a GFF3.
Definition: gff3file.h:164
GUI(::Engines::Console *console=0)
Definition: gui.cpp:71
virtual void initWidget(Widget &widget)
Definition: gui.cpp:219
A NWN editbox widget.
Definition: editbox.h:43
WidgetScrollbar * getScrollbar(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:330
void loadWidget(const Aurora::GFF3Struct &strct, Widget *parent)
Definition: gui.cpp:92
A NWN widget with a text caption.
Common::UString tag
Definition: gui.h:97
void createWidget(WidgetContext &ctx)
Definition: gui.cpp:119