00001 // This is core/vgui/vgui_toolkit.cxx 00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00003 #pragma implementation 00004 #endif 00005 //: 00006 // \file 00007 // \author fsm 00008 // \brief See vgui_toolkit.h for a description of this file. 00009 00010 #include "vgui_toolkit.h" 00011 00012 #include <vcl_iostream.h> 00013 #include <vcl_cstdlib.h> // for vcl_exit() 00014 #include <vcl_cassert.h> 00015 #include <vcl_algorithm.h> 00016 00017 #include <vul/vul_trace.h> 00018 00019 #include <vgui/vgui_macro.h> 00020 #include <vgui/vgui_window.h> 00021 00022 vcl_vector<vgui_toolkit*> *vgui_toolkit::registry() 00023 { 00024 static vcl_vector<vgui_toolkit*> the_vector; 00025 return &the_vector; 00026 } 00027 00028 vgui_toolkit *vgui_toolkit::lookup(char const *name) 00029 { 00030 vcl_vector<vgui_toolkit*> *vv = registry(); 00031 for (unsigned int i=0; i<vv->size(); ++i) 00032 if ((*vv)[i]->name() == name) 00033 return (*vv)[i]; 00034 vgui_macro_warning << "WARNING : no toolkit with name \'" << name << "\' found.\n"; 00035 return 0; 00036 } 00037 00038 //-------------------------------------------------------------------------------- 00039 00040 vgui_toolkit::vgui_toolkit() 00041 { 00042 vul_trace; 00043 registry()->push_back(this); 00044 vul_trace; 00045 } 00046 00047 vgui_toolkit::~vgui_toolkit() 00048 { 00049 vul_trace; 00050 00051 // deregister 00052 vcl_vector<vgui_toolkit*>::iterator i = vcl_find(registry()->begin(), 00053 registry()->end(), 00054 this); 00055 00056 vul_trace; 00057 assert( i != registry()->end() ); // <-- this is a serious bug 00058 vul_trace; 00059 registry()->erase(i); 00060 vul_trace; 00061 } 00062 00063 // 00064 void vgui_toolkit::init(int &, char **) { } 00065 00066 00067 vgui_window *vgui_toolkit::produce_window(int /*width*/, 00068 int /*height*/, 00069 vgui_menu const & /*menubar*/, 00070 char const* /*title*/) 00071 { 00072 vgui_macro_warning << "no implementation of produce_window supplied\n"; 00073 return 0; 00074 } 00075 00076 vgui_window *vgui_toolkit::produce_window(int /*width*/, 00077 int /*height*/, 00078 char const* /*title*/) 00079 { 00080 vgui_macro_warning << "no implementation of produce_window supplied\n"; 00081 return 0; 00082 } 00083 00084 vgui_dialog_impl *vgui_toolkit::produce_dialog(char const*) 00085 { 00086 vgui_macro_warning << "no implementation of produce_dialog supplied\n"; 00087 return 0; 00088 } 00089 00090 vgui_dialog_extensions_impl *vgui_toolkit::produce_dialog_extension(char const*) 00091 { 00092 vgui_macro_warning << "no implementation of produce_dialog supplied\n"; 00093 return 0; 00094 } 00095 00096 void vgui_toolkit::quit() 00097 { 00098 vgui_macro_warning << "vgui_toolkit::quit() called.\n" 00099 << "calling exit()\n"; 00100 vcl_exit(0); 00101 } 00102 00103 void vgui_toolkit::run() 00104 { 00105 vgui_macro_warning << "no implementation of run supplied\n"; 00106 } 00107 00108 void vgui_toolkit::run_one_event() 00109 { 00110 vgui_macro_warning << "no implementation of run_one_event supplied\n"; 00111 } 00112 00113 00114 void vgui_toolkit::run_till_idle() 00115 { 00116 vgui_macro_warning << "no implementation of run_till_idle supplied\n"; 00117 } 00118 00119 void vgui_toolkit::flush() 00120 { 00121 vgui_macro_warning << "no implementation of flush supplied\n"; 00122 } 00123 00124 void vgui_toolkit::add_event(vgui_event const&) 00125 { 00126 vgui_macro_warning << "no implementation of add_event supplied\n"; 00127 } 00128 00129 void vgui_toolkit::uninit() 00130 { 00131 }