@@ -5,24 +5,24 @@ namespace gui
5
5
6
6
template <class T >
7
7
OptionsBox<T>::OptionsBox():
8
- m_current_index (-1 ),
8
+ m_currentIndex (-1 ),
9
9
m_box(Box::Input),
10
- m_arrow_left (Arrow(Arrow::Left)),
11
- m_arrow_right (Arrow(Arrow::Right))
10
+ m_arrowLeft (Arrow(Arrow::Left)),
11
+ m_arrowRight (Arrow(Arrow::Right))
12
12
{
13
13
// Build visual components
14
14
m_box.item ().setFont (Theme::getFont ());
15
15
m_box.item ().setCharacterSize (Theme::textSize);
16
16
m_box.setSize (Theme::minWidgetWidth, Theme::getBoxHeight ());
17
17
18
18
// Pack left arrow
19
- m_arrow_left .setSize (Theme::getBoxHeight (), Theme::getBoxHeight ());
20
- m_arrow_left .centerItem (m_arrow_left .item ());
19
+ m_arrowLeft .setSize (Theme::getBoxHeight (), Theme::getBoxHeight ());
20
+ m_arrowLeft .centerItem (m_arrowLeft .item ());
21
21
22
22
// Pack right arrow
23
- m_arrow_right .setSize (Theme::getBoxHeight (), Theme::getBoxHeight ());
24
- m_arrow_right .setPosition (m_box.getSize ().x - Theme::getBoxHeight (), 0 );
25
- m_arrow_right .centerItem (m_arrow_right .item ());
23
+ m_arrowRight .setSize (Theme::getBoxHeight (), Theme::getBoxHeight ());
24
+ m_arrowRight .setPosition (m_box.getSize ().x - Theme::getBoxHeight (), 0 );
25
+ m_arrowRight .centerItem (m_arrowRight .item ());
26
26
27
27
// Widget local bounds
28
28
setSize (m_box.getSize ());
@@ -40,8 +40,8 @@ void OptionsBox<T>::addItem(const sf::String& label, const T& value)
40
40
if (width > getSize ().x )
41
41
{
42
42
m_box.setSize (width, Theme::getBoxHeight ());
43
- m_arrow_right .setPosition (width - Theme::getBoxHeight (), 0 );
44
- m_arrow_right .centerItem (m_arrow_right .item ());
43
+ m_arrowRight .setPosition (width - Theme::getBoxHeight (), 0 );
44
+ m_arrowRight .centerItem (m_arrowRight .item ());
45
45
setSize (m_box.getSize ());
46
46
}
47
47
@@ -54,7 +54,7 @@ void OptionsBox<T>::selectItem(size_t item_index)
54
54
{
55
55
if (item_index < m_items.size ())
56
56
{
57
- m_current_index = item_index;
57
+ m_currentIndex = item_index;
58
58
m_box.item ().setString (m_items[item_index].label );
59
59
m_box.centerText (m_box.item ());
60
60
}
@@ -64,14 +64,14 @@ void OptionsBox<T>::selectItem(size_t item_index)
64
64
template <class T >
65
65
const T& OptionsBox<T>::getSelectedValue() const
66
66
{
67
- return m_items[m_current_index ].value ;
67
+ return m_items[m_currentIndex ].value ;
68
68
}
69
69
70
70
71
71
template <class T >
72
72
size_t OptionsBox<T>::getSelectedIndex() const
73
73
{
74
- return m_current_index ;
74
+ return m_currentIndex ;
75
75
}
76
76
77
77
@@ -81,7 +81,7 @@ void OptionsBox<T>::selectNext()
81
81
if (m_items.size () > 1 )
82
82
{
83
83
// Get next item index
84
- selectItem (m_current_index == (m_items.size () - 1 ) ? 0 : m_current_index + 1 );
84
+ selectItem (m_currentIndex == (m_items.size () - 1 ) ? 0 : m_currentIndex + 1 );
85
85
triggerCallback ();
86
86
}
87
87
}
@@ -93,7 +93,7 @@ void OptionsBox<T>::selectPrevious()
93
93
if (m_items.size () > 1 )
94
94
{
95
95
// Get previous item index
96
- selectItem (m_current_index == 0 ? m_items.size () - 1 : m_current_index - 1 );
96
+ selectItem (m_currentIndex == 0 ? m_items.size () - 1 : m_currentIndex - 1 );
97
97
triggerCallback ();
98
98
}
99
99
}
@@ -104,8 +104,8 @@ void OptionsBox<T>::draw(sf::RenderTarget& target, sf::RenderStates states) cons
104
104
{
105
105
states.transform *= getTransform ();
106
106
target.draw (m_box, states);
107
- target.draw (m_arrow_left , states);
108
- target.draw (m_arrow_right , states);
107
+ target.draw (m_arrowLeft , states);
108
+ target.draw (m_arrowRight , states);
109
109
}
110
110
111
111
@@ -134,8 +134,8 @@ void OptionsBox<T>::onStateChanged(State state)
134
134
// Hovered state is handled in the onMouseMoved callback
135
135
if (state == StateDefault || state == StateFocused)
136
136
{
137
- m_arrow_left .applyState (state);
138
- m_arrow_right .applyState (state);
137
+ m_arrowLeft .applyState (state);
138
+ m_arrowRight .applyState (state);
139
139
m_box.applyState (state);
140
140
}
141
141
}
@@ -144,34 +144,34 @@ void OptionsBox<T>::onStateChanged(State state)
144
144
template <class T >
145
145
void OptionsBox<T>::onMouseMoved(float x, float y)
146
146
{
147
- updateArrow (m_arrow_left , x, y);
148
- updateArrow (m_arrow_right , x, y);
147
+ updateArrow (m_arrowLeft , x, y);
148
+ updateArrow (m_arrowRight , x, y);
149
149
}
150
150
151
151
152
152
template <class T >
153
153
void OptionsBox<T>::onMousePressed(float x, float y)
154
154
{
155
- if (m_arrow_left .containsPoint (x, y))
156
- m_arrow_left .press ();
155
+ if (m_arrowLeft .containsPoint (x, y))
156
+ m_arrowLeft .press ();
157
157
158
- else if (m_arrow_right .containsPoint (x, y))
159
- m_arrow_right .press ();
158
+ else if (m_arrowRight .containsPoint (x, y))
159
+ m_arrowRight .press ();
160
160
}
161
161
162
162
163
163
template <class T >
164
164
void OptionsBox<T>::onMouseReleased(float x, float y)
165
165
{
166
- if (m_arrow_left .containsPoint (x, y))
166
+ if (m_arrowLeft .containsPoint (x, y))
167
167
{
168
168
selectPrevious ();
169
- m_arrow_left .release ();
169
+ m_arrowLeft .release ();
170
170
}
171
- else if (m_arrow_right .containsPoint (x, y))
171
+ else if (m_arrowRight .containsPoint (x, y))
172
172
{
173
173
selectNext ();
174
- m_arrow_right .release ();
174
+ m_arrowRight .release ();
175
175
}
176
176
}
177
177
@@ -182,12 +182,12 @@ void OptionsBox<T>::onKeyPressed(const sf::Event::KeyEvent& key)
182
182
if (key.code == sf::Keyboard::Left)
183
183
{
184
184
selectPrevious ();
185
- m_arrow_left .press ();
185
+ m_arrowLeft .press ();
186
186
}
187
187
else if (key.code == sf::Keyboard::Right)
188
188
{
189
189
selectNext ();
190
- m_arrow_right .press ();
190
+ m_arrowRight .press ();
191
191
}
192
192
}
193
193
@@ -197,11 +197,11 @@ void OptionsBox<T>::onKeyReleased(const sf::Event::KeyEvent& key)
197
197
{
198
198
if (key.code == sf::Keyboard::Left)
199
199
{
200
- m_arrow_left .release ();
200
+ m_arrowLeft .release ();
201
201
}
202
202
else if (key.code == sf::Keyboard::Right)
203
203
{
204
- m_arrow_right .release ();
204
+ m_arrowRight .release ();
205
205
}
206
206
}
207
207
0 commit comments