-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGui.cpp
More file actions
942 lines (536 loc) · 21 KB
/
Copy pathGui.cpp
File metadata and controls
942 lines (536 loc) · 21 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
/**
* @file Gui.cpp
*
* @brief File containing source code of the Gui class
*
*
* @author Hugo MARTIN
* Contact: hugo.martin.1@etu.univ-amu.fr
*
*/
#include "classes.h"
/** Constructor of the class Gui.
*
* Modification of the constructor of Gui
* Initialisation of the testGui constructor
* before the Gui constructor be initialised
*
* @param rulesGamereference: Reference of the RulesOfGame object
*/
vampireGameproject::Gui::Gui(){}
/** Destructor of the class Gui.
* Modification of the destructor of Gui */
vampireGameproject::Gui::~Gui(){}
/** Implementation of the setTableComboBox method.
*
* Implementation of the setTableComboBox method
* Method filling the ComboBoxes Clan, Nature and Health
* with Parsed Text
*
* @param index: number of the ComboBoxText in the table of ComboBoxesTexts
* @param vectorElements: vector containg the text to set in the ComboBoxText
*/
void vampireGameproject::Gui::setTableComboBox(int index, std::vector<std::string>& vectorElements){
for(int iterator = 0; iterator < (int)vectorElements.size(); iterator++){
tableComboBox[index].append(vectorElements.at(iterator));
}
}
/** Implementation of the returnClanName method.
*
* Implementation of the returnClanName method
* Method returning the text active from the Clan
* ComboBox Text */
std::string vampireGameproject::Gui::returnClanName(){
return tableComboBox[0].get_active_text();
}
/** Implementation of the returnNature method.
*
* Implementation of the returnNature method
* Method returning the text active from the Nature
* ComboBox Text */
std::string vampireGameproject::Gui::returnNature(){
return tableComboBox[1].get_active_text();
}
/** Implementation of the returnHealth method.
*
* Implementation of the returnHealth method
* Method returning the text active from the Health
* ComboBox Text */
std::string vampireGameproject::Gui::returnHealth(){
return tableComboBox[2].get_active_text();
}
/** Implementation of the initialiseTableLabel method.
*
* Implementation of the initialiseTableLabel method
* Method setting the Label for Clan, Name of the Vampire,
* Attributes and Nature
*
*
*/
void vampireGameproject::Gui::initialiseTableLabel(){
for(int iterator = 0; iterator <= 3; iterator++){
tableLabel[iterator] = Gtk::Label();
}
}
/** Implementation of the initialiseTableComboBox method.
*
* Implementation of the initialiseTableComboBox method
* Method creating the ComboBox Nature and Clan
*
*
*/
void vampireGameproject::Gui::initialiseTableComboBox(){
tableComboBox[0] = Gtk::ComboBoxText();
tableComboBox[1] = Gtk::ComboBoxText();
}
/** Implementation of the setTableLabelAlign method.
*
* Implementation of the setTableLabelAlign method
* Method setting the text of labels contained in the
* table of Labels and aligning this text to the interface
*
* @param index: number of Label in the table
* @param label: text to set in the label
*/
void vampireGameproject::Gui::setTableLabelAlign(int index, std::string label){
tableLabel[index].set_text(label);
tableLabel[index].set_xalign(0.0);
}
/** Implementation of the setTableLabel method.
*
* Implementation of the setTableLabel method
* Method assigning text to a precised label
*
* @param index: number of Label in the table
* @param label: text to set in the label
*/
void vampireGameproject::Gui::setTableLabel(int index, std::string label){
tableLabel[index].set_text(label);
}
/** Implementation of the setTableLabelOnGrid method.
*
* Implementation of the setTableLabelOnGrid method
* Method displaying labels on the GUI
*
* @param index: number of the Label in the Label table
* @param xcoordinates: x coordinates to set the label in the gui
* @param ycoordinates: y coordinate to set the label in the gui
* @param width: width of the label in the gui
* @param height: height of the label in the gui
*/
void vampireGameproject::Gui::setTableLabelOnGrid(int index, int xcoordinates, int ycoordinates, int width, int height){
mainGrid.attach(tableLabel[index], xcoordinates, ycoordinates, width, height);
}
/** Implementation of the setTableComboBoxOnGrid method.
*
* Implementation of the setTableComboBoxOnGrid method
* Method displaying ComboBoxes on the GUI
*
* @param index: number of the ComboBox in the ComboBox table
* @param indexLabel: number of the Label in the Label Table
*/
void vampireGameproject::Gui::setTableComboBoxOnGrid(int index, int indexLabel){
mainGrid.attach_next_to(tableComboBox[index], tableLabel[indexLabel], Gtk::POS_RIGHT, 1, 1);
}
/** Implementation of the returnComboBoxClan method.
*
* Implementation of the returnComboBoxClan method
* Method returning ComboBoxText associated to the Clan*/
Gtk::ComboBoxText& vampireGameproject::Gui::returnComboBoxClan(){
return tableComboBox[0];
}
/** Implementation of the setButtonMultiInputAttributes method.
*
* Implementation of the setButtonMultiInputAttributes method
* Method displaying Plus and Minus button of ButtonMultiInput
* And Displaying their labels on the buttons*/
void vampireGameproject::Gui::setButtonMultiInputAttributes(){
mainGrid.attach_next_to(attributesInput.returnButton("minus"),
tableLabel[5], Gtk::POS_RIGHT, 1, 1);
mainGrid.attach_next_to(attributesInput.returnButton("plus"),
attributesInput.returnButton("minus"), Gtk::POS_RIGHT, 1, 1);
setLabelMultiComboBoxAttributes();
}
/** Implementation of the setButtonMultiInputAbilities method.
*
* Implementation of the setButtonMultiInputAbilities method
* Method displaying Plus and Minus button of ButtonMultiInput
* And Displaying their labels on the buttons
*
*/
void vampireGameproject::Gui::setButtonMultiInputAbilities(){
mainGrid.attach_next_to(abilitiesInput.returnButton("minus"),
tableLabel[6], Gtk::POS_RIGHT, 1, 1);
mainGrid.attach_next_to(abilitiesInput.returnButton("plus"),
abilitiesInput.returnButton("minus"), Gtk::POS_RIGHT, 1, 1);
setLabelMultiComboBoxAbilities();
}
/** Implementation of the setButtonMultiInputBackgrounds method.
*
* Implementation of the setButtonMultiInputBackgrounds method
* Method displaying Plus and Minus button of ButtonMultiInput
* And Displaying their labels on the buttons
*
*/
void vampireGameproject::Gui::setButtonMultiInputBackgrounds(){
mainGrid.attach_next_to(backgroundsInput.returnButton("minus"),
tableLabel[8], Gtk::POS_RIGHT, 1, 1);
mainGrid.attach_next_to(backgroundsInput.returnButton("plus"),
backgroundsInput.returnButton("minus"), Gtk::POS_RIGHT, 1, 1);
setLabelMultiComboBoxBackgrounds();
}
/** Implementation of the setButtonMultiInputVirtues method.
*
* Implementation of the setButtonMultiInputVirtues method
* Method displaying Plus and Minus button of ButtonMultiInput
* And Displaying their labels on the buttons
*
*/
void vampireGameproject::Gui::setButtonMultiInputVirtues(){
mainGrid.attach_next_to(virtuesInput.returnButton("minus"),
tableLabel[9], Gtk::POS_RIGHT, 1, 1);
mainGrid.attach_next_to(virtuesInput.returnButton("plus"),
virtuesInput.returnButton("minus"), Gtk::POS_RIGHT, 1, 1);
setLabelMultiComboBoxVirtues();
}
/** Implementation of the setButtonMultiInputDisciplines method.
*
* Implementation of the setButtonMultiInputDisciplines method
* Method displaying Plus and Minus button of ButtonMultiInput
* And Displaying their labels on the buttons
*
*/
void vampireGameproject::Gui::setButtonMultiInputDisciplines(){
mainGrid.attach_next_to(disciplinesInput.returnButton("minus"),
tableLabel[7], Gtk::POS_RIGHT, 1, 1);
mainGrid.attach_next_to(disciplinesInput.returnButton("plus"),
disciplinesInput.returnButton("minus"), Gtk::POS_RIGHT, 1, 1);
setLabelMultiComboBoxDisciplines();
}
/** Implementation of the setButtonMultiInputMeritsFlaws method.
*
* Implementation of the setButtonMultiInputMeritsFlaws method
* Method displaying Plus and Minus button of ButtonMultiInput
* And Displaying their labels on the buttons
*
*/
void vampireGameproject::Gui::setButtonMultiInputMeritsFlaws(){
mainGrid.attach_next_to(meritsFlawsInput.returnButton("minus"),
tableLabel[10], Gtk::POS_RIGHT, 1, 1);
mainGrid.attach_next_to(meritsFlawsInput.returnButton("plus"),
meritsFlawsInput.returnButton("minus"), Gtk::POS_RIGHT, 1, 1);
setLabelMultiComboBoxMeritsFlaws();
}
/** Implementation of the setSpinButtonHumanityPath method.
*
* Implementation of the setSpinButtonHumanityPath method
* Method displaying the Spin button associated to Humanity Path
* next to the label in the gui*/
void vampireGameproject::Gui::setSpinButtonHumanityPath(){
mainGrid.attach_next_to(HumanityPathScore, tableLabel[11], Gtk::POS_RIGHT, 1, 1);
}
/** Implementation of the setSpinButtonWillPower method.
*
* Implementation of the setSpinButtonWillPower method
* Method displaying the Spin button associated to WillPower
* next to the label in the gui*/
void vampireGameproject::Gui::setSpinButtonWillPower(){
mainGrid.attach_next_to(WillPowerScore, tableLabel[12], Gtk::POS_RIGHT, 1, 1);
}
/** Implementation of the setSpinButtonBloodPool method.
*
* Implementation of the setSpinButtonBloodPool method
* Method displaying the Spin button associated to Humanity Path
* next to the label in the gui*/
void vampireGameproject::Gui::setSpinButtonBloodPool(){
mainGrid.attach_next_to(BloodPoolScore, tableLabel[13], Gtk::POS_RIGHT, 1, 1);
}
/** Implementation of the setValidationButton method.
*
* Implementation of the setValidationButton method
* Method displaying the button allowing to retrieve
* informations entered by the user and to generate the
* file containing the information*/
void vampireGameproject::Gui::setValidationButton(){
validationButton.set_label("Save");
mainGrid.attach(validationButton, 0, 63, 1, 1);
}
/** Implementation of the returnHumanityPathSpinButton method.
*
* Implementation of the returnHumanityPathSpinButton method
* Method allowing to return the Spinbutton associated to Humanity
* Path*/
Gtk::SpinButton& vampireGameproject::Gui::returnHumanityPathSpinButton(){
return HumanityPathScore;
}
/** Implementation of the returnWillPowerSpinButton method.
*
* Implementation of the returnWillPowerSpinButton method
* Method allowing to return the Spinbutton associated to Willpower*/
Gtk::SpinButton& vampireGameproject::Gui::returnWillPowerSpinButton(){
return WillPowerScore;
}
/** Implementation of the returnBloodPoolSpinButton method.
*
* Implementation of the returnBloodPoolSpinButton method
* Method allowing to return the Spinbutton associated to Blood Pool*/
Gtk::SpinButton& vampireGameproject::Gui::returnBloodPoolSpinButton(){
return BloodPoolScore;
}
/** Implementation of the returnValidationButton method.
*
* Implementation of the returnValidationButton method
* Method allowing to return the button allowing to
* retrieve the informations from the user*/
Gtk::Button& vampireGameproject::Gui::returnValidationButton(){
return validationButton;
}
/** Implementation of the setLabelMultiComboBoxAttributes method.
*
* Implementation of the setLabelMultiComboBoxAttributes method
* Method displaying Plus and Minus on the buttons
*
*
*/
void vampireGameproject::Gui::setLabelMultiComboBoxAttributes(){
attributesInput.setLabelMultiComboBox();
}
/** Implementation of the setLabelMultiComboBoxAbilities method.
*
* Implementation of the setLabelMultiComboBoxAbilities method
* Method displaying Plus and Minus on the buttons
*
*
*/
void vampireGameproject::Gui::setLabelMultiComboBoxAbilities(){
abilitiesInput.setLabelMultiComboBox();
}
/** Implementation of the setLabelMultiComboBoxBackgrounds method.
*
* Implementation of the setLabelMultiComboBoxBackgrounds method
* Method displaying Plus and Minus on the buttons
*
*
*/
void vampireGameproject::Gui::setLabelMultiComboBoxBackgrounds(){
backgroundsInput.setLabelMultiComboBox();
}
/** Implementation of the setLabelMultiComboBoxVirtues method.
*
* Implementation of the setLabelMultiComboBoxVirtues method
* Method displaying Plus and Minus on the buttons
*
*
*/
void vampireGameproject::Gui::setLabelMultiComboBoxVirtues(){
virtuesInput.setLabelMultiComboBox();
}
/** Implementation of the setLabelMultiComboBoxDisciplines method.
*
* Implementation of the setLabelMultiComboBoxDisciplines method
* Method displaying Plus and Minus on the buttons
*
*
*/
void vampireGameproject::Gui::setLabelMultiComboBoxDisciplines(){
disciplinesInput.setLabelMultiComboBox();
}
/** Implementation of the setLabelMultiComboBoxMeritsFlaws method.
*
* Implementation of the setLabelMultiComboBoxMeritsFlaws method
* Method displaying Plus and Minus on the buttons
*
*
*/
void vampireGameproject::Gui::setLabelMultiComboBoxMeritsFlaws(){
meritsFlawsInput.setLabelMultiComboBox();
}
/** Implementation of the returnAttributesInput method.
*
* Implementation of the returnAttributesInput method
* Method returning a reference of ButtonMultiInput associated
* to Attributes */
vampireGameproject::ButtonmultiInput& vampireGameproject::Gui::returnAttributesInput(){
return attributesInput;
}
/** Implementation of the returnAbilitiesInput method.
*
* Implementation of the returnAbilitiesInput method
* Method returning a reference of ButtonMultiInput associated
* to Abilties */
vampireGameproject::ButtonmultiInput& vampireGameproject::Gui::returnAbilitiesInput(){
return abilitiesInput;
}
/** Implementation of the returnDisciplinesInput method.
*
* Implementation of the returnDisciplinesInput method
* Method returning a reference of ButtonMultiInput associated
* to Disciplines */
vampireGameproject::ButtonmultiInput& vampireGameproject::Gui::returnDisciplinesInput(){
return disciplinesInput;
}
/** Implementation of the returnMeritsFlaws method.
*
* Implementation of the returnMeritsFlaws method
* Method returning a reference of ButtonMultiInput associated
* to MeritsFlaws */
vampireGameproject::ButtonmultiInput& vampireGameproject::Gui::returnMeritsFlawsInput(){
return meritsFlawsInput;
}
/** Implementation of the returnBackgroundsInput method.
*
* Implementation of the returnAttributesInput method
* Method returning a reference of ButtonMultiInputOneComboBox associated
* to Backgrounds */
vampireGameproject::ButtonmultiInputOneComboBox& vampireGameproject::Gui::returnBackgroundsInput(){
return backgroundsInput;
}
/** Implementation of the returnVirtuesInput method.
*
* Implementation of the returnVirtuesInput method
* Method returning a reference of ButtonMultiInput associated
* to Virtues */
vampireGameproject::ButtonmultiInputOneComboBox& vampireGameproject::Gui::returnVirtuesInput(){
return virtuesInput;
}
/** Implementation of the setMultiInputOnGrid method.
*
* Implementation of the setMultiInputOnGrid method
* Method displaying new MultiInput on the GUI
*
* @param ButtonMultiInputReference: Reference of the ButtonMultiInput object
* @param number: number of the MultiInput in the MultiInput vector
*/
void vampireGameproject::Gui::setMultiInputOnGrid(ButtonmultiInput& ButtonMultiInputReference, int number){
mainGrid.attach(ButtonMultiInputReference.returnVectorMultiInput()[number]->returnComboBox("first"), ButtonMultiInputReference.returnXCoordinate(), ButtonMultiInputReference.returnYCoordinate() + number, 1, 1);
mainGrid.attach_next_to(ButtonMultiInputReference.returnVectorMultiInput()[number]->returnComboBox("second"), ButtonMultiInputReference.returnVectorMultiInput()[number]->returnComboBox("first"), Gtk::POS_RIGHT, 1, 1);
mainGrid.attach_next_to(ButtonMultiInputReference.returnVectorMultiInput()[number]->returnSpinButton(), ButtonMultiInputReference.returnVectorMultiInput()[number]->returnComboBox("second"), Gtk::POS_RIGHT, 1, 1);
mainGrid.show_all();
}
/** Implementation of the setMultiInputOneComboBoxOnGrid method.
*
* Implementation of the setMultiInputOneComboBoxOnGrid method
* Method displaying new MultiInput on the GUI
*
* @param ButtonmultiInputOneComboBoxReference: Reference of the ButtonMultiInputOneComboBox object
* @param number: number of the MultiInputOneComboBox in the MultiInputOneComboBox vector
*/
void vampireGameproject::Gui::setMultiInputOneComboBoxOnGrid(ButtonmultiInputOneComboBox& ButtonmultiInputOneComboBoxReference, int number){
mainGrid.attach(ButtonmultiInputOneComboBoxReference.returnVectorMultiInput()[number]->returnComboBox(), ButtonmultiInputOneComboBoxReference.returnXCoordinate(), ButtonmultiInputOneComboBoxReference.returnYCoordinate() + number, 1, 1);
mainGrid.attach_next_to(ButtonmultiInputOneComboBoxReference.returnVectorMultiInput()[number]->returnSpinButton(), ButtonmultiInputOneComboBoxReference.returnVectorMultiInput()[number]->returnComboBox(), Gtk::POS_RIGHT, 1, 1);
mainGrid.show_all();
}
/** Implementation of the deleteMultiInputOnGrid method.
*
* Implementation of the deleteMultiInputOnGrid method
* Method deletng the last MultiInput from the Gui
*
* @param ButtonMultiInputReference: Reference of the ButtonMultiInput object
* @param number: number of the MultiInput in the MultiInput vector
*/
void vampireGameproject::Gui::deleteMultiInputOnGrid(ButtonmultiInput& ButtonMultiInputReference, int number){
mainGrid.remove(ButtonMultiInputReference.returnVectorMultiInput()[number]->returnComboBox("first"));
mainGrid.remove(ButtonMultiInputReference.returnVectorMultiInput()[number]->returnComboBox("second"));
mainGrid.remove(ButtonMultiInputReference.returnVectorMultiInput()[number]->returnSpinButton());
}
/** Implementation of the deleteMultiInputOneComboBoxOnGrid method.
*
* Implementation of the deleteMultiInputOneComboBoxOnGrid method
* Method deletng the last MultiInputOneComboBox from the Gui
*
* @param ButtonmultiInputOneComboBoxReference: Reference of the ButtonMultiInputOneComboBox object
* @param number: number of the MultiInputOneComboBox in the MultiInputOneComboBox vector
*/
void vampireGameproject::Gui::deleteMultiInputOneComboBoxOnGrid(ButtonmultiInputOneComboBox& ButtonmultiInputOneComboBoxReference, int number){
mainGrid.remove(ButtonmultiInputOneComboBoxReference.returnVectorMultiInput()[number]->returnComboBox());
mainGrid.remove(ButtonmultiInputOneComboBoxReference.returnVectorMultiInput()[number]->returnSpinButton());
}
/** Implementation of the returnLabelVampireNickName method.
*
* Implementation of the returnLabelVampireNickName method
* Method returning the Label associated to the Vampire Nick Name*/
Gtk::Label& vampireGameproject::Gui::returnLabelVampireNickName(){
return tableLabel[2];
}
/** Implementation of the setNickNameLabel method.
*
* Implementation of the setNickNameLabel method
* Method setting the Label associated to the Vampire Nick Name
* on the Gui*/
void vampireGameproject::Gui::setNicknameLabel(){
mainGrid.attach_next_to(tableLabel[2], tableLabel[0], Gtk::POS_RIGHT, 1, 1);
}
/** Implementation of the setTextNicknameLabel method.
*
* Implementation of the setTextNicknameLabel method
* Method updating the Label text associated to the Vampire Nick Name
* on the Gui
*
* @param textToAdd: text to add to the Nickname Label
*/
void vampireGameproject::Gui::setTextNicknameLabel(std::string textToAdd){
tableLabel[2].set_text(textToAdd);
}
/** Implementation of the showAll method.
*
* Implementation of the showAll method
* Method initiating the display of all the elements
* on the GUI
*
*
*/
void vampireGameproject::Gui::showAll(){
mainGrid.show_all();
Gui::add(mainGrid);
Gui::show_all_children();
}
/** Implementation of the setFileChooser method.
*
* Implementation of the setFileChooser method
* Method initiating the file chooser when user
* choices are submitted
*
*
*/
std::string vampireGameproject::Gui::setFileChooser(){
Gtk::FileChooserDialog* fileToSave = new Gtk::FileChooserDialog("Please choose a folder",
Gtk::FILE_CHOOSER_ACTION_SAVE);
fileToSave->set_transient_for(*this);
fileToSave->add_button("_Cancel", Gtk::ResponseType::RESPONSE_CANCEL);
fileToSave->add_button("Select", Gtk::ResponseType::RESPONSE_OK);
int result = fileToSave->run();
std::string filenameToReturn;
switch(result){
case Gtk::ResponseType::RESPONSE_OK:
filenameToReturn = fileToSave->get_filename();
break;
case Gtk::ResponseType::RESPONSE_CANCEL:
filenameToReturn = "";
break;
default:
filenameToReturn = "";
break;
}
delete fileToSave;
return filenameToReturn;
}
/** Implementation of the initialiseEntryName method.
*
* Implementation of the initialiseEntryName method
* Method initiating the Entry Name on the GUI
*
*
*/
void vampireGameproject::Gui::initialiseEntryName(){
mainGrid.attach_next_to(NameEntry, tableLabel[1], Gtk::POS_RIGHT, 1, 1);
}
/** Implementation of the returnPlayerName method.
*
* Implementation of the returnPlayerName method
* Method returning the Player Name from the Entry Widget
* on the Gui
*
*/
std::string vampireGameproject::Gui::returnPlayerName(){
return NameEntry.get_text();
}