GuiBase Class Reference

#include <GuiBase.h>

Inheritance diagram for GuiBase:

GuiButtonBase GuiCanvas GuiCompositeFrameBase GuiLabel GuiMenu GuiMenuBar GuiScrolled GuiSliderSignals GuiStatusBar GuiTable GuiTextEntry GuiTextView GuiTree TridGLFrame List of all members.

Public Types

typedef std::list< SigC::Ptr<
GuiBase > > 
ChildrenList

Public Member Functions

 GuiBase ()
virtual ~GuiBase ()
void SetLayoutHints (unsigned int loh)
virtual unsigned int GetLayoutHints ()
void SetName (const char *name)
const char * GetName ()
GuiMainWindowGetMainWindow ()
virtual TGFrame * GetFrame ()

Protected Member Functions

bool AddChild (TGFrame &obj)
void AddObject (TObject *obj)
void LayoutChildren (void)

Protected Attributes

ChildrenList fChildren

Private Attributes

TList * fCleanup
unsigned int fLayoutHints
std::string fName

Detailed Description

Definition at line 30 of file GuiBase.h.


Member Typedef Documentation

typedef std::list<SigC::Ptr<GuiBase> > GuiBase::ChildrenList

Definition at line 39 of file GuiBase.h.


Constructor & Destructor Documentation

GuiBase::GuiBase (  ) 

Definition at line 19 of file GuiBase.cxx.

References fCleanup.

00020     : SigC::Object()
00021     , fCleanup(0)
00022     , fLayoutHints(kLHintsExpandX|kLHintsExpandY)
00023     , fName("GuiBase")
00024 {
00025     fCleanup = new TList;
00026     
00027 #ifdef GUI_DEBUG
00028     ++nguis;
00029     cerr << "GuiBase(), " << nguis << " alive\n";
00030 #endif
00031 }

GuiBase::~GuiBase (  )  [virtual]

Definition at line 33 of file GuiBase.cxx.

References fCleanup, and GetName().

00034 {
00035     if (fCleanup) { 
00036         fCleanup->Delete();
00037         delete fCleanup;
00038     }
00039 
00040     // when fChildren goes out of scope, its elements will be deleted
00041     // if managed() and if no longer referenced.
00042 
00043 #ifdef GUI_DEBUG
00044     --nguis;
00045     cerr << "~GuiBase(\""<<this->GetName()<<"\"), " << nguis << " alive\n";
00046 #endif
00047 }


Member Function Documentation

bool GuiBase::AddChild ( TGFrame &  obj  )  [protected]

Definition at line 74 of file GuiBase.cxx.

References fChildren.

00075 {
00076     GuiBase* child = dynamic_cast<GuiBase*>(&obj);
00077     if (!child) {
00078         cerr << "GuiBase::AddChild: failed to cast child to GuiBase\n";
00079         return false;
00080     }
00081     fChildren.push_back(child);
00082     return true;
00083 }

void GuiBase::AddObject ( TObject *  obj  )  [protected]

Definition at line 85 of file GuiBase.cxx.

References fCleanup.

Referenced by GuiCompositeFrameBase::Add(), GuiMenuBar::AddMenu(), and GuiTable::Attach().

00086 {
00087     fCleanup->Add(obj);
00088 }

TGFrame * GuiBase::GetFrame (  )  [virtual]

Reimplemented in GuiFrame.

Definition at line 106 of file GuiBase.cxx.

Referenced by GuiCompositeFrameBase::Add(), GetMainWindow(), and LayoutChildren().

00107 {
00108     TGFrame* frame = dynamic_cast<TGFrame*>(this);
00109     if (!frame) cerr << "GuiBase::GetFrame, Can't cast to TGFrame\n";
00110     return frame;
00111 }

virtual unsigned int GuiBase::GetLayoutHints (  )  [inline, virtual]

Definition at line 46 of file GuiBase.h.

References fLayoutHints.

Referenced by GuiCompositeFrameBase::Add(), GuiMenuBar::AddMenu(), GuiTable::Attach(), build_table(), main(), and TridAnimator::OpenWindow().

00046 { return fLayoutHints; }

GuiMainWindow * GuiBase::GetMainWindow (  ) 

Definition at line 49 of file GuiBase.cxx.

References GetFrame(), and GetMainWindow().

Referenced by PageDisplay::AddButton(), PageDisplay::AddEntry(), PageDisplay::AddPage(), EVD::Digittext(), GetMainWindow(), handler_menu(), hide_it(), PageDisplay::LoadLib(), EVD::MCtext(), EVD::MCTreetext(), DisplayOptions::OpenDialog(), PageDisplay::OpenFile(), EVD::Recotext(), remove_it(), RegistryGui::SetPossibles(), show_it(), and PageDisplay::UpdateGui().

