2 // Author: Matevz Tadel 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #include "AliEveMacroEditor.h"
11 #include "AliEveMacro.h"
13 #include "TVirtualPad.h"
15 // Cleanup these includes:
17 #include "TGNumberEntry.h"
18 #include "TGColorSelect.h"
19 #include "TGTextEntry.h"
21 #include "TGComboBox.h"
23 //______________________________________________________________________________
24 // GUI editor for AliEveMacro.
27 ClassImp(AliEveMacroEditor)
29 //______________________________________________________________________________
30 AliEveMacroEditor::AliEveMacroEditor(const TGWindow *p, Int_t width, Int_t height,
31 UInt_t options, Pixel_t back) :
32 TGedFrame(p, width, height, options | kVerticalFrame, back),
43 MakeTitle("AliEveMacro");
45 TGHorizontalFrame *f = 0;
50 MkLabel(f, "Active: ", labelW);
52 fActive = new TGCheckButton(f);
53 f->AddFrame(fActive); // new TGLayoutHints());
54 fActive->Connect("Clicked()", "AliEveMacroEditor", this,
57 MkLabel(f, "Source: ", 56);
58 fSources = new TGComboBox(f);
59 f->AddFrame(fSources); // new TGLayoutHints());
60 fSources->AddEntry("None", AliEveMacro::kNone);
61 fSources->AddEntry("RunLoader", AliEveMacro::kRunLoader);
62 fSources->AddEntry("ESD", AliEveMacro::kESD);
63 fSources->AddEntry("ESDfriend", AliEveMacro::kESDfriend);
64 fSources->AddEntry("RawReader", AliEveMacro::kRawReader);
66 TGListBox* lb = fSources->GetListBox();
67 lb->Resize(lb->GetWidth(), 5*16);
69 fSources->Resize(92, 20);
70 fSources->Connect("Selected(Int_t)", "AliEveMacroEditor", this,
73 MkLabel(f, "Tags: ", 40);
74 fTags = new TGTextEntry(f);
75 f->AddFrame(fTags, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
76 fTags->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
81 MkLabel(f, "Macro: ", labelW);
82 fMacro = new TGTextEntry(f);
83 f->AddFrame(fMacro, new TGLayoutHints(kLHintsNormal));//|kLHintsExpandX));
84 fMacro->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
87 MkLabel(f, "Func: ", labelW);
88 fFunc = new TGTextEntry(f);
89 f->AddFrame(fFunc, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
90 fFunc->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
95 MkLabel(f, "Args: ", labelW);
96 fArgs = new TGTextEntry(f);
97 f->AddFrame(fArgs, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
98 fArgs->Connect("TextChanged(const char *)", "AliEveMacroEditor", this,
103 /******************************************************************************/
105 //______________________________________________________________________________
106 void AliEveMacroEditor::SetModel(TObject* obj)
110 fM = dynamic_cast<AliEveMacro*>(obj);
112 fSources->Select (fM->GetSources(), kFALSE);
113 // TGTextEntry emits a signal no matter what ...
114 TQObject::BlockAllSignals(kTRUE);
115 fTags ->SetText (fM->GetTags());
116 fMacro ->SetText (fM->GetMacro());
117 fFunc ->SetText (fM->GetFunc());
118 fArgs ->SetText (fM->GetArgs());
119 TQObject::BlockAllSignals(kFALSE);
120 fActive ->SetState(fM->fActive ? kButtonDown : kButtonUp);
123 //______________________________________________________________________________
124 void AliEveMacroEditor::DoSources(Int_t v)
132 //______________________________________________________________________________
133 void AliEveMacroEditor::DoTags()
137 fM->SetTags(fTags->GetText());
141 //______________________________________________________________________________
142 void AliEveMacroEditor::DoMacro()
146 fM->SetMacro(fMacro->GetText());
150 //______________________________________________________________________________
151 void AliEveMacroEditor::DoFunc()
155 fM->SetFunc(fFunc->GetText());
158 //______________________________________________________________________________
159 void AliEveMacroEditor::DoArgs()
163 fM->SetArgs(fArgs->GetText());
167 //______________________________________________________________________________
168 void AliEveMacroEditor::DoActive()
172 fM->SetActive(fActive->IsOn());
176 /******************************************************************************/
178 TGHorizontalFrame* AliEveMacroEditor::MkHFrame(TGCompositeFrame* p)
180 // Make standard horizontal frame.
184 TGHorizontalFrame* f = new TGHorizontalFrame(p);
185 p->AddFrame(f, new TGLayoutHints(kLHintsNormal|kLHintsExpandX));
189 TGLabel* AliEveMacroEditor::MkLabel(TGCompositeFrame* p, const char* txt, Int_t width,
190 Int_t lo, Int_t ro, Int_t to, Int_t bo)
192 // Make standard label.
194 TGLabel *l = new TGLabel(p, txt);
195 p->AddFrame(l, new TGLayoutHints(kLHintsNormal, lo,ro,to,bo));
196 l->SetTextJustify(kTextRight);
198 l->ChangeOptions(l->GetOptions() | kFixedWidth);