36 TGedFrame::TGedFrame(
const TGWindow *p, Int_t width,
37 Int_t height, UInt_t options, Pixel_t back)
38 : TGCompositeFrame(p, width, height, options, back),
47 fGedEditor = TGedEditor::GetFrameCreator();
48 SetCleanup(kDeepCleanup);
54 TGedFrame::~TGedFrame()
58 TIter next(fExtraTabs);
59 while ((sf = (TGedSubFrame*) next()) != 0) {
61 fExtraTabs->Remove(sf);
73 void TGedFrame::Update()
75 fGedEditor->Update(
this);
81 Option_t *TGedFrame::GetDrawOption()
const
83 if (!fGedEditor->GetPad())
return "";
85 TListIter next(fGedEditor->GetPad()->GetListOfPrimitives());
87 while ((obj = next())) {
88 if (obj == fGedEditor->GetModel())
return next.GetOption();
96 void TGedFrame::MakeTitle(
const char *title)
98 TGCompositeFrame *f1 =
new TGCompositeFrame(
this, 145, 10, kHorizontalFrame |
102 f1->AddFrame(
new TGLabel(f1, title),
103 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
104 f1->AddFrame(
new TGHorizontal3DLine(f1),
105 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
106 AddFrame(f1,
new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
112 void TGedFrame::AddExtraTab(TGedSubFrame* sf)
114 if (fExtraTabs == 0) fExtraTabs =
new TList();
116 sf->fFrame->SetCleanup(kDeepCleanup);
123 TGVerticalFrame* TGedFrame::CreateEditorTabSubFrame(
const char* name)
125 TGCompositeFrame* tabcont = fGedEditor->GetEditorTab(name);
127 TGVerticalFrame* newframe =
new TGVerticalFrame(tabcont);
128 AddExtraTab(
new TGedFrame::TGedSubFrame(TString(name), newframe));
135 void TGedFrame::Refresh(TObject* model)
145 void TGedFrame::SetDrawOption(Option_t *option)
147 if (!fGedEditor->GetPad() || !option)
return;
149 TListIter next(fGedEditor->GetPad()->GetListOfPrimitives());
150 delete fGedEditor->GetPad()->FindObject(
"Tframe");
152 while ((obj = next())) {
153 if (obj == fGedEditor->GetModel()) {
154 next.SetOption(option);
155 fGedEditor->GetPad()->Modified();
156 fGedEditor->GetPad()->Update();
168 void TGedFrame::ActivateBaseClassEditors(TClass* cl)
171 if (cl->GetListOfBases()->IsEmpty() == kFALSE) {
172 fGedEditor->ActivateEditors(cl->GetListOfBases(), kTRUE);
179 TGedNameFrame::TGedNameFrame(
const TGWindow *p, Int_t width,
180 Int_t height, UInt_t options, Pixel_t back)
181 : TGedFrame(p, width, height, options | kVerticalFrame, back)
185 f1 =
new TGCompositeFrame(
this, 145, 10, kHorizontalFrame |
188 f1->AddFrame(
new TGLabel(f1,
"Name"),
189 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
190 f1->AddFrame(
new TGHorizontal3DLine(f1),
191 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
192 AddFrame(f1,
new TGLayoutHints(kLHintsTop));
194 f2 =
new TGCompositeFrame(
this, 80, 20, kHorizontalFrame | kFixedWidth);
195 fLabel =
new TGLabel(f2,
"");
196 f2->AddFrame(fLabel,
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
197 AddFrame(f2,
new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
201 gClient->GetColorByName(
"#ff0000", color);
202 fLabel->SetTextColor(color, kFALSE);
205 fTip =
new TGToolTip(fClient->GetDefaultRoot(),
this,
"TGedNameFrame", 500);
207 AddInput(kEnterWindowMask | kLeaveWindowMask | kKeyPressMask | kButtonPressMask);
213 TGedNameFrame::~TGedNameFrame()
221 Bool_t TGedNameFrame::HandleCrossing(Event_t *event)
223 if (event->fType == kEnterNotify)
234 Bool_t TGedNameFrame::HandleButton(Event_t * )
236 if (fTip) fTip->Hide();
244 void TGedNameFrame::SetModel(TObject* obj)
249 fLabel->SetText(
new TGString(
"Object not selected"));
252 string.Append(obj->GetName());
254 string.Append(obj->ClassName());
256 fLabel->SetText(
new TGString(
string));
257 string = TString::Format(
"Name: %s\nTitle: %s\nClass: %s",
258 obj->GetName(), obj->GetTitle(), obj->ClassName());
259 fTip->SetText(
string);
263 TGCanvas *canvas = fGedEditor->GetTGCanvas();
264 TGVScrollBar *vsb = canvas->GetVScrollbar();
266 Int_t hscrollw = (vsb && vsb->IsMapped()) ? vsb->GetWidth() : 0;
267 Int_t labwidth = TMath::Min(fLabel->GetDefaultSize().fWidth,
268 canvas->GetWidth() - 10 - hscrollw);
269 f2->SetWidth(TMath::Max(labwidth, 80));