Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Midad/MultiPage/GfxCfg.cxx

Go to the documentation of this file.
00001 #include "GfxCfg.h"
00002 
00003 #include <Midad/Gui/GuiMainWindow.h>
00004 #include <Midad/Gui/GuiButton.h>
00005 #include <Midad/Gui/GuiBox.h>
00006 
00007 #include <Midad/Base/RegistryGui.h>
00008 #include <Midad/Base/RegistryDialog.h>
00009 
00010 GfxCfg::GfxCfg() 
00011 {
00012 }
00013 
00014 GfxCfg::~GfxCfg()
00015 {
00016 }
00017 
00018 void GfxCfg::Config(void) 
00019 {
00020 //    cerr << "GfxCfg::Config()\n";
00021     this->modified_signal.emit();
00022 }
00023 
00024 
00025 const Registry& GfxCfg::GetPossibles()
00026 {
00027     return fPossibles;
00028 }
00029     
00030 void GfxCfg::SetPossibles(const Registry& reg)
00031 {
00032     fPossibles = reg;
00033 }
00034 
00035 static void apply_reg_gui(GfxCfg* cfg, RegistryGui* rg)
00036 {
00037 //    cerr << "apply_reg_gui\n";
00038     cfg->GetConfig() = rg->GetRegistry();
00039     cfg->Update();
00040 }
00041 
00042 void GfxCfg::GuiConfig()
00043 {
00044 #if 0
00045     GuiMainWindow* mw = new GuiMainWindow(100,300);
00046 
00047     RegistryGui* rg = manage(new RegistryGui(*mw));
00048     mw->Add(*rg);
00049 
00050     GuiBox* box = manage(new GuiBox(*mw,kHorizontalFrame));
00051     box->SetLayoutHints(kLHintsExpandX);
00052     mw->Add(*box);
00053 
00054     GuiTextButton* apply = manage(new GuiTextButton(*box,"Apply"));
00055     box->Add(*apply);
00056     apply->clicked.connect(bind(slot(apply_reg_gui),this,rg));
00057 
00058     GuiTextButton* okay = manage(new GuiTextButton(*box,"Okay"));
00059     box->Add(*okay);
00060     okay->clicked.connect(bind(slot(apply_reg_gui),this,rg));
00061     okay->clicked.connect(slot(*mw,&GuiMainWindow::SendCloseMessage));
00062 
00063     GuiTextButton* cancel = manage(new GuiTextButton(*box,"Cancel"));
00064     box->Add(*cancel);
00065     cancel->clicked.connect(slot(*mw,&GuiMainWindow::SendCloseMessage));
00066 
00067     rg->SetRegistry(this->GetConfig());
00068     rg->SetPossibles(this->GetPossibles());
00069 
00070     mw->ShowAll();
00071     mw->ConnectClose(true);
00072     mw->Resize(mw->GetDefaultWidth(),mw->GetDefaultHeight());
00073 #else
00074     RegistryDialog rd;
00075     rd.fApply->clicked.connect(bind(slot(apply_reg_gui),this,rd.fRegistryGui));
00076     rd.fOkay->clicked.connect(bind(slot(apply_reg_gui),this,rd.fRegistryGui));
00077 
00078     rd.fRegistryGui->SetRegistry(this->GetConfig());
00079     rd.fRegistryGui->SetPossibles(this->GetPossibles());
00080 
00081     rd.Spawn();
00082 #endif
00083 }
00084 

Generated on Mon Feb 15 11:06:46 2010 for loon by  doxygen 1.3.9.1