]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/Aliengui/AliSelectorFrame.cxx
Adding includes now needed by ROOT
[u/mrichter/AliRoot.git] / ANALYSIS / Aliengui / AliSelectorFrame.cxx
CommitLineData
114145dd 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18//-----------------------------------------------------------------
19// AliSelectorFrame class
20// The class that deals with the selector tab of the GUI
21// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22//-----------------------------------------------------------------
23
114145dd 24
0b28fd57 25#include <TGFileDialog.h>
26#include <TGLabel.h>
27#include <TGTextEntry.h>
28#include <TObjArray.h>
29#include <TObjString.h>
114145dd 30
31#include "AliTagAnalysisFrame.h"
32#include "AliAnalysisGUI.h"
33
34#include "AliSelectorFrame.h"
35
36ClassImp(AliSelectorFrame)
37
38//___________________________________________________________________________
a313abd0 39AliSelectorFrame::AliSelectorFrame(const TGWindow *main, UInt_t w, UInt_t h, AliAnalysisGUI *v, AliTagAnalysisFrame* t):
40 TGHorizontalFrame(main, w, h),
41 fVFrame1(0), fVFrame2(0),
42 fLabel1(0), fTextSelector(0), fButtonSelect(0), fButtonRun(0),
43 fAliAnalysisGUI(v), fTagAnalysisFrame(t) {
114145dd 44 // ctor.
45
46 fVFrame1 = new TGVerticalFrame(this, 100, 100);
47 AddFrame(fVFrame1, new TGLayoutHints(kLHintsLeft, 5,5,5,5));
48
49 fLabel1 = new TGLabel(fVFrame1, new TGString("Selector macro"));
50 fVFrame1->AddFrame(fLabel1, new TGLayoutHints(kLHintsTop, 5,5,5,5));
51
52 fTextSelector = new TGTextEntry(fVFrame1, new TGTextBuffer(50));
53 fVFrame1->AddFrame(fTextSelector, new TGLayoutHints(kLHintsBottom, 5,5,10,5));
54 fTextSelector->SetEnabled(false);
55
56 fVFrame2 = new TGVerticalFrame(this, 100, 100);
57 AddFrame(fVFrame2, new TGLayoutHints(kLHintsLeft, 5,5,5,5));
58
59 fButtonSelect = new TGTextButton(fVFrame2, "Select...", 1);
60 fVFrame2->AddFrame(fButtonSelect, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 5,5,5,5));
61 fButtonSelect->Connect("Clicked()", "AliSelectorFrame", this, "OnSelect()");
62
63 fButtonRun = new TGTextButton(fVFrame2, "Run", 2);
64 fVFrame2->AddFrame(fButtonRun, new TGLayoutHints(kLHintsExpandX | kLHintsBottom, 5,5,5,5));
65
66 fButtonRun->Connect("Clicked()", "AliSelectorFrame", this, "OnRun()");
67
68 MapWindow();
69 Resize();
70 MapSubwindows();
71}
72
73//___________________________________________________________________________
74AliSelectorFrame::AliSelectorFrame(const AliSelectorFrame&):
75 fVFrame1(0),
76 fVFrame2(0),
77 fTextSelector(0),
78 fButtonSelect(0),
79 fButtonRun(0),
80 fAliAnalysisGUI(0),
81 fTagAnalysisFrame(0)
82{
83 //copy constructor
84}
85
86//___________________________________________________________________________
87void AliSelectorFrame::OnSelect() {
88 // When Select button is pressed.
89
90 const char *filetypes[] = {
91 "macro files", "*.C",
92 0, 0
93 };
94
95 static TString dir(".");
96 TGFileInfo fi;
97 fi.fFileTypes = filetypes;
98 fi.fIniDir = StrDup(dir);
99
100 new TGFileDialog(gClient->GetRoot(), fAliAnalysisGUI, kFDOpen, &fi);
101
102 fTextSelector->SetText(fi.fFilename);
103}
104
105//___________________________________________________________________________
106void AliSelectorFrame::OnRun() {
107 // Run the Analysis Selector
108
109 TString fname (fTextSelector->GetText());
110
111 TObjArray *a = fname.Tokenize("/");
112 TObjString * ostr = (TObjString*)a->At(a->GetEntries()-1);
113
114 fTagAnalysisFrame->ProcessSelector(ostr->GetString().Data());
115
116 delete a;
117}