RegistryGui Class Reference

#include <RegistryGui.h>

Inheritance diagram for RegistryGui:
GuiBox GuiCompositeFrameBase GuiBase

List of all members.

Public Member Functions

 RegistryGui (TGWindow &parent)
virtual ~RegistryGui ()
void SetRegistry (const Registry &reg)
Registry GetRegistry () const
void SetPossibles (Registry reg)
void SetPossiblesMenu (const char *label, Registry reg)

Private Member Functions

 RegistryGui (const RegistryGui &rhs)
RegistryGuioperator= (const RegistryGui &rhs)

Private Attributes

GuiGroupfGroup
GuiMultiEntryfMultiEntry
std::map< const char
*, RegistryGui * > 
fSubRegGuis

Detailed Description

Id
RegistryGui.h,v 1.2 2002/11/15 22:36:17 bv Exp

Definition at line 28 of file RegistryGui.h.


Constructor & Destructor Documentation

RegistryGui::RegistryGui ( TGWindow &  parent  ) 

Definition at line 17 of file RegistryGui.cxx.

References GuiCompositeFrameBase::Add(), fGroup, and fMultiEntry.

Referenced by SetRegistry().

00018     : GuiBox(parent,kVerticalFrame)
00019     , fGroup(0)
00020     , fMultiEntry(0)
00021 {
00022     fGroup = manage(new GuiGroup(*this,""));
00023     this->Add(*fGroup);
00024 
00025     fMultiEntry = manage(new GuiMultiEntry(*fGroup));
00026     fGroup->Add(*fMultiEntry);
00027         
00028 }

RegistryGui::~RegistryGui (  )  [virtual]

Definition at line 30 of file RegistryGui.cxx.

00031 {
00032 }

RegistryGui::RegistryGui ( const RegistryGui rhs  )  [private]

Member Function Documentation

Registry RegistryGui::GetRegistry (  )  const

Definition at line 61 of file RegistryGui.cxx.

References done(), fGroup, fMultiEntry, fSubRegGuis, GuiMultiEntry::GetEntries(), it, Registry::ReadStream(), reg, and Registry::Set().

Referenced by apply_reg_gui(), and get_and_spew().

00062 {
00063     Registry reg(false);
00064     
00065     stringstream ss;
00066     ss << "['" << fGroup->GetTitle() << "'";
00067 
00068     GuiMultiEntry::EntryMap_t emap = fMultiEntry->GetEntries();
00069     GuiMultiEntry::EntryMap_t::iterator it, done = emap.end();
00070 
00071     for (it = emap.begin(); it != done; ++it) {
00072         ss << " " << it->first << it->second->GetText();
00073     }
00074     ss << "]" << ends;
00075 
00076     reg.ReadStream(ss);
00077 
00078     map<const char*,RegistryGui*>::const_iterator mit, mdone = fSubRegGuis.end();
00079     for (mit = fSubRegGuis.begin(); mit != mdone; ++mit) {
00080         Registry subreg = mit->second->GetRegistry();
00081         reg.Set(mit->first,subreg);
00082     }
00083 
00084     return reg;
00085 }

RegistryGui& RegistryGui::operator= ( const RegistryGui rhs  )  [private]
void RegistryGui::SetPossibles ( Registry  reg  ) 

Definition at line 129 of file RegistryGui.cxx.

References done(), extract_key(), fMultiEntry, fSubRegGuis, Registry::Get(), GuiMultiEntry::GetEntries(), GuiBase::GetMainWindow(), it, and SetPossiblesMenu().

Referenced by add_option_reg(), GfxCfg::GuiConfig(), and CheezyPage::SpawnConfigurator().

00130 {
00131     GuiMultiEntry::EntryMap_t emap = fMultiEntry->GetEntries();
00132     GuiMultiEntry::EntryMap_t::iterator it, done = emap.end();
00133 
00134 //    cerr << "RegistryGui::SetPossibles with reg = \n" << reg << endl;
00135 
00136     for (it = emap.begin(); it != done; ++it) {
00137         string label = it->first;
00138         Registry r;
00139         const char* key_string = extract_key(label).c_str();
00140         if (!reg.Get(key_string,r)) {
00141 //            cerr << "Failed to get for \"" << key_string << "\"\n";
00142             continue;
00143         }
00144         this->SetPossiblesMenu(label.c_str(),r);
00145     }
00146     map<const char*,RegistryGui*>::const_iterator mit, mdone = fSubRegGuis.end();
00147     for (mit = fSubRegGuis.begin(); mit != mdone; ++mit) {
00148         Registry r;
00149         if (!reg.Get(mit->first, r)) continue;
00150         mit->second->SetPossibles(r);
00151     }
00152 
00153     GuiMainWindow* gmw = this->GetMainWindow();
00154     if (!gmw) return;
00155     gmw->Layout();
00156 }

