00001 #include "GfxMCVecListMenu.h" 00002 #include "GfxMCVecList.h" 00003 #include "GfxProxy.h" 00004 00005 #include "EVD.h" 00006 00007 #include <sigc++/sigc++.h> 00008 #include <sigc++/class_slot.h> 00009 using namespace SigC; 00010 00011 #include <list> 00012 #include <iostream> 00013 using namespace std; 00014 00015 extern GfxProxy<GfxMCVecList> gsGfxMCVecListProxy; 00016 00020 GuiMenu* GfxMCVecListMenu::MakeMenu(EVD* /*mp*/) 00021 { 00022 GuiMenu::GuiMenuList::iterator mit; 00023 00024 GuiMenu* gfx_menu = new GuiMenu; 00025 mit = gfx_menu->Add("Hide all"); 00026 (*mit)->Connect(bind(slot_class(*this,&GfxMCVecListMenu::HideAll),gfx_menu,mit)); 00027 00028 //hide at program start 00029 00030 // HideAll(gfx_menu,mit); 00031 00032 return gfx_menu; 00033 } 00034 00035 void GfxMCVecListMenu::HideAll(GuiMenu* menu, GuiMenu::GuiMenuList::iterator mit) 00036 { 00037 NamedFactory& nf = NamedFactory::Instance("Gfx"); 00038 NamedProxy* np = nf.GetProxy("MCVecList"); 00039 00040 GfxProxy<GfxMCVecList>* gp = dynamic_cast<GfxProxy<GfxMCVecList>*>(np); 00041 if (!gp) { 00042 cerr << "Can't get GfxMCVecList proxy\n"; 00043 return; 00044 } 00045 00046 list<GfxMCVecList*> dls = gp->GetInstances(); 00047 list<GfxMCVecList*>::iterator lit, done = dls.end(); 00048 00049 bool tf = ! menu->IsEntryChecked(mit); 00050 00051 menu->CheckEntry(mit,tf); 00052 for (lit = dls.begin(); lit != done; ++lit) 00053 (*lit)->HideVecs(tf); 00054 }
1.3.9.1