#include "TGedFrame.h"
#include "TGClient.h"
#include "TG3DLine.h"
#include "TCanvas.h"
#include "TGLabel.h"
#include "TGTab.h"
#include <snprintf.h>
ClassImp(TGedFrame)
TGedFrame::TGedFrame(const TGWindow *p, Int_t id, Int_t width,
Int_t height, UInt_t options, Pixel_t back)
: TGCompositeFrame(p, width, height, options, back), TGWidget(id)
{
fPad = 0;
fModel = 0;
fInit = kTRUE;
fAvoidSignal = kFALSE;
Associate(p);
fTab = (TGTab*)p->GetParent()->GetParent();
}
TGedFrame::TGedFrame(const TGedFrame& gf) :
TGCompositeFrame(gf),
TGWidget(gf),
fModel(gf.fModel),
fPad(gf.fPad),
fInit(gf.fInit),
fAvoidSignal(gf.fAvoidSignal),
fTab(gf.fTab)
{
}
TGedFrame& TGedFrame::operator=(const TGedFrame& gf)
{
if(this!=&gf) {
TGCompositeFrame::operator=(gf);
TGWidget::operator=(gf);
fModel=gf.fModel;
fPad=gf.fPad;
fInit=gf.fInit;
fAvoidSignal=gf.fAvoidSignal;
fTab=gf.fTab;
}
return *this;
}
TGedFrame::~TGedFrame()
{
}
Option_t *TGedFrame::GetDrawOption() const
{
if (!fPad) return "";
TListIter next(fPad->GetListOfPrimitives());
TObject *obj;
while ((obj = next())) {
if (obj == fModel) return next.GetOption();
}
return "";
}
void TGedFrame::MakeTitle(const char *title)
{
TGCompositeFrame *f1 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
kLHintsExpandX |
kFixedWidth |
kOwnBackground);
f1->AddFrame(new TGLabel(f1, title),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
f1->AddFrame(new TGHorizontal3DLine(f1),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
AddFrame(f1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
}
void TGedFrame::SetActive(Bool_t active)
{
if (active)
((TGCompositeFrame*)GetParent())->ShowFrame(this);
else
((TGCompositeFrame*)GetParent())->HideFrame(this);
if (fTab->IsEnabled(fTab->GetCurrent()))
fTab->SetTab(fTab->GetCurrent());
else
fTab->SetTab(0);
}
void TGedFrame::RecursiveRemove(TObject* )
{
}
void TGedFrame::Refresh()
{
SetModel(fPad, fModel, 0);
}
void TGedFrame::SetDrawOption(Option_t *option)
{
if (!fPad || !option) return;
TListIter next(fPad->GetListOfPrimitives());
delete fPad->FindObject("Tframe");
TObject *obj;
while ((obj = next())) {
if (obj == fModel) {
next.SetOption(option);
fPad->Modified();
fPad->Update();
return;
}
}
}
void TGedFrame::Update()
{
if (fPad) {
fPad->Modified();
fPad->Update();
}
}
TGedNameFrame::TGedNameFrame(const TGWindow *p, Int_t id, Int_t width,
Int_t height, UInt_t options, Pixel_t back)
: TGedFrame(p, id, width, height, options | kVerticalFrame, back)
{
f1 = new TGCompositeFrame(this, 145, 10, kHorizontalFrame |
kFixedWidth |
kOwnBackground);
f1->AddFrame(new TGLabel(f1,"Name"),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
f1->AddFrame(new TGHorizontal3DLine(f1),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
AddFrame(f1, new TGLayoutHints(kLHintsTop));
f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
fLabel = new TGLabel(f2, "");
f2->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
Pixel_t color;
gClient->GetColorByName("#ff0000", color);
fLabel->SetTextColor(color, kFALSE);
}
TGedNameFrame::TGedNameFrame(const TGedNameFrame& nf) :
TGedFrame(nf),
fLabel(nf.fLabel),
f1(nf.f1),
f2(nf.f2)
{
}
TGedNameFrame& TGedNameFrame::operator=(const TGedNameFrame& nf)
{
if(this!=&nf) {
TGedFrame::operator=(nf);
fLabel=nf.fLabel;
f1=nf.f1;
f2=nf.f2;
}
return *this;
}
TGedNameFrame::~TGedNameFrame()
{
TGFrameElement *el;
TIter next(GetList());
while ((el = (TGFrameElement *)next())) {
if (!strcmp(el->fFrame->ClassName(), "TGCompositeFrame"))
((TGCompositeFrame *)el->fFrame)->Cleanup();
}
Cleanup();
}
void TGedNameFrame::SetModel(TVirtualPad* pad, TObject* obj, Int_t)
{
fModel = obj;
fPad = pad;
TString string;
if (obj == 0) {
SetActive(kFALSE);
return;
}
string.Append(fModel->GetName());
string.Append("::");
string.Append(fModel->ClassName());
fLabel->SetText(new TGString(string));
SetActive();
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.