core/vgui/vgui_register_all.cxx
Go to the documentation of this file.
00001 // This is core/vgui/vgui_register_all.cxx
00002 
00003 //:
00004 // \file
00005 // \author fsm
00006 //
00007 // Toolkits are registered by registering a "tag function" at
00008 // library initialization time. That usually works fine with
00009 // shared builds on sane architectures, but it doesn't work
00010 // for static builds and for shared builds on certain architectures.
00011 //
00012 // Thus, explicitly calling toolkit tag functions is currently
00013 // unavoidable. The purpose of this file is to keep all that
00014 // hackery in one place. The mere act of including this file
00015 // from the source file containing main() will result in tag
00016 // functions being registered before main() is entered.
00017 //
00018 // vgui is supposed to be cross-platform and xcv was supposed
00019 // to work with all toolkits, not just mfc and gtk, even if they
00020 // are the most important ones. So try not to remove stuff unless
00021 // there is a good reason which you are willing to document next
00022 // to the change.
00023 //
00024 // The vgui::select() mechanism should make it unnecessary to
00025 // comment out toolkits merely to stop them being initialized.
00026 // If that mechanism doesn't work, the problem should be fixed
00027 // in vgui.cxx, not here.
00028 //
00029 // Note that vgui::select() and vgui::init() will automatically
00030 // invoke vgui_tag_call() so it is unnecessary to do so here.
00031 //
00032 // This used to be vgui_linker_hack.h. Since it is impossible portably
00033 // to do the link-time checking of toolkit implementations, I've
00034 // changed things to a compile time check. Thus, this function is
00035 // called on all platforms to initialise whatever toolkits where
00036 // compiled when the base vgui was compiled. As things stand, you
00037 // could still link in an unknown implementation at link time and, if
00038 // you have shared libraries, the unknown toolkit will probably be
00039 // linked in and initialised. However, you're on your own if you
00040 // attempt this. -- Amitha Perera.
00041 
00042 #include <vgui/vgui_config.h>
00043 
00044 extern int vgui_gtk_tag_function();
00045 extern int vgui_gtk2_tag_function();
00046 extern int vgui_glut_tag_function();
00047 extern int vgui_mfc_tag_function();
00048 extern int vgui_wx_tag_function();
00049 extern int vgui_fltk_tag_function();
00050 extern int vgui_glX_tag_function();
00051 extern int vgui_Xm_tag_function();
00052 extern int vgui_qt_tag_function();
00053 extern int vgui_SDL_tag_function();
00054 extern int vgui_accelerate_x11_tag_function();
00055 extern int vgui_win32_tag_function();
00056 //extern int vgui_accelerate_mfc_tag_function();
00057 
00058 //: Registers all the available toolkit implementations.
00059 // This function is called from vgui.cxx.
00060 int vgui_register_all_implementations()
00061 {
00062 #ifdef VGUI_USE_GTK
00063   vgui_gtk_tag_function();
00064 #endif
00065 #ifdef VGUI_USE_GTK2
00066   vgui_gtk2_tag_function();
00067 #endif
00068 #if VGUI_MESA
00069   vgui_accelerate_x11_tag_function();
00070 #endif
00071 #ifdef VGUI_USE_MFC
00072   vgui_mfc_tag_function();
00073   //vgui_accelerate_mfc_tag_function();
00074 #endif
00075 #ifdef VGUI_USE_WX
00076   vgui_wx_tag_function();
00077 #endif
00078 #ifdef VGUI_USE_FLTK
00079   vgui_fltk_tag_function();
00080 #endif
00081 #ifdef VGUI_USE_GLX
00082   vgui_glX_tag_function();
00083 #endif
00084 #ifdef VGUI_USE_MOTIFGL
00085   vgui_Xm_tag_function();
00086 #endif
00087 #ifdef VGUI_USE_QT
00088   vgui_qt_tag_function();
00089 #endif
00090 #ifdef VGUI_USE_SDL
00091   vgui_SDL_tag_function();
00092 #endif
00093 #ifdef VGUI_USE_GLUT
00094   vgui_glut_tag_function();
00095 #endif
00096 #ifdef VGUI_USE_WIN32SDK
00097   vgui_win32_tag_function();
00098 #endif
00099 
00100   return 0;
00101 }