Debian Codegraph @

Source/Widgets/TriggerIdAndLocation.cpp

raw
1 /*
2 * TriggerIdAndLocation.cpp
3 *
4 * Created on: 4 Dec 2016
5 * Author: jeremy
6 */
7
8 #include "TriggerIdAndLocation.h"
9
10 namespace Widgets
11 {
12
13 TriggerIdAndLocation::TriggerIdAndLocation(const std::vector<std::string>& locations, const std::vector<int>& triggersIds)
14 : locationLabel("Location: "), triggerIdLabel("Trigger Id: "), location(true), triggerId(true)
15 {
16
17
18 this->set_halign(Gtk::Align::ALIGN_FILL);
19 this->set_column_spacing(4);
20
21 // Add locations
22 for(const auto& l : locations)
23 {
24 location.append(l);
25 }
26 location.set_active(0);
27
28 // Add triggers ids
29 for(const auto& i : triggersIds)
30 {
31 triggerId.append(std::to_string(i));
32 }
33 triggerId.set_active(0);
34
35 // Add location label
36 locationLabel.set_halign(Gtk::Align::ALIGN_CENTER);
37 locationLabel.show();
38 this->attach(locationLabel, 0, 0, 1, 1);
39
40 // Add location combobox
41 location.set_halign(Gtk::Align::ALIGN_CENTER);
42 location.get_entry()->set_width_chars(16);
43 location.show();
44 this->attach_next_to(location, locationLabel, Gtk::PositionType::POS_RIGHT, 1, 1);
45
46 // Add id label
47 triggerIdLabel.set_halign(Gtk::Align::ALIGN_CENTER);
48 triggerIdLabel.show();
49 this->attach_next_to(triggerIdLabel, location, Gtk::PositionType::POS_RIGHT, 1, 1);
50
51 // Add id combobox
52 triggerId.set_halign(Gtk::Align::ALIGN_CENTER);
53 triggerId.get_entry()->set_width_chars(2);
54 triggerId.show();
55 this->attach_next_to(triggerId, triggerIdLabel, Gtk::PositionType::POS_RIGHT, 1, 1);
56
57
58 this->show();
59
60 return;
61 }
62
63 } /* namespace Widgets */