-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (43 loc) · 1.51 KB
/
main.cpp
File metadata and controls
56 lines (43 loc) · 1.51 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
#include <iostream>
#include <Application.h>
#include <Window.h>
#include <Button.h>
#include <CheckBox.h>
#include <Slider.h>
#include <Panel.h>
#include <ComboBox.h>
#include <Label.h>
#include <Border.h>
int main(int argc, char** argv) {
auto window = Window::construct();
window->set_size(900, 600);
window->set_title("Hello, from c++");
// window->set_resizable(true);
auto panel = Panel::construct(window);
panel->set_border(Border::OUTSET_BEVEL);
panel->set_layout(Layout::HORIZONTAL);
auto btn0 = Button::construct(panel);
btn0->set_text("Click ME");
auto slider = Slider::construct(panel);
slider->set_value(50);
slider->set_width(150);
auto panel2 = Panel::construct(panel);
panel2->set_border(Border::INSET_BEVEL);
panel2->set_layout(Layout::VERTICAL);
auto btn = Button::construct(panel2);
btn->set_text("Click ME");
auto check_box = CheckBox::construct(panel2);
check_box->set_text("Ayo");
auto combo_box = ComboBox::construct(panel2);
combo_box->add_option("Joburg");
combo_box->add_option("Durban");
combo_box->add_option("Polokwane");
combo_box->add_option("Cape Town");
combo_box->on_select([](auto event) {
auto widget = event.trigger_widget();
std::cout << widget->selected_option() << " :" <<
widget->selected_option_index() << std::endl;
});
auto label = Label::construct(panel2);
return Application::run(argc, argv);
}