The convention is that the constructor and destructor of a C++ class occur first. This is not the case here, so it should be fixed to avoid distracting developers with unique oddities.
The confusing location has been the case since introduction of CGUI in rP9.
Notice that it would be worth to achieve removing ConstructObject, GUI_OBJECT macro and those #include "gui/ObjectTypes/ includes in CGUI.cpp.
However everytime I attempt to do that, I fail to achieve it, or fail to acheive it in a way that is actually different from what it is now, since
(1) either the IGUIObject inheriting classes need to inform the CGUI class in a static way that they exist or
(2) the CGUI class needs to keep a hardcoded list of IGUIObjects that exist.
The latter is whats being done currently and has the disadvantage that it makes CGUI require to include all headers of IGUIObject inheriting classes despite never using them anywhere except for ConstructObject.
The former doesnt seem feasible, since the map would be created at compiletime but we can't do ObjectTypes["button"] = &CButton::ConstructObject; at compiletime.
Nor can we do it at CGUI construction time since we dont have a place to hook in unless its a CGUI member, which defeats the purpose of decoupling CGUI from IGUIObjects again.
Hence in this diff Im moving it to an own file at least, so that the headers and the users are right above each other, so that it becomes visible that these are the only users, and for similarity with the GUISettingTypes.h file.