ui/ui/toolkit.h

changeset 100
d2bd73d28ff1
parent 90
f501f0efc9a8
--- a/ui/ui/toolkit.h	Fri Nov 29 22:21:36 2024 +0100
+++ b/ui/ui/toolkit.h	Thu Dec 12 20:01:43 2024 +0100
@@ -33,14 +33,13 @@
 
 #ifdef UI_COCOA
 
+#include <stdlib.h>
 #ifdef __OBJC__
 #import <Cocoa/Cocoa.h>
-#define UIWIDGET NSView*
-#define UIMENU   NSMenu*
-#else
-typedef void* UIWIDGET;
-typedef void* UIMENU;
 #endif
+typedef void* UIWIDGET; // NSView*
+typedef void* UIWINDOW; // NSWindow*
+typedef void* UIMENU;   // NSMenu*
 
 #elif UI_GTK2 || UI_GTK3 || UI_GTK4
 
@@ -152,9 +151,10 @@
 #define UI_GROUPS(...) (const int[]){ __VA_ARGS__, -1 }
     
 /* public types */
-typedef int UiBool;
+typedef _Bool UiBool;
 
 typedef struct UiObject     UiObject;
+typedef struct UiContainerX UiContainerX;
 typedef struct UiEvent      UiEvent;
 typedef struct UiMouseEvent UiMouseEvent;
 typedef struct UiObserver   UiObserver;
@@ -215,7 +215,7 @@
      */
     UIWIDGET    widget;
 
-#ifdef UI_WINUI
+#if defined(UI_COCOA) || defined(UI_WINUI)
     /*
      * native window object 
      */
@@ -233,11 +233,18 @@
     UiContext   *ctx;
     
     /*
-     * container interface
+     * container interface (deprecated)
      */
     UiContainer *container;
     
     /*
+     * container list
+     * TODO: remove old UiContainer and rename UiContainerX to UiContainer
+     */
+    UiContainerX *container_begin;
+    UiContainerX *container_end;
+    
+    /*
      * next container object
      */
     UiObject    *next;
@@ -434,13 +441,13 @@
 UIEXPORT void ui_context_destroy(UiContext *ctx);
 
 UIEXPORT void ui_object_ref(UiObject *obj);
-UIEXPORT void ui_object_unref(UiObject *obj);
+UIEXPORT int ui_object_unref(UiObject *obj);
 
 UIEXPORT void ui_onstartup(ui_callback f, void *userdata);
 UIEXPORT void ui_onopen(ui_callback f, void *userdata);
 UIEXPORT void ui_onexit(ui_callback f, void *userdata);
 
-UIEXPORT void ui_main();
+UIEXPORT void ui_main(void);
 UIEXPORT void ui_show(UiObject *obj);
 UIEXPORT void ui_close(UiObject *obj);
 

mercurial