+
+ return new;
+}
+
+void Widget_SetFocus(tWidgetWin *Info, tElement *Ele)
+{
+ // TODO: Callbacks
+
+ Info->FocusedElement = Ele;
+}
+
+
+// --- Message Handlers ---
+int Widget_IPC_Create(tWindow *Win, size_t Len, const void *Data)
+{
+ tWidgetWin *Info = Win->RendererInfo;
+ const tWidgetIPC_Create *Msg = Data;
+ const int max_debugname_len = Len - sizeof(*Msg);
+ tElement *parent;
+
+ // Sanity check
+ if( Len < sizeof(*Msg) )
+ return -1;
+ if( strnlen(Msg->DebugName, max_debugname_len) == max_debugname_len )
+ return -1;
+
+ _SysDebug("Widget_NewWidget (%i %i Type %i Flags 0x%x)",
+ Msg->Parent, Msg->NewID, Msg->Type, Msg->Flags);
+
+ if(Msg->Type >= ciWM_NumWidgetTypes)
+ {
+ _SysDebug("Widget_NewWidget - Bad widget type %i", Msg->Type);
+ return 1;
+ }
+
+ // Create
+ parent = Widget_GetElementById(Info, Msg->Parent);
+ if(!parent)
+ {
+ _SysDebug("Widget_NewWidget - Bad parent ID %i", Msg->Parent);
+ return 1;
+ }
+
+ Widget_int_Create(Info, parent, Msg->NewID, Msg->Type, Msg->Flags);
+
+ Widget_UpdateMinDims(parent);
+ return 0;
+}