00050 {
00051     TGFrame* as_frame = this->GetFrame();
00052     if (!as_frame) return 0;
00053 
00054     TGWindow* parent = const_cast<TGWindow*>(as_frame->GetParent());
00055     if (!parent) {
00056         cerr << "We have no parent?!?\n";
00057         return 0;
00058     }
00059     
00060     GuiBase* gb = dynamic_cast<GuiBase*>(parent);
00061     if (!gb) {
00062         cerr << "Parent not a GuiBase\n";
00063         return 0;
00064     }
00065 
00066     GuiMainWindow* mw = dynamic_cast<GuiMainWindow*>(gb);
00067     if (!mw) {
00068         //cerr << "Parent not a main window, recurring\n";
00069         return gb->GetMainWindow();
00070     }
00071     return mw;
00072 }

const char* GuiBase::GetName (  )  [inline]

Definition at line 49 of file GuiBase.h.

References fName.

Referenced by ~GuiBase().

00049 { return fName.c_str(); }

void GuiBase::LayoutChildren ( void   )  [protected]

Reimplemented in MyVBox.

Definition at line 90 of file GuiBase.cxx.

References done(), fChildren, GetFrame(), and LayoutChildren().

Referenced by MyVBox::LayoutChildren(), LayoutChildren(), and GuiMainWindow::ShowAll().

00091 {
00092     ChildrenList::iterator childit, done = fChildren.end();
00093 
00094     for (childit = fChildren.begin(); childit != done; ++childit) {
00095         SigC::Ptr<GuiBase> gptr = *childit;
00096         GuiBase* child = gptr;
00097 //        TGFrame* frame = dynamic_cast<TGFrame*>(c);
00098         TGFrame* frame = child->GetFrame();
00099 //        cerr << "Layout child: " << frame->GetName() << endl;
00100         child->LayoutChildren();
00101         frame->Layout();
00102     }
00103 }

void GuiBase::SetLayoutHints ( unsigned int  loh  )  [inline]

Definition at line 45 of file GuiBase.h.

References fLayoutHints.

Referenced by add_button(), add_spawner(), PageDisplay::AddButton(), build_table(), ParticleDisplay::BuildDisplay(), NueDisplayModule::BuildDisplay(), TridPageDisplay::BuildGUI(), PageDisplay::BuildGUI(), EVD::Digittext(), GuiBox::GuiBox(), GuiCheckButton::GuiCheckButton(), GfxCfg::GuiConfig(), GuiHBox::GuiHBox(), GuiHSlider::GuiHSlider(), GuiMainWindow::GuiMainWindow(), GuiMenu::GuiMenu(), GuiMenuBar::GuiMenuBar(), GuiPicButton::GuiPicButton(), GuiScrolled::GuiScrolled(), GuiSlider::GuiSlider(), GuiStatusBar::GuiStatusBar(), GuiTab::GuiTab(), GuiTable::GuiTable(), GuiTextButton::GuiTextButton(), GuiTextEntry::GuiTextEntry(), GuiTree::GuiTree(), GuiVBox::GuiVBox(), GuiVSlider::GuiVSlider(), main(), PageDisplay::MakeMCTree(), PageDisplay::MakeMCVectors(), EVD::MCtext(), EVD::MCTreetext(), TridAnimator::OpenWindow(), EVD::Recotext(), RegistryDialog::RegistryDialog(), TridAnimator::ShowConfigFrame(), CheezyPage::SpawnConfigurator(), and TestMCTree::SpawnMCTree().

00045 { fLayoutHints = loh; }

void GuiBase::SetName ( const char *  name  )  [inline]

Definition at line 48 of file GuiBase.h.

References fName.

Referenced by GuiButtonBase::GuiButtonBase().

00048 { fName = name; }


Member Data Documentation

ChildrenList GuiBase::fChildren [protected]

Definition at line 68 of file GuiBase.h.

Referenced by GuiTab::Add(), GuiScrolled::Add(), GuiCompositeFrameBase::Add(), AddChild(), GuiCompositeFrameBase::GetChildrenList(), LayoutChildren(), GuiCompositeFrameBase::Remove(), and GuiMenuBar::RemoveMenu().

TList* GuiBase::fCleanup [private]

Definition at line 72 of file GuiBase.h.

Referenced by AddObject(), GuiBase(), and ~GuiBase().

unsigned int GuiBase::fLayoutHints [private]

Definition at line 73 of file GuiBase.h.

Referenced by GetLayoutHints(), and SetLayoutHints().

std::string GuiBase::fName [private]

Definition at line 74 of file GuiBase.h.

Referenced by GetName(), and SetName().


The documentation for this class was generated from the following files:
Generated on Mon Sep 1 00:51:39 2014 for loon by  doxygen 1.4.7