aboutsummaryrefslogtreecommitdiff
path: root/tests/test_main.c
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-05-01 21:38:49 +1200
committerArslaan Pathan <[email protected]>2026-05-01 21:38:49 +1200
commit6ad244502d1c3c09a26012c5e7fad901c95cc38e (patch)
treeb0b8106fca78a49e47313f35d8245eeb6980d3ac /tests/test_main.c
parentccb8f9316c9bc7aded2dd5d74d2e82445bf2f647 (diff)
downloadsaffron-6ad244502d1c3c09a26012c5e7fad901c95cc38e.tar.xz
saffron-6ad244502d1c3c09a26012c5e7fad901c95cc38e.zip
Fix the buttons and implement hooks for future webkit bindings to build on top of
Diffstat (limited to 'tests/test_main.c')
-rw-r--r--tests/test_main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_main.c b/tests/test_main.c
index cb92189..087b32a 100644
--- a/tests/test_main.c
+++ b/tests/test_main.c
@@ -31,6 +31,10 @@ void my_test_onclick(SaffronWidget* self) {
printf("clicked!\n");
}
+static void button_click_handler(SaffronButton* self) {
+ printf("button clicked!\n");
+}
+
int main(void) {
saffron_init();
@@ -61,13 +65,12 @@ int main(void) {
TTF_Font* font = TTF_OpenFont("/usr/share/fonts/fantasque-sans-mono/FantasqueSansMono-Regular.otf", 24);
SaffronText* test3 = saffron_text_new("Mangoes", font);
- /* become lunatic, add custom clickhandler to.. text????????????? */
- ((SaffronWidget*)test3)->on_click = my_test_onclick;
+ SaffronButton* btn = saffron_button_new_with_text(test3, true, &button_click_handler, 200, 150);
saffron_widget_add_child(window->root, test);
saffron_widget_add_child(window->root, box);
saffron_widget_add_child(box, test2);
- saffron_widget_add_child(box, (SaffronWidget*)test3);
+ saffron_widget_add_child(window->root, (SaffronWidget*)btn);
saffron_window_main(window);