-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiInput.cpp
More file actions
225 lines (142 loc) · 3.77 KB
/
Copy pathMultiInput.cpp
File metadata and controls
225 lines (142 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/**
* @file MultiInput.cpp
*
* @brief File containing source code of the MultiInput class
*
*
* @author Hugo MARTIN
* Contact: hugo.martin.1@etu.univ-amu.fr
*
*/
#include "classes.h"
/** Constructor of the class MultiInput.
*
* Modification of the constructor of MultiInput
*
*
*
*/
vampireGameproject::MultiInput::MultiInput(){}
/** Destructor of the class MultiInput.
*
* Modification of the destructor of MultiInput
*
*
*
*/
vampireGameproject::MultiInput::~MultiInput(){}
/** Implementation of the returnSpinButton method.
*
* Implementation of the returnSpinButton method
* Method returning the reference of the SpinButton
*
*
*/
Gtk::SpinButton& vampireGameproject::MultiInput::returnSpinButton(){
return spinButton;
}
/** Implementation of the returnComboBox method.
*
* Implementation of the returnComboBox method
* Method returning the reference of the chosen ComboBox
*
* @param position: position of the ComboBox to return
*/
Gtk::ComboBoxText& vampireGameproject::MultiInput::returnComboBox(std::string position){
if (position == "first"){
return firstComboBox;
}
else{
return secondComboBox;
}
}
/** Implementation of the setLimitSpinButton method.
*
* Implementation of the setLimitSpinButton method
* Method setting the limit of the SpinButton
*
* @param limit: limit of the SpinButton to set
*/
void vampireGameproject::MultiInput::setLimitSpinButton(int limit){
spinButton.set_range(0, limit);
spinButton.set_increments(1,1);
}
/** Implementation of the returnSpinScore method.
*
* Implementation of the returnSpinScore method
* Method returning the Spin Score
*
*
*/
int vampireGameproject::MultiInput::returnSpinScore(){
return spinButton.get_value();
}
/** Implementation of the returnTextComboBox method.
*
* Implementation of the returnTextComboBox method
* Method returning the Text from ComboBox
* If nothing is set for the Combobox, then an empty string
* is returned
*
* @param index: index of the ComboBoxText to return text
*/
std::string vampireGameproject::MultiInput::returnTextComboBox(std::string index){
if (index == "first"){
if (firstComboBox.get_active_text() != ""){
return firstComboBox.get_active_text();
}
return "";
}
else{
if (secondComboBox.get_active_text() != ""){
return secondComboBox.get_active_text();
}
return "";
}
}
/** Implementation of the setVectorComboBox method.
*
* Implementation of the setVectorComboBox method
* Method setting the vector containing the ComboBox items
*
* @param vectorText vector containing the items
* @param index position of the Combobox to set
*
*/
void vampireGameproject::MultiInput::setVectorComboBox(std::vector<std::string>& vectorText,
std::string index){
if (index == "first"){
for(int iterator = 0; iterator < (int)vectorText.size(); iterator++){
firstComboBox.append(vectorText.at(iterator));
}
}
else{
for(int iterator = 0; iterator < (int)vectorText.size(); iterator++){
secondComboBox.append(vectorText.at(iterator));
}
}
}
/** Implementation of the unsetActiveText method.
*
* Implementation of the unsetActiveText method
* Method unsetting the active text of the Second
* ComboBox Text
*
*
*
*/
void vampireGameproject::MultiInput::unsetActiveText(){
secondComboBox.set_active_text("");
}
/** Implementation of the resetSpinScore method.
*
* Implementation of the resetSpinScore method
* Method reseting the spin Score of a MultiInput Spin Button
*
*
*
*/
void vampireGameproject::MultiInput::resetSpinScore(){
spinButton.set_value(0);
spinButton.set_increments(0, 0);
}