xoreos  0.0.5
protoitem.cpp
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 #include "src/common/system.h"
26 
27 #include "src/engines/aurora/gui.h"
29 
31 
32 namespace Engines {
33 
35  : KotORJadeWidget(gui, tag),
36  _disableHighlight(false),
37  _hovered(false),
38  _parentList(parentList) {
39 }
40 
42 }
43 
45  if (_text)
46  _text->setText(contents);
47 }
48 
50  return _hovered;
51 }
52 
55 
57  if (highlightable)
58  setDefaultHighlighting(highlightable);
59 
60  highlightable = getQuadHighlightableComponent();
61  if (highlightable)
62  setDefaultHighlighting(highlightable);
63 }
64 
66  if (!_disableHighlight)
67  setHighlight(true);
68 
69  if (!_soundHover.empty())
71 
72  _hovered = true;
73 }
74 
76  if (!_disableHighlight)
77  setHighlight(false);
78 
79  _hovered = false;
80 }
81 
82 void WidgetProtoItem::mouseUp(uint8 UNUSED(state), float UNUSED(x), float UNUSED(y)) {
83  if (!_soundClick.empty())
85 
86  setActive(true);
87 }
88 
89 void WidgetProtoItem::setDisableHighlight(bool disableHighlight) {
90  _disableHighlight = disableHighlight;
91 }
92 
94  _soundHover = resRef;
95 }
96 
98  _soundClick = resRef;
99 }
100 
102  highlightable->setHighlightable(true);
103  highlightable->setHighlightDelta(0.0f, 0.0f, 0.0f, 0.05f);
104  highlightable->setHighlightLowerBound(1.0f, 1.0f, 0.0f, 0.2f);
105  highlightable->setHighlightUpperBound(1.0f, 1.0f, 0.0f, 1.0f);
106 }
107 
108 void WidgetProtoItem::mouseWheel(uint8 state, int x, int y) {
109  if (_parentList)
110  _parentList->mouseWheel(state, x, y);
111 }
112 
113 } // End of namespace Engines
Graphics::Aurora::Highlightable * getTextHighlightableComponent() const
void mouseWheel(uint8 state, int x, int y)
A mouse wheel was used on the widget.
Definition: listbox.cpp:392
void setSoundHover(const Common::UString &resRef)
Definition: protoitem.cpp:93
A class holding an UTF-8 string.
Definition: ustring.h:48
WidgetListBox * _parentList
Definition: protoitem.h:63
uint8_t uint8
Definition: types.h:200
void setHighlight(const Common::UString &hilight)
void setActive(bool active)
The widget&#39;s active state.
Definition: widget.cpp:268
void setDisableHighlight(bool disableHighlight)
Definition: protoitem.cpp:89
A GUI.
void setDefaultHighlighting(Graphics::Aurora::Highlightable *highlightable)
Definition: protoitem.cpp:101
void setHighlightable(bool highlightable)
A GUI.
Definition: gui.h:43
void mouseUp(uint8 state, float x, float y)
A mouse button was released on the widget.
Definition: protoitem.cpp:82
#define UNUSED(x)
Definition: system.h:170
void setSoundClick(const Common::UString &resRef)
Definition: protoitem.cpp:97
bool empty() const
Is the string empty?
Definition: ustring.cpp:245
void setHighlightDelta(float r, float g, float b, float a)
Set how much the quad changes per render.
virtual void load(const Aurora::GFF3Struct &gff)
Definition: protoitem.cpp:53
Sound::ChannelHandle playSound(const Common::UString &sound, Sound::SoundType soundType, bool loop, float volume, bool pitchVariance)
Play this sound resource.
Definition: util.cpp:81
virtual void setContents(const Common::UString &contents)
Set item contents.
Definition: protoitem.cpp:44
bool isHovered() const
Definition: protoitem.cpp:49
A struct within a GFF3.
Definition: gff3file.h:164
A protoitem widget for Star Wars: Knights of the Old Republic and Jade Empire.
Low-level detection of architecture/system properties.
Common::UString _soundClick
Definition: protoitem.h:66
WidgetProtoItem(GUI &gui, const Common::UString &tag, WidgetListBox *parentList=0)
Definition: protoitem.cpp:34
Sound effect.
Definition: types.h:45
Generic Aurora engines utility functions.
void leave()
The mouse left the widget.
Definition: protoitem.cpp:75
void enter()
The mouse entered the widget.
Definition: protoitem.cpp:65
Common::ScopedPtr< Graphics::Aurora::HighlightableText > _text
void setHighlightUpperBound(float r, float g, float b, float a)
When any of the quad properties are greater than this bound, the signs of the delta floats will flip...
virtual void load(const Aurora::GFF3Struct &gff)
virtual void mouseWheel(uint8 state, int x, int y)
A mouse wheel was used on the widget.
Definition: protoitem.cpp:108
Common::UString _soundHover
Definition: protoitem.h:65
void setHighlightLowerBound(float r, float g, float b, float a)
When any of the quad properties are less than this bound, the signs of the delta floats will flip...
Graphics::Aurora::Highlightable * getQuadHighlightableComponent() const