toplevel.cpp
Go to the documentation of this file.00001 #include <kapplication.h> 00002 #include <kconfig.h> 00003 00004 00005 #include "toplevel.h" 00006 #include "core.h" 00007 00008 #include "newmainwindow.h" 00009 00010 KDevMainWindow *TopLevel::s_instance = 0; 00011 TopLevel::Mode TopLevel::mode = TopLevel::IDEMode; 00012 00013 bool TopLevel::mainWindowValid() 00014 { 00015 return s_instance != 0; 00016 } 00017 00018 KDevMainWindow *TopLevel::getInstance() 00019 { 00020 if (!s_instance) 00021 { 00022 00023 KConfig *config = kapp->config(); 00024 config->setGroup("UI"); 00025 int mdimode = config->readNumEntry("MDIMode", KMdi::IDEAlMode); 00026 00027 NewMainWindow *mainWindow = new NewMainWindow( 0, "MainWindow", (KMdi::MdiMode)mdimode ); 00028 00029 s_instance = mainWindow; 00030 00031 mainWindow->init(); 00032 00033 kapp->setMainWidget(mainWindow); 00034 } 00035 00036 return s_instance; 00037 } 00038 00039 void TopLevel::invalidateInstance(KDevMainWindow *instance) 00040 { 00041 if ( s_instance == instance ) 00042 s_instance = 0; 00043 }