changeset 2888:ec0d34798706

iOS: Allow dw_window_s/get_data() on menu items.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 22 Dec 2022 19:08:39 +0000
parents e8d28682f6bd
children 4b075e64536c
files ios/dw.m
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Thu Dec 22 18:48:57 2022 +0000
+++ b/ios/dw.m	Thu Dec 22 19:08:39 2022 +0000
@@ -734,6 +734,7 @@
     BOOL check, enabled;
     unsigned long tag;
     DWMenu *submenu, *menu;
+    void *userdata;
 }
 -(void)setCheck:(BOOL)input;
 -(void)setEnabled:(BOOL)input;
@@ -745,6 +746,8 @@
 -(BOOL)check;
 -(BOOL)enabled;
 -(unsigned long)tag;
+-(void *)userdata;
+-(void)setUserdata:(void *)input;
 -(void)dealloc;
 @end
 
@@ -1812,7 +1815,9 @@
 -(DWMenu *)submenu { return submenu; }
 -(DWMenu *)menu { return menu; }
 -(unsigned long)tag { return tag; }
--(void)dealloc { dw_signal_disconnect_by_window(self); [super dealloc]; }
+-(void *)userdata { return userdata; }
+-(void)setUserdata:(void *)input { userdata = input; }
+-(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; }
 @end
 /*
  * Encapsulate immutable objects in our own containers,