void RegistryGui::SetPossiblesMenu ( const char *  label,
Registry  reg 
)

Definition at line 93 of file RegistryGui.cxx.

References GuiCompositeFrameBase::Add(), GuiMenu::Add(), entry_updater(), fMultiEntry, GuiMultiEntry::GetBoxes(), GuiMultiEntry::GetEntries(), Registry::GetValueAsString(), Registry::Key(), GuiMenuBar::MakeAddMenu(), and GuiCompositeFrameBase::Show().

Referenced by SetPossibles().

00094 {
00095     GuiMultiEntry::BoxMap_t bm = fMultiEntry->GetBoxes();
00096     GuiMultiEntry::BoxMap_t::iterator bit = bm.find(label);
00097     if (bit == bm.end()) return;
00098     GuiBox* box = bit->second;
00099     
00100     GuiMultiEntry::EntryMap_t em = fMultiEntry->GetEntries();
00101     GuiMultiEntry::EntryMap_t::iterator eit = em.find(label);
00102     if (eit == em.end()) return;
00103     GuiTextEntry* entry = eit->second;
00104 
00105 //    cerr << "Adding menu to " << label << endl;
00106 
00107     GuiMenuBar* menubar = manage(new GuiMenuBar(*box));
00108     box->Add(*menubar);
00109     box->Show(*menubar);
00110     GuiMenu* menu = manage(menubar->MakeAddMenu(reg.GetName()));
00111 
00112     Registry::RegistryKey key = reg.Key();
00113     const char* kstr;
00114     while ( (kstr=key()) ) {
00115 //        cerr << "\tAdding " << reg.GetValueAsString(kstr) << " for " << kstr << endl;
00116 
00117         menu->Add(kstr,bind(slot(entry_updater),entry,reg.GetValueAsString(kstr)));
00118     }
00119 }

void RegistryGui::SetRegistry ( const Registry reg  ) 

Definition at line 34 of file RegistryGui.cxx.

References GuiCompositeFrameBase::Add(), GuiMultiEntry::AddEntry(), fGroup, fMultiEntry, fSubRegGuis, Registry::Get(), Registry::GetTypeAsString(), Registry::GetValueAsString(), Registry::Key(), RegistryGui(), and SetRegistry().

Referenced by PageDisplay::CandidateNames(), GfxCfg::GuiConfig(), main(), SetRegistry(), and CheezyPage::SpawnConfigurator().

00035 {
00036     fGroup->SetTitle(reg.GetName());
00037     Registry::RegistryKey rk = reg.Key();
00038     const char* key;
00039     while ( (key = rk()) ) {
00040         string type = reg.GetTypeAsString(key);
00041 
00042         if (type == "Registry") {
00043             Registry subreg;
00044             if (!reg.Get(key,subreg)) continue;
00045 
00046             RegistryGui* rg = manage(new RegistryGui(*fGroup));
00047             fGroup->Add(*rg);
00048             rg->SetRegistry(subreg);
00049             fSubRegGuis[key] = rg;
00050         }
00051         else {
00052             stringstream label;
00053             label << "'" << key << "'=(" << type << ")" << ends;
00054             string value = reg.GetValueAsString(key);
00055             fMultiEntry->AddEntry(label.str().c_str(),value.c_str());
00056         }
00057     }
00058 }


Member Data Documentation

Definition at line 48 of file RegistryGui.h.

Referenced by GetRegistry(), RegistryGui(), and SetRegistry().

Definition at line 49 of file RegistryGui.h.

Referenced by GetRegistry(), RegistryGui(), SetPossibles(), SetPossiblesMenu(), and SetRegistry().

std::map<const char*, RegistryGui*> RegistryGui::fSubRegGuis [private]

Definition at line 50 of file RegistryGui.h.

Referenced by GetRegistry(), SetPossibles(), and SetRegistry().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1