+ tWidgetWindowInfo *info;
+ if(!Window) return NULL;
+
+ info = AxWin3_int_GetDataPtr(Window);
+ if(ID >= info->nElements) return NULL;
+
+ return info->Elements[ID];
+}
+
+uint32_t AxWin3_Widget_int_AllocateID(tWidgetWindowInfo *Info)
+{
+ uint32_t newID;
+ // BUG BUG BUG - Double Allocations! (citation needed)
+ // TODO: Atomicity
+ for( newID = Info->FirstFreeID; newID < Info->nElements; newID ++ )
+ {
+ if( Info->Elements[newID] == NULL )
+ break;
+ }
+ if( newID == Info->nElements )
+ {
+ Info->nElements += ciStepElementCount;
+ Info->Elements = realloc(Info->Elements, sizeof(*Info->Elements)*Info->nElements);
+ newID = Info->nElements - ciStepElementCount;
+ memset( &Info->Elements[newID+1], 0, (ciStepElementCount-1)*sizeof(Info->Elements));
+ _SysDebug("Widget: Expanded to %i and allocated %i", Info->nElements, newID);
+ }
+ else
+ _SysDebug("Widget: Allocated %i", newID);
+ Info->Elements[newID] = (void*)-1;
+
+ return newID;
+
+}
+
+int AxWin3_Widget_MessageHandler(tHWND Window, int MessageID, int Size, void *Data)
+{
+ tAxWin3_Widget *widget;
+
+ switch(MessageID)
+ {
+// case WNDMSG_DESTROY: {
+// return 0; }
+ case MSG_WIDGET_FIRE: {
+ tWidgetMsg_Fire *msg = Data;
+ if(Size < sizeof(*msg)) return -1;
+ widget = AxWin3_Widget_int_GetElementByID(Window, msg->WidgetID);
+ if(widget->Fire) widget->Fire(widget);
+
+ return 1; }
+ case MSG_WIDGET_KEYPRESS: {
+ return 0; }
+ case MSG_WIDGET_MOUSEBTN: {
+ // TODO: Do something
+ return 1; }
+ default:
+ return 0;
+ }