-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
31 lines (26 loc) · 1.08 KB
/
Copy pathexample.cpp
File metadata and controls
31 lines (26 loc) · 1.08 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
#include <KiteGUI/include>
#include <algorithm>
int main() {
KApplication app;
KWindow window(app, "Hello, KiteGUI!", {800, 600});
KText text(window, "This is a mere example of what you can do with KiteGUI.", {0, 0}, {800, 25});
int counter = 0;
KText counter_text(window, "Button pressed 0 times.", {30, 50}, {300, 50});
KButton button(window, "Click Me!", {30, 100}, {300, 50});
button.onClick([&counter, &counter_text] {
counter++;
counter_text.setText("Button pressed " + std::to_string(counter) + " times.");
});
KTextEdit textEdit(window, "", {30, 200}, {300, 50});
KCheckbox checkbox(window, "Uppercase?", {30, 250}, {100, 30});
checkbox.onChange([&textEdit](bool isChecked) {
std::string original = textEdit.getText();
if (isChecked) {
std::transform(original.begin(), original.end(), original.begin(), ::toupper);
} else {
std::transform(original.begin(), original.end(), original.begin(), ::tolower);
}
textEdit.setText(original);
});
return app.run();
}