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

GuiTable.cxx

Go to the documentation of this file.
00001 #include "GuiTable.h"
00002 #include "TGLayout.h"
00003 #include "TGTableLayout.h"
00004 #include "TList.h"
00005 
00006 #include <iostream>
00007 using namespace std;
00008 
00009 GuiTable::GuiTable(TGWindow& parent, int nrows, int ncols, 
00010                    int width, int height)
00011     : TGCompositeFrame(&parent,width,height,kSunkenFrame)
00012 {
00013     TGTableLayout* tlo = new TGTableLayout(this,nrows,ncols);
00014     this->SetLayoutManager(tlo);
00015     this->SetLayoutHints(kLHintsExpandX|kLHintsExpandY);
00016 }
00017 GuiTable::~GuiTable()
00018 {
00019 }
00020 
00021 void GuiTable::Attach(TGFrame& child, int left, int right, int top, int bottom,
00022                       unsigned int xopt, unsigned int yopt)
00023 {
00024     if (! this->AddChild(child)) return;
00025 
00026     GuiBase* gbase = dynamic_cast<GuiBase*>(&child);
00027     if (!gbase) {cerr << "GuiTable: can't cast to GuiBase\n"; return; }
00028 
00029     unsigned int loh = gbase->GetLayoutHints();
00030 
00031     // This needs some work, ie, if !GUI_EXPAND
00032     if (xopt & GUI_EXPAND) loh |= kLHintsExpandX;
00033     if (yopt & GUI_EXPAND) loh |= kLHintsExpandY;
00034     if (xopt & GUI_FILL) loh |= kLHintsFillX;
00035     if (yopt & GUI_FILL) loh |= kLHintsFillY;
00036     if (xopt & GUI_SHRINK) loh |= kLHintsShrinkX;
00037     if (yopt & GUI_SHRINK) loh |= kLHintsShrinkY;
00038     if (xopt & GUI_CENTER) loh |= kLHintsCenterX;
00039     if (yopt & GUI_CENTER) loh |= kLHintsCenterY;
00040     if (xopt & GUI_LOW) loh |= kLHintsLeft;
00041     if (yopt & GUI_LOW) loh |= kLHintsTop;
00042     if (xopt & GUI_HI) loh |= kLHintsRight;
00043     if (yopt & GUI_HI) loh |= kLHintsBottom;
00044 
00045     TGTableLayoutHints* tloh =
00046         new TGTableLayoutHints(left,right,top,bottom,loh);
00047     this->AddObject(tloh);
00048     this->AddFrame(&child,tloh);
00049 }
00050 

Generated on Mon Nov 23 05:26:56 2009 for loon by  doxygen 1.3.9.1