107 fTrueName =
name->GetString();
109 fContext->Associate(
this);
119 if (fTip)
delete fTip;
128 TList *list = GetContainer()->GetViewer()->ExpressionList();
129 fConvName = fTrueName;
133 while (!FullConverted()) {
140 if (fConvName == start) {
143 return(fConvName.Data());
146 return(fConvName.Data());
154 TList *list = GetContainer()->GetViewer()->ExpressionList();
171 dest->
SetExpression(fTrueName.Data(), fAlias.Data(), fIsCut);
195 if (fAlias.Length())
return kTRUE;
204 fAlias =
"~" + fAlias;
205 SetItemName(fAlias.Data());
213 if (fItemName)
delete fItemName;
215 Int_t max_ascent, max_descent;
216 fTWidth =
gVirtualX->TextWidth(fFontStruct, fItemName->GetString(), fItemName->GetLength());
217 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
218 fTHeight = max_ascent + max_descent;
220 Resize(GetDefaultSize());
221 fClient->NeedRedraw(
this);
229 if (fIsCut && type)
return;
230 if (!fIsCut && !type)
return;
232 SetSmallPic(fClient->GetPicture(
"selection_t.xpm"));
233 SetToolTipText(
"Selection expression. Drag to scissors to activate");
235 SetSmallPic(fClient->GetPicture(
"expression_t.xpm"));
250 SetSmallPic(fClient->GetPicture(
"pack_t.xpm"));
252 SetSmallPic(fClient->GetPicture(
"pack-empty_t.xpm"));
255 SetToolTipText(
"Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
256 if (*itemType & TTreeViewer::kLTDragType) SetCutType(cutType);
267 SetToolTipText(
"User-defined expression/cut. Double-click to edit");
281 if (text && strlen(text))
282 fTip =
new TGToolTip(fClient->GetRoot(),
this,
text, delayms);
291 fCurrent = fSmallPic;
292 if (fSelPic)
delete fSelPic;
298 fClient->FreePicture(cspic);
317 fExpressionList =
new TList;
320 fMapSubwindows =
kTRUE;
328 delete fExpressionList;
363 fExpressionList->
Clear();
374 return fExpressionList;
444 fLastActive->Activate(
kFALSE);
447 total = selected = 0;
466 if (fTotal != total || fSelected != selected) {
468 fSelected = selected;
473 if (selected == 1 && event->
fCode == 1) {
487 gVirtualX->SetCursor(fId,fDefaultCursor);
488 fLastActive->Move(fX0,fY0);
493 if ((f == fLastActive) || !f->
IsActive())
continue;
495 fLastActive->Activate(
kFALSE);
500 f->
SetToolTipText(
"Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
502 if (strlen(((
TTVLVEntry *) fLastActive)->GetTrueName())) {
517 "Name too long. Can not add any more items to scan box.");
527 fViewer->Message(msg);
547 Int_t xf0, xff, yf0, yff;
548 Int_t xpos =
event->fX - (fXp-fX0);
549 Int_t ypos =
event->fY - (fYp-fY0);
557 if (f == fLastActive) {
567 if (xpos>xf0 && xpos<xff && ypos>yf0 && ypos<yff) {
574 if ((fXp - event->
fX) > 10) {
575 fListView->SetHsbPosition(0);
576 fListView->SetVsbPosition(0);
578 fLastActive->Move(xpos, ypos);
579 gVirtualX->RaiseWindow(fLastActive->GetId());
597 f->
SetSmallPic(fClient->GetPicture(
"pack-empty_t.xpm"));
629 fLastActive->Activate(
kFALSE);
673 if (!
fViewer)
Error(
"TGSelectBox",
"Must be started from viewer");
683 fTe->
SetToolTipText(
"Type an expression using C++ syntax. Click other expression/leaves to paste them here.");
690 fTeAlias->
SetToolTipText(
"Define an alias for this expression. Do NOT use leading strings of other aliases.");
762 event.fX =
event.fY = 1;
786 fEntry->
SetToolTipText(
"Double-click to draw. Drag and drop. Use Edit/Expression or context menu to edit.");
790 cutType =
name.Contains(
"<") ||
name.Contains(
">") ||
name.Contains(
"=") ||
791 name.Contains(
"!") ||
name.Contains(
"&") ||
name.Contains(
"|");
882 fViewer->
Warning(
"ValidateAlias",
"You should define the alias first.");
892 fViewer->
Warning(
"ValidAlias",
"Alias can not be the leading string of other alias.");
void InsertText(const char *text)
Insert text in text entry.
const char * Ey()
Return the expression on Y.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
const char * GetTrueName()
Int_t GetCursorPosition() const
void Empty()
Clear all names and alias.
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other commands generated.
TGLayoutHints * fBLayout1
virtual void Activate(Bool_t a)
Make list view item active.
const char * ScanList()
Return the cut entry.
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events.
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
const Mask_t kLeaveWindowMask
void SetItemName(const char *name)
Redraw this entry with new name.
void SetTrueName(const char *name)
void SetScanMode(Bool_t mode=kTRUE)
TTVLVContainer * GetContainer()
virtual UInt_t GetDefaultHeight() const
void SelectItem(const char *name)
Select an item.
virtual ~TTVLVEntry()
TTVLVEntry destructor.
void EditExpression()
Start the expression editor.
void GrabPointer()
Just focus the cursor inside.
virtual ~TGSelectBox()
TGSelectBox destructor.
const char * ConvertAliases()
Convert all aliases into true names.
void RemoveItem()
Remove item.
static TGSelectBox * fgInstance
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
static TGSelectBox * GetInstance()
Return the pointer to the instantiated singleton.
virtual void SetText(TGString *newText)
Set new text in label.
empty object used as context menu support for TGLVTreeEntries.
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features...
void EmptyAll()
Clear all names and aliases for expression type items.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in text entry widget.
TList * ExpressionList()
Get the list of expression items.
void RemoveNonStatic()
Remove all non-static items from the list view, except expressions.
void SetExpression(const char *name="", const char *alias="-empty-", Bool_t cut=kFALSE)
Set item expression.
TGSelectBox(const TGWindow *p, const TGWindow *main, UInt_t w=10, UInt_t h=10)
TGSelectBox constructor.
TGItemContext()
Constructor.
void SetLabel(const char *title)
Set label of selection box.
virtual void InsertText(const char *text, Int_t pos)
Inserts text at position pos, clears the selection and moves the cursor to the end of the line...
void SetExpression(const char *name, const char *alias, Bool_t cutType=kFALSE)
Set the true name, alias and type of the expression, then refresh it.
void * GetUserData() const
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Bool_t ValidateAlias()
Return true if edited alias is not a leading string of other expression aliases.
This class represent entries that goes into the TreeViewer listview container.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TList * ExpressionList()
Return the list of user-defined expressions.
const char * Cut()
Return the cut entry.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void CopyItem(TTVLVEntry *dest)
Copy this item's name and alias to an other.
void SetToolTipText(const char *text, Long_t delayms=1000)
Set tool tip text associated with this item.
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Message interpreter.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in container.
void RemoveItem()
Remove the selected item from the list.
const char * GetString() const
static unsigned int total
const char * GetText() const
const Mask_t kEnterWindowMask
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
virtual void CloseWindow()
Close the select box.
virtual ~TTVLVContainer()
TGLVContainer destructor.
void SetSmallPic(const TGPicture *spic)
Set small picture.
This class represent a specialized expression editor for TTVLVEntry 'true name' and 'alias' data memb...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
const TGWindow * GetParent() const
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
TTVLVEntry * ExpressionItem(Int_t index)
Return the expression item at specific position.
#define dest(otri, vertexptr)
const char * Ez()
Return the expression on Z.
void Draw(Option_t *option="")
Draw item.
TTreeViewer * GetViewer()
Bool_t HasAlias()
Check if alias name is not empty.
const char * Ex()
Return the expression on X.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line...
void PrependTilde()
Prepend a ~ to item alias.
TGString * GetItemName() const
void SaveText()
Save the edited entry true name and alias.
int main(int argc, char **argv)
Bool_t FullConverted()
Return true if converted name is alias free.
void SetEntry(TTVLVEntry *entry)
Connect one entry.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetCutType(Bool_t type=kFALSE)
Set cut type.
This class represent the list view container for the.
void EditExpression()
Edit expression.
const char * Data() const