From 8328a74720bbc6ec4363b04c9cbf6d0cf74be179 Mon Sep 17 00:00:00 2001 From: Brian Watling Date: Thu, 12 Dec 2024 18:20:22 -0500 Subject: [PATCH] Align C++ event APIs with C event APIs --- nuklear_console.hpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nuklear_console.hpp b/nuklear_console.hpp index 71011bc..3c42431 100644 --- a/nuklear_console.hpp +++ b/nuklear_console.hpp @@ -17,26 +17,16 @@ void nk_console_event_handler_destroy(nk_console*, void* user_data) { } template -void nk_console_set_event_handler(nk_console* widget, nk_console_event_type type, T&& t) { +void nk_console_add_event_handler(nk_console* widget, nk_console_event_type type, T&& t) { void* memory = nk_console_malloc(nk_handle_id(0), NULL, sizeof(T)); T* user_data = new (memory) T(std::move(t)); nk_console_add_event_handler(widget, type, &nk_console_event_handler_call, user_data, &nk_console_event_handler_destroy); } -template -void nk_console_set_onchange_handler(nk_console* widget, T&& t) { - nk_console_set_event_handler(widget, NK_CONSOLE_EVENT_CHANGED, std::move(t)); -} - -template -void nk_console_button_set_onclick_handler(nk_console* button, T&& t) { - nk_console_set_event_handler(button, NK_CONSOLE_EVENT_CLICKED, std::move(t)); -} - template nk_console* nk_console_button_onclick_handler(nk_console* parent, const char* text, T&& t) { nk_console* button = nk_console_button(parent, text); - nk_console_add_event(button, NK_CONSOLE_EVENT_CLICKED, std::move(t)); + nk_console_add_event_handler(button, NK_CONSOLE_EVENT_CLICKED, std::move(t)); return button; }