+
+ info->RootElement.Window = ret;
+ info->RootElement.ID = -1;
+
+ AxWin3_ResizeWindow(ret, W, H);
+
+ return ret;
+}
+
+void AxWin3_Widget_DestroyWindow(tHWND Window)
+{
+ // Free all element structures
+
+ // Free array
+
+ // Request window to be destroyed (will clean up any data stored in tHWND)
+}
+
+tAxWin3_Widget *AxWin3_Widget_GetRoot(tHWND Window)
+{
+ tWidgetWindowInfo *info = AxWin3_int_GetDataPtr(Window);
+ return &info->RootElement;
+}
+
+tAxWin3_Widget *AxWin3_Widget_AddWidget(tAxWin3_Widget *Parent, int Type, int Flags, const char *DebugName)
+{
+ int newID;
+ tWidgetWindowInfo *info;
+ tAxWin3_Widget *ret;
+
+ if(!Parent) return NULL;
+
+ info = AxWin3_int_GetDataPtr(Parent->Window);
+
+ newID = AxWin3_Widget_int_AllocateID(info);
+
+ // Create new widget structure
+ ret = calloc(sizeof(tAxWin3_Widget), 1);
+ ret->Window = Parent->Window;
+ ret->ID = newID;
+
+ info->Elements[newID] = ret;
+
+ // Send create widget message
+ {
+ char tmp[sizeof(tWidgetIPC_Create)+1];
+ tWidgetIPC_Create *msg = (void*)tmp;
+ msg->Parent = Parent->ID;
+ msg->NewID = newID;
+ msg->Type = Type;
+ msg->Flags = Flags;
+ msg->DebugName[0] = '\0';
+ AxWin3_SendIPC(ret->Window, IPC_WIDGET_CREATE, sizeof(tmp), tmp);
+ }
+
+ return ret;
+}
+
+tAxWin3_Widget *AxWin3_Widget_AddWidget_SubWindow(tAxWin3_Widget *Parent, tHWND Window, int Flags, const char *DbgName)
+{
+ tWidgetWindowInfo *info = AxWin3_int_GetDataPtr(Parent->Window);
+ int newID = AxWin3_Widget_int_AllocateID(info);
+
+ tAxWin3_Widget *ret = calloc(sizeof(tAxWin3_Widget), 1);
+ ret->Window = Parent->Window;
+ ret->ID = newID;
+ info->Elements[newID] = ret;
+
+ // Send message
+ {
+ char tmp[sizeof(tWidgetIPC_CreateSubWin)+1];
+ tWidgetIPC_CreateSubWin *msg = (void*)tmp;
+ msg->Parent = Parent->ID;
+ msg->NewID = newID;
+ msg->Type = ELETYPE_SUBWIN;
+ msg->Flags = Flags; // TODO: Flags
+ msg->WindowHandle = AxWin3_int_GetWindowID(Window);
+ msg->DebugName[0] = '\0';
+ AxWin3_SendIPC(ret->Window, IPC_WIDGET_CREATESUBWIN, sizeof(tmp), tmp);
+ }
+
+ return ret;
+}
+
+
+void AxWin3_Widget_DelWidget(tAxWin3_Widget *Widget)
+{
+ tWidgetIPC_Delete msg;
+ tWidgetWindowInfo *info = AxWin3_int_GetDataPtr(Widget->Window);
+
+ msg.WidgetID = Widget->ID;
+ AxWin3_SendIPC(Widget->Window, IPC_WIDGET_DELETE, sizeof(msg), &msg);