raven/src/main.cpp
2022-03-29 07:08:19 +03:00

35 lines
No EOL
897 B
C++

#include "Label.hpp"
#include "Window.hpp"
#include "Widget.hpp"
#include "Button.hpp"
#include "Box.hpp"
#include "Label.hpp"
int main() {
int times_clicked = 0;
Raven::Window window {};
Raven::Widget main_widget {};
Raven::Button button {"click me"};
Raven::Label label {"click it!"};
window.spawn_window();
button.set_current_geometry(Raven::Box(10, 10, 100, 30));
label.set_current_geometry(Raven::Box(10, 45, 100, 20));
main_widget.set_background_fill_color(window.get_top_level_styles()->get_background_color());
main_widget.set_do_background_fill(true);
window.set_main_widget(&main_widget);
button.on_click = [&label, &times_clicked]() {
times_clicked++;
label.set_text(std::to_string(times_clicked));
};
main_widget.add_child(&button);
main_widget.add_child(&label);
window.run(true);
return 0;
}