From 739cdf428f24bb50054d422e0ca7a934a65cc32b Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Sun, 17 May 2026 11:07:22 +0200 Subject: [PATCH] add UiContext call_action method --- ui-rs/src/ui/toolkit.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ui-rs/src/ui/toolkit.rs b/ui-rs/src/ui/toolkit.rs index d701ced..050dd1b 100644 --- a/ui-rs/src/ui/toolkit.rs +++ b/ui-rs/src/ui/toolkit.rs @@ -107,6 +107,13 @@ impl UiContext { let cstr = CString::new(name).unwrap(); ui_add_action(self.ptr, cstr.as_ptr(), Some(action_event_wrapper::), ptr as *mut c_void); } + + pub fn call_action(&self, action: &str) { + let cstr = CString::new(action).unwrap(); + unsafe { + ui_call_action(self.ptr, cstr.as_ptr()); + } + } } pub extern "C" fn destroy_boxed(data: *mut c_void) { @@ -208,10 +215,7 @@ impl UiObject { } pub fn call_action(&self, action: &str) { - let cstr = CString::new(action).unwrap(); - unsafe { - ui_call_action(self.ctx.ptr, cstr.as_ptr()); - } + self.ctx.call_action(action); } } -- 2.47.3