2022-03-26 02:57:41 +02:00
|
|
|
#include "Label.hpp"
|
2022-03-08 02:25:22 +02:00
|
|
|
#include "Window.hpp"
|
2022-03-09 20:02:18 +02:00
|
|
|
#include "Widget.hpp"
|
2022-03-09 20:16:05 +02:00
|
|
|
#include "Button.hpp"
|
2022-03-09 20:02:18 +02:00
|
|
|
#include "Box.hpp"
|
2022-03-26 02:57:41 +02:00
|
|
|
#include "Label.hpp"
|
2022-03-30 14:49:31 +03:00
|
|
|
#include "Layout.hpp"
|
2022-04-03 13:25:09 +03:00
|
|
|
#include "src/DocumentLayout.hpp"
|
2022-05-10 16:17:12 +03:00
|
|
|
#include <iostream>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
2022-01-22 17:51:54 +02:00
|
|
|
|
|
|
|
int main() {
|
2022-03-09 03:46:27 +02:00
|
|
|
Raven::Window window {};
|
2022-04-01 07:13:36 +03:00
|
|
|
|
2022-04-24 02:59:47 +03:00
|
|
|
auto main_widget = window.set_main_widget<Raven::Widget>();
|
|
|
|
main_widget->set_layout<Raven::DocumentLayout>(6.0);
|
|
|
|
|
2022-04-01 07:13:36 +03:00
|
|
|
int number = 0;
|
2022-01-22 17:51:54 +02:00
|
|
|
|
2022-05-10 16:17:12 +03:00
|
|
|
for (int i = 0; i < 100; i++) {
|
|
|
|
auto button = main_widget->add<Raven::Button>("0");
|
|
|
|
button->on_click = [&]() {
|
|
|
|
number++;
|
2022-03-20 03:05:21 +02:00
|
|
|
|
2022-05-10 16:17:12 +03:00
|
|
|
for (auto& c : main_widget->children()) {
|
|
|
|
if (c->type() == Raven::WidgetType::Button) {
|
|
|
|
auto button_child = std::static_pointer_cast<Raven::Button>(c);
|
|
|
|
button_child->set_text(std::to_string(number));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2022-04-01 07:13:36 +03:00
|
|
|
|
2022-05-09 23:03:56 +03:00
|
|
|
window.spawn_window();
|
2022-03-09 20:02:18 +02:00
|
|
|
window.run(true);
|
2022-01-22 17:51:54 +02:00
|
|
|
return 0;
|
2022-03-08 02:25:22 +02:00
|
|
|
}
|