#include "TTreeInput.h"
#include "TGButton.h"
#include "TGLabel.h"
#include "TGTextEntry.h"
enum ETreeInput {
kTI_TEVARS, kTI_TECUTS
};
ClassImp(TTreeInput)
TTreeInput::TTreeInput(const TGWindow *p, const TGWindow *main,
char *strvars, char *strcuts):
TGTransientFrame(p, main, 10, 10, kVerticalFrame)
{
if (!p && !main) {
MakeZombie();
return;
}
SetCleanup(kDeepCleanup);
TGLabel *label = new TGLabel(this, "Selected Variables: ");
AddFrame(label, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 0));
TGTextBuffer *tbuf = new TGTextBuffer(256);
fTEVars = new TGTextEntry(this, tbuf, kTI_TEVARS);
fTEVars->Resize(260, fTEVars->GetDefaultHeight());
AddFrame(fTEVars, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
label = new TGLabel(this, "Selected Cuts: ");
AddFrame(label, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 0));
tbuf = new TGTextBuffer(256);
fTECuts = new TGTextEntry(this, tbuf, kTI_TECUTS);
fTECuts->Resize(260, fTECuts->GetDefaultHeight());
AddFrame(fTECuts, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
TGHorizontalFrame *hf = new TGHorizontalFrame(this, 60, 20, kFixedWidth);
hf->SetCleanup(kDeepCleanup);
UInt_t width = 0, height = 0;
fOk = new TGTextButton(hf, "&Ok", 1);
fOk->Associate(this);
hf->AddFrame(fOk, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 5, 5, 0, 0));
height = fOk->GetDefaultHeight();
width = TMath::Max(width, fOk->GetDefaultWidth());
fCancel = new TGTextButton(hf, "&Cancel", 2);
fCancel->Associate(this);
hf->AddFrame(fCancel, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX, 5, 5, 0, 0));
height = fCancel->GetDefaultHeight();
width = TMath::Max(width, fCancel->GetDefaultWidth());
AddFrame(hf, new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5));
hf->Resize((width + 20) * 2, height);
SetWindowName("Get Input");
MapSubwindows();
width = GetDefaultWidth();
height = GetDefaultHeight();
Resize(width, height);
CenterOnParent();
SetWMSize(width, height);
SetWMSizeHints(width, height, width, height, 0, 0);
SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
kMWMDecorMinimize | kMWMDecorMenu,
kMWMFuncAll | kMWMFuncResize | kMWMFuncMaximize |
kMWMFuncMinimize,
kMWMInputModeless);
MapWindow();
fTEVars->SetFocus();
fStrvars = strvars;
fStrcuts = strcuts;
gClient->WaitFor(this);
}
TTreeInput::~TTreeInput()
{
Cleanup();
}
Bool_t TTreeInput::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
{
switch (GET_MSG(msg)) {
case kC_COMMAND:
switch (GET_SUBMSG(msg)) {
case kCM_BUTTON:
switch (parm1) {
case 1:
strcpy(fStrvars, fTEVars->GetBuffer()->GetString());
strcpy(fStrcuts, fTECuts->GetBuffer()->GetString());
delete this;
break;
case 2:
fStrvars[0] = 0;
fStrcuts[0] = 0;
delete this;
break;
}
default:
break;
}
break;
case kC_TEXTENTRY:
switch (GET_SUBMSG(msg)) {
case kTE_ENTER:
strcpy(fStrvars, fTEVars->GetBuffer()->GetString());
strcpy(fStrcuts, fTECuts->GetBuffer()->GetString());
delete this;
break;
case kTE_TAB:
if ( parm1 == kTI_TEVARS )
fTECuts->SetFocus();
else if ( parm1 == kTI_TECUTS )
fTEVars->SetFocus();
break;
default:
break;
}
break;
default:
break;
}
return kTRUE;
}
Last change: Tue Nov 18 08:46:42 2008
Last generated: 2008-11-18 08:46
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.