Logo ROOT  
Reference Guide
TGListBox.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 12/01/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 /**************************************************************************
12 
13  This source is based on Xclass95, a Win95-looking GUI toolkit.
14  Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15 
16  Xclass95 is free software; you can redistribute it and/or
17  modify it under the terms of the GNU Library General Public
18  License as published by the Free Software Foundation; either
19  version 2 of the License, or (at your option) any later version.
20 
21 **************************************************************************/
22 
23 
24 /** \class TGListBox
25  \ingroup guiwidgets
26 
27 A listbox is a box, possibly with scrollbar, containing entries.
28 Currently entries are simple text strings (TGTextLBEntry).
29 A TGListBox looks a lot like a TGCanvas. It has a TGViewPort
30 containing a TGLBContainer which contains the entries and it also
31 has a vertical scrollbar which becomes visible if there are more
32 items than fit in the visible part of the container.
33 
34 The TGListBox is user callable. The other classes are service
35 classes of the listbox.
36 
37 A listbox contains a container frame which is viewed through a
38 viewport. If the container is larger than the viewport than a
39 vertical scrollbar is added.
40 
41 Selecting an item in the listbox will generate the event:
42  - kC_COMMAND, kCM_LISTBOX, listbox id, item id.
43 
44 \class TGLBEntry
45 \ingroup guiwidgets
46 
47 Basic listbox entries.
48 Listbox entries are created by a TGListBox and not by the user.
49 
50 \class TGTextLBEntry
51 \ingroup guiwidgets
52 
53 Text string listbox entries.
54 A TGTextLBEntry is for TGListBox internal use.
55 
56 \class TGLineLBEntry
57 \ingroup guiwidgets
58 
59 Line style and width listbox entries.
60 Line example and width number
61 
62 \class TGIconLBEntry
63 \ingroup guiwidgets
64 
65 Icon + text listbox entry.
66 
67 \class TGLBContainer
68 \ingroup guiwidgets
69 
70 A Composite frame that contains a list of TGLBEnties.
71 A TGLBContainer is for TGListBox internal use.
72 
73 */
74 
75 
76 #include "TGPicture.h"
77 #include "TGListBox.h"
78 #include "TGResourcePool.h"
79 #include "TSystem.h"
80 #include "TMath.h"
81 #include "TVirtualX.h"
82 
83 #include <cstdlib>
84 #include <iostream>
85 
86 
87 const TGFont *TGTextLBEntry::fgDefaultFont = nullptr;
89 
95 
96 ////////////////////////////////////////////////////////////////////////////////
97 /// Base class entry constructor.
98 
99 TGLBEntry::TGLBEntry(const TGWindow *p, Int_t id, UInt_t options, Pixel_t back) :
100  TGFrame(p, 10, 10, options | kOwnBackground, back)
101 {
102  fActive = kFALSE;
103  fEntryId = id;
104  fBkcolor = back;
106 
107  SetWindowName();
108 }
109 
110 ////////////////////////////////////////////////////////////////////////////////
111 /// Toggle active state of listbox entry.
112 
114 {
115  if (fActive == a) return;
116  fActive = a;
117  DoRedraw();
118 }
119 
120 ////////////////////////////////////////////////////////////////////////////////
121 /// Toggle active state of listbox entry.
122 
124 {
125  fActive = !fActive;
126  DoRedraw();
127 }
128 
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 /// Create a text listbox entry. The TGString is adopted.
132 
134  GContext_t norm, FontStruct_t font, UInt_t options, ULong_t back) :
135  TGLBEntry(p, id, options, back)
136 {
137  fText = s;
139  fFontStruct = font;
140  fNormGC = norm;
141  fTWidth = 0;
142 
143  int max_ascent, max_descent;
144 
145  if (fText) fTWidth = gVirtualX->TextWidth(fFontStruct, fText->GetString(), fText->GetLength());
146  gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
147  fTHeight = max_ascent + max_descent;
148  Resize(fTWidth, fTHeight + 1);
150  SetWindowName();
151 }
152 
153 ////////////////////////////////////////////////////////////////////////////////
154 /// Delete text listbox entry.
155 
157 {
158  if (fText) delete fText;
159 }
160 
161 ////////////////////////////////////////////////////////////////////////////////
162 /// Draw text listbox entry on window/pixmap.
163 
165 {
166  int max_ascent, max_descent;
167 
168  y += (fHeight - fTHeight) >> 1;
169 
170  gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
171 
172  if (fActive) {
174  gVirtualX->FillRectangle(id,fNormGC, x, y, fWidth, fHeight);
176  fText->Draw(id, fNormGC, x + 3, y + max_ascent);
177  } else {
178  gVirtualX->SetForeground(fNormGC, fBkcolor);
179  gVirtualX->FillRectangle(id, fNormGC, x, y, fWidth, fHeight);
180  gVirtualX->SetForeground(fNormGC, GetForeground());
181  fText->Draw(id, fNormGC, x + 3, y + max_ascent);
182  }
183 }
184 
185 ////////////////////////////////////////////////////////////////////////////////
186 /// Redraw text listbox entry.
187 
189 {
190  if (fId) DrawCopy(fId, 0, 0);
191 }
192 
193 ////////////////////////////////////////////////////////////////////////////////
194 /// Set or change text in text entry.
195 
197 {
198  if (fText) delete fText;
199  fText = new_text;
201 
202  int max_ascent, max_descent;
204  gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
205  fTHeight = max_ascent + max_descent;
206 
207  Resize(fTWidth + 3, fTHeight + 1);
208 
209  DoRedraw();
210 }
211 
212 ////////////////////////////////////////////////////////////////////////////////
213 /// Return default font structure in use for a text listbox entry.
214 
216 {
217  if (!fgDefaultFont)
218  fgDefaultFont = gClient->GetResourcePool()->GetDefaultFont();
219  return fgDefaultFont->GetFontStruct();
220 }
221 
222 ////////////////////////////////////////////////////////////////////////////////
223 /// Return default graphics context in use for a text listbox entry.
224 
226 {
227  if (!fgDefaultGC)
228  fgDefaultGC = new TGGC(*gClient->GetResourcePool()->GetFrameGC());
229  return *fgDefaultGC;
230 }
231 
232 
233 ////////////////////////////////////////////////////////////////////////////////
234 /// Create the line style listbox entry.
235 
236 TGLineLBEntry::TGLineLBEntry(const TGWindow *p, Int_t id, const char *str,
237  UInt_t w, Style_t style, UInt_t options, ULong_t back) :
238  TGTextLBEntry(p, new TGString(str), id, GetDefaultGC()(),
239  GetDefaultFontStruct(), options, back)
240 {
241  GCValues_t gcv;
242 
244  fLineWidth = gcv.fLineWidth = w;
245  gcv.fFillStyle = kFillSolid;
246  gcv.fDashLen = 2;
247  gcv.fDashOffset = 0;
248  memcpy(gcv.fDashes, "\x5\x5", 3);
250  fLineGC = fClient->GetGC(&gcv, kTRUE);
252 
253  int max_ascent, max_descent;
254 
255  fTWidth = gVirtualX->TextWidth(GetDefaultFontStruct(), "8", 1);
256  fTWidth += 15; // for drawing
257  gVirtualX->GetFontProperties(GetDefaultFontStruct(),
258  max_ascent, max_descent);
259  fTHeight = max_ascent + max_descent;
260  fLineLength = 0;
261 
262  Resize(fTWidth, fTHeight + 1);
264  SetWindowName();
265 }
266 
267 ////////////////////////////////////////////////////////////////////////////////
268 /// Delete line style listbox entry.
269 
271 {
273 }
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 /// Update line style listbox entry.
277 
279 {
281 
283  fLineGC = ((TGLineLBEntry *)e)->GetLineGC();
285 }
286 
287 ////////////////////////////////////////////////////////////////////////////////
288 /// Set the line style corresponding to the TPad line styles.
289 
291 {
292  static const char* dashed = "\x3\x3";
293  static const char* dotted= "\x1\x2";
294  static const char* dasheddotted = "\x3\x4\x1\x4";
295  static const char* ls05 = "\x5\x3\x1\x3";
296  static const char* ls06 = "\x5\x3\x1\x3\x1\x3\x1\x3";
297  static const char* ls07 = "\x5\x5";
298  static const char* ls08 = "\x5\x3\x1\x3\x1\x3";
299  static const char* ls09 = "\x20\x5";
300  static const char* ls10 = "\x20\x10\x1\x10";
301 
302 
303  if (linestyle <= 1) {
305  } else {
306  switch (linestyle) {
307  case 2:
308  fLineGC->SetDashList(dashed, 2);
309  break;
310  case 3:
311  fLineGC->SetDashList(dotted, 2);
312  break;
313  case 4:
314  fLineGC->SetDashList(dasheddotted, 4);
315  break;
316  case 5:
317  fLineGC->SetDashList(ls05, 4);
318  break;
319  case 6:
320  fLineGC->SetDashList(ls06, 8);
321  break;
322  case 7:
323  fLineGC->SetDashList(ls07, 2);
324  break;
325  case 8:
326  fLineGC->SetDashList(ls08, 6);
327  break;
328  case 9:
329  fLineGC->SetDashList(ls09, 2);
330  break;
331  case 10:
332  fLineGC->SetDashList(ls10, 4);
333  break;
334  }
335  }
336  fLineGC->SetCapStyle(0); // flat cap
337  fLineStyle = linestyle;
338 }
339 
340 ////////////////////////////////////////////////////////////////////////////////
341 /// Set or change line width in an entry.
342 
344 {
345  fLineWidth = width;
347 }
348 
349 ////////////////////////////////////////////////////////////////////////////////
350 /// Draw copy on window/pixmap.
351 
353 {
355  if (!strcmp(TGTextLBEntry::GetTitle(),"None")) return;
356  if (fActive) {
357  gVirtualX->SetForeground(fLineGC->GetGC(),
359  } else {
360  gVirtualX->SetForeground(fLineGC->GetGC(),
362  }
363  gVirtualX->DrawLine(id, fLineGC->GetGC(), x + fTWidth + 5, y + fHeight/2,
364  x + fWidth - 5, y + fHeight/2);
365 }
366 
367 ////////////////////////////////////////////////////////////////////////////////
368 /// Redraw line style listbox entry.
369 
371 {
372  if (fId) DrawCopy(fId, 0, 0);
373 }
374 
375 
376 ////////////////////////////////////////////////////////////////////////////////
377 /// Create the icon & text listbox entry.
378 
379 TGIconLBEntry::TGIconLBEntry(const TGWindow *p, Int_t id, const char *str,
380  const TGPicture *pic,
381  UInt_t /*w*/, Style_t /*style*/, UInt_t options, ULong_t back) :
382  TGTextLBEntry(p, new TGString(str), id, GetDefaultGC()(),
383  GetDefaultFontStruct(), options, back)
384 {
385  int max_ascent, max_descent;
386 
387  fPicture = pic;
388  if (fPicture) {
389  fTWidth += fPicture->GetWidth() + 4;
390  ((TGPicture *)fPicture)->AddReference();
391  }
392  else
393  fTWidth += 20;
394  gVirtualX->GetFontProperties(GetDefaultFontStruct(),
395  max_ascent, max_descent);
396  fTHeight = max_ascent + max_descent;
397  if (fPicture && fPicture->GetHeight() > fTHeight)
399 
400  Resize(fTWidth, fTHeight + 1);
402  SetWindowName();
403 }
404 
405 ////////////////////////////////////////////////////////////////////////////////
406 /// Delete icon & text listbox entry.
407 
409 {
411 }
412 
413 ////////////////////////////////////////////////////////////////////////////////
414 /// Update icon & text listbox entry.
415 
417 {
419 }
420 
421 ////////////////////////////////////////////////////////////////////////////////
422 /// Draw copy on window/pixmap.
423 
425 {
426  Int_t off_x = 0;
427  if (fPicture) {
428  fPicture->Draw(id, fNormGC, x + 2, y);
429  off_x = fPicture->GetWidth() + 4;
430  }
431  TGTextLBEntry::DrawCopy(id, x + off_x, y);
432 }
433 
434 ////////////////////////////////////////////////////////////////////////////////
435 /// Redraw icon & text listbox entry.
436 
438 {
439  if (fId) DrawCopy(fId, 0, 0);
440 }
441 
442 ////////////////////////////////////////////////////////////////////////////////
443 /// Change the icon of listbox entry containing icon & text.
444 
446 {
448 
449  if (pic) ((TGPicture *)pic)->AddReference();
450 
451  fPicture = pic;
452 }
453 
454 /////////////////////////////////////////////////////////////////////////////////
456 public:
458  virtual ~TGLBFrameElement() {}
459 
460  Bool_t IsSortable() const { return kTRUE; }
461  Int_t Compare(const TObject *obj) const {
463  return 0;
464  }
466  TGTextLBEntry *f2 = (TGTextLBEntry *) ((TGFrameElement *) obj)->fFrame;
467 
468 
469  double d1, d2;
470  const char *t1 = f1->GetText()->Data();
471  const char *t2 = f2->GetText()->Data();
472 
473  if ((d1 = atof(t1)) && (d2 = atof(t2))) {
474  return (d1 > d2);
475  } else {
476  return strcmp(t1, t2);
477  }
478  return 0;
479  }
480 };
481 
482 
483 ////////////////////////////////////////////////////////////////////////////////
484 /// Create a listbox container.
485 
487  UInt_t options, ULong_t back) :
488  TGContainer(p, w, h, options, back)
489 {
490  fLastActive = 0;
491  fMsgWindow = p;
494  fListBox = 0;
495 
496  SetWindowName();
498 }
499 
500 ////////////////////////////////////////////////////////////////////////////////
501 /// Delete the listbox container.
502 
504 {
505  Cleanup();
506 }
507 
508 ////////////////////////////////////////////////////////////////////////////////
509 /// Layout container
510 
512 {
515 }
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 /// redraw
519 
521 {
522  return TGContainer::DoRedraw();
523 }
524 
525 ////////////////////////////////////////////////////////////////////////////////
526 /// Add listbox entry with hints to container. To show entry call
527 /// MapSubwindows() and Layout().
528 
530 {
531  // DEPRECATED: the color should always be set in the TGLBEntry ctor
532  //lbe->SetBackgroundColor(fgWhitePixel);
533 
534  TGLBFrameElement *nw = new TGLBFrameElement(lbe, lhints ? lhints : fgDefaultHints);
535  fList->Add(nw);
536  ClearViewPort();
537 }
538 
539 ////////////////////////////////////////////////////////////////////////////////
540 /// Insert listbox entry after specified entry with id afterID. If afterID = -1
541 /// then add entry at head of list. To show entry call MapSubwindows() and
542 /// Layout().
543 
545 {
546  // DEPRECATED: the color should always be set in the TGLBEntry ctor
547  //lbe->SetBackgroundColor(fgWhitePixel);
548 
549  TGLBEntry *e;
550  TGFrameElement *el, *nw;
551  TIter next(fList);
552 
553  while ((el = (TGFrameElement *) next())) {
554  e = (TGLBEntry *) el->fFrame;
555  if (e->EntryId() == afterID) break;
556  }
557 
558  if (!el && afterID != -1) {
559  nw = new TGLBFrameElement(lbe, lhints ? lhints : fgDefaultHints);
560  fList->Add(nw);
561  } else {
562  nw = new TGLBFrameElement(lbe, lhints);
563  nw->fFrame = lbe;
564  nw->fLayout = lhints;
565  nw->fState = 1;
566  //lbe->SetFrameElement(nw);
567 
568  if (afterID == -1)
569  fList->AddFirst(nw);
570  else
571  fList->AddAfter(el, nw);
572  }
573  ClearViewPort();
574 }
575 
576 ////////////////////////////////////////////////////////////////////////////////
577 /// Insert listbox entry before the list box entry with a higher id.
578 /// To show entry call MapSubwindows() and Layout().
579 
581 {
582  // DEPRECATED: the color should always be set in the TGLBEntry ctor
583  //lbe->SetBackgroundColor(fgWhitePixel);
584 
585  TGLBEntry *e;
586  TGFrameElement *el, *nw;
587  TIter next(fList);
588 
589  while ((el = (TGFrameElement *) next())) {
590  e = (TGLBEntry *) el->fFrame;
591  if (e->EntryId() > lbe->EntryId()) break;
592  }
593 
594  if (!el) {
595  nw = new TGLBFrameElement(lbe, lhints ? lhints : fgDefaultHints);
596  fList->Add(nw);
597  } else {
598  nw = new TGLBFrameElement(lbe, lhints);
599  nw->fFrame = lbe;
600  nw->fLayout = lhints;
601  nw->fState = 1;
602  //lbe->SetFrameElement(nw);
603 
604  fList->AddBefore(el, nw);
605  }
606  ClearViewPort();
607 }
608 
609 ////////////////////////////////////////////////////////////////////////////////
610 /// Remove the entry with specified id from the listbox container.
611 /// To update the listbox call Layout().
612 
614 {
615  TGLBEntry *e;
616  TGFrameElement *el;
617  TGLayoutHints *l;
618 
619  TIter next(fList);
620 
621  while ((el = (TGFrameElement *) next())) {
622  e = (TGLBEntry *) el->fFrame;
623  l = el->fLayout;
624  if (e->EntryId() == id) {
625  if (fLastActive == e) fLastActive = 0;
626  e->DestroyWindow();
627  fList->Remove(el); // avoid calling RemoveFrame(e)
628  delete el; // item
629  delete e;
630  delete l;
631  break;
632  }
633  }
634  ClearViewPort();
635 }
636 
637 ////////////////////////////////////////////////////////////////////////////////
638 /// Remove entries from from_ID to to_ID (including).
639 /// To update the listbox call Layout().
640 
642 {
643  TGLBEntry *e;
644  TGFrameElement *el;
645  TGLayoutHints *l;
646 
647  TIter next(fList);
648 
649  while ((el = (TGFrameElement *) next())) {
650  e = (TGLBEntry *) el->fFrame;
651  l = el->fLayout;
652  if ((e->EntryId() >= from_ID) && (e->EntryId() <= to_ID)) {
653  if (fLastActive == e) fLastActive = 0;
654  e->DestroyWindow();
655  fList->Remove(el); // avoid calling RemoveFrame(e)
656  delete el; // idem
657  delete e;
658  delete l;
659  }
660  }
661  ClearViewPort();
662 }
663 
664 ////////////////////////////////////////////////////////////////////////////////
665 /// Remove all entries in this container.
666 
668 {
669  TGLBEntry *e;
670  TGFrameElement *el;
671  TGLayoutHints *l;
672 
673  TIter next(fList);
674 
675  while ((el = (TGFrameElement *) next())) {
676  e = (TGLBEntry *) el->fFrame;
677  l = el->fLayout;
678  if (fLastActive == e) fLastActive = 0;
679  if (e)
680  e->DestroyWindow();
681  fList->Remove(el); // avoid calling RemoveFrame(e)
682  delete el; // item
683  delete e;
684  delete l;
685  }
686  ClearViewPort();
687 }
688 
689 ////////////////////////////////////////////////////////////////////////////////
690 /// Select the entry with the specified id.
691 /// Returns the selected TGLBEntry.
692 
694 {
695  return Select(id, kTRUE);
696 }
697 
698 ////////////////////////////////////////////////////////////////////////////////
699 /// Select / deselect the entry with the specified id.
700 /// Returns the selected TGLBEntry.
701 
703 {
704  TGLBEntry *f;
705  TGFrameElement *el;
706 
707  if (!fMultiSelect && fLastActive) {
709  fLastActive = 0;
710  }
711 
712  TIter next(fList);
713  while ((el = (TGFrameElement *) next())) {
714  f = (TGLBEntry *) el->fFrame;
715  if (f->EntryId() == id) {
716  f->Activate(sel);
717  if (fMultiSelect == kFALSE && sel == kTRUE) {
718  fLastActive = f;
719  fLastActiveEl = el;
720  }
721  ClearViewPort();
722  return f;
723  }
724  }
725 
726  return 0;
727 }
728 
729 ////////////////////////////////////////////////////////////////////////////////
730 /// Returns id of selected entry. In case of no selected entry or
731 /// if multi selection is switched on returns -1.
732 
734 {
735  if (fLastActive == 0) return -1;
736  return fLastActive->EntryId();
737 }
738 
739 ////////////////////////////////////////////////////////////////////////////////
740 /// Returns kTrue if entry id is selected.
741 
743 {
744  TGLBEntry *f;
745  TGFrameElement *el;
746 
747  TIter next(fList);
748  while ((el = (TGFrameElement *) next())) {
749  f = (TGLBEntry *) el->fFrame;
750  if (f->EntryId() == id)
751  return f->IsActive();
752  }
753 
754  return kFALSE;
755 }
756 
757 ////////////////////////////////////////////////////////////////////////////////
758 /// Adds all selected entries (TGLBEntry) of the list box into
759 /// the list selected.
760 
762 {
763  TGLBEntry *f;
764  TGFrameElement *el;
765 
766  TIter next(fList);
767  while ((el = (TGFrameElement *) next())) {
768  f = (TGLBEntry *) el->fFrame;
769  if (f->IsActive()) {
770  selected->Add(f);
771  }
772  }
773 }
774 
775 ////////////////////////////////////////////////////////////////////////////////
776 /// Enables and disables multiple selections of entries.
777 
779 {
780  TGFrameElement *el;
781 
782  fMultiSelect = multi;
783  if (!fMultiSelect) {
784  // deselect all entries
785  TIter next(fList);
786  while ((el = (TGFrameElement *) next())) {
787  ((TGLBEntry *)(el->fFrame))->Activate(kFALSE);
788  }
789  }
790  fLastActive = 0;
791  fLastActiveEl = 0;
792  ClearViewPort();
793 }
794 
795 ////////////////////////////////////////////////////////////////////////////////
796 /// Return a pointer to vertical scroll bar.
797 
799 {
800  return fListBox ? fListBox->GetVScrollbar() : 0;
801 }
802 
803 ////////////////////////////////////////////////////////////////////////////////
804 /// Set new vertical scroll bar position.
805 
807 {
808  TGVScrollBar *vb = GetVScrollbar();
809 
810  if (vb && vb->IsMapped()) {
811  vb->SetPosition(newPos);
812  }
813 }
814 
815 ////////////////////////////////////////////////////////////////////////////////
816 /// Handle mouse button event in the listbox container.
817 
819 {
820  int xf0, yf0, xff, yff;
821 
822  TGLBEntry *f;
823  TGFrameElement *el;
824  TGLBEntry *last = fLastActive;
825 
826  TGPosition pos = GetPagePosition();
827  Int_t x = pos.fX + event->fX;
828  Int_t y = pos.fY + event->fY;
829  Bool_t activate = kFALSE;
830 
831  // do not handle "context menu button" during guibuilding
832  if (fClient->IsEditable() && (event->fCode == kButton3)) {
833  return kTRUE;
834  }
835 
836  TGVScrollBar *vb = GetVScrollbar();
837 
838  if ((event->fCode == kButton4) && vb){
839  // scroll 2 lines up (a button down is always followed by a button up)
840  Int_t newpos = vb->GetPosition() - 1;
841  if (newpos < 0) newpos = 0;
842  vb->SetPosition(newpos);
843  ClearViewPort();
844  return kTRUE;
845  }
846  if ((event->fCode == kButton5) && vb) {
847  // scroll 2 lines down (a button down is always followed by a button up)
848  Int_t newpos = vb->GetPosition() + 1;
849  vb->SetPosition(newpos);
850  ClearViewPort();
851  return kTRUE;
852  }
853 
854  gVirtualX->SetInputFocus(fId);
855 
856  if (fMultiSelect) {
857  if (event->fType == kButtonPress) {
858  TIter next(fList);
859  while ((el = (TGFrameElement *) next())) {
860  f = (TGLBEntry *) el->fFrame;
861  xf0 = f->GetX();
862  yf0 = f->GetY();
863  xff = xf0 + f->GetWidth();
864  yff = yf0 + f->GetHeight();
865 
866  activate = fMapSubwindows ? (f->GetId() == (Window_t)event->fUser[0]) :
867  (x > xf0) && (x < xff) && (y > yf0) && (y < yff);
868 
869  if (activate) {
870  fLastActive = f;
871  fLastActiveEl = el;
872  f->Toggle();
873  fChangeStatus = f->IsActive() ? 1 : 0;
875  f->EntryId(), 0);
876  break;
877  }
878  }
879  } else {
880  fChangeStatus = -1;
881  }
882  } else {
883  if (event->fType == kButtonPress) {
884  if (fLastActive) {
886  fLastActive = 0;
887  }
888  TIter next(fList);
889  while ((el = (TGFrameElement *) next())) {
890  f = (TGLBEntry *) el->fFrame;
891  xf0 = f->GetX();
892  yf0 = f->GetY();
893  xff = xf0 + f->GetWidth();
894  yff = yf0 + f->GetHeight();
895 
896  activate = fMapSubwindows ? (f->GetId() == (Window_t)event->fUser[0]) :
897  (x > xf0) && (x < xff) && (y > yf0) && (y < yff) && !f->IsActive();
898 
899  if (activate) {
900  f->Activate(kTRUE);
901  fLastActive = f;
902  fLastActiveEl = el;
903  } else {
904  f->Activate(kFALSE);
905  }
906  }
907  } else {
908  if (fLastActive) {
909  f = fLastActive;
911  f->EntryId(), 0);
912  }
913  }
914  }
915  if (event->fType == kButtonRelease) {
916  fScrolling = kFALSE;
918  }
919  if (fChangeStatus || (last != fLastActive))
920  ClearViewPort();
921  // trick to avoid mouse move events between the mouse click
922  // and the unmapping...
923  if (fListBox->GetParent()->InheritsFrom("TGComboBoxPopup"))
925  return kTRUE;
926 }
927 
928 ////////////////////////////////////////////////////////////////////////////////
929 /// Handle double click mouse event in the listbox container.
930 
932 {
933  if (!fMultiSelect) {
934  if (fLastActive) {
937  f->EntryId(), 0);
938  DoubleClicked(f, ev->fCode);
939  DoubleClicked(f, ev->fCode, ev->fXRoot, ev->fYRoot);
940  }
941  return kTRUE;
942  }
944 }
945 
946 ////////////////////////////////////////////////////////////////////////////////
947 /// Handle mouse motion event in listbox container.
948 
950 {
951  int xf0, yf0, xff, yff;
952 
953  static Long64_t was = gSystem->Now();
954  Long64_t now = gSystem->Now();
955 
956  if ((now-was) < 50) return kFALSE;
957  was = now;
958 
959  TGLBEntry *f;
960  TGFrameElement *el;
961  TGPosition pos = GetPagePosition();
963  Int_t x = pos.fX + event->fX;
964  Int_t y = pos.fY + event->fY;
965  Bool_t activate = kFALSE;
966  TGLBEntry *last = fLastActive;
967 
968  if (fMultiSelect) {
969 
970  if ((event->fY < 10) || (event->fY > Int_t(dim.fHeight) - 10)) {
971  if (!fScrolling) {
972  fScrollTimer->Reset();
974  }
975  fScrolling = kTRUE;
976  }
977  else if (fChangeStatus >= 0) {
978  TIter next(fList);
979  while ((el = (TGFrameElement *) next())) {
980  f = (TGLBEntry *) el->fFrame;
981  xf0 = f->GetX();
982  yf0 = f->GetY();
983  xff = xf0 + f->GetWidth();
984  yff = yf0 + f->GetHeight();
985  activate = fMapSubwindows ? (f->GetId() == (Window_t)event->fUser[0]) :
986  (x > xf0) && (x < xff) && (y > yf0) && (y < yff);
987 
988  if (activate) {
989  if (fChangeStatus != (f->IsActive() ? 1 : 0)) {
990  f->Toggle();
991  ClearViewPort();
993  f->EntryId(), 0);
994  }
995  break;
996  }
997  }
998  }
999  } else if (fListBox->GetParent()->InheritsFrom("TGComboBoxPopup")) {
1000  TIter next(fList);
1001  while ((el = (TGFrameElement *) next())) {
1002  f = (TGLBEntry *) el->fFrame;
1003  xf0 = f->GetX();
1004  yf0 = f->GetY();
1005  xff = xf0 + f->GetWidth();
1006  yff = yf0 + f->GetHeight();
1007 
1008  activate = fMapSubwindows ? (f->GetId() == (Window_t)event->fUser[0]) :
1009  (x > xf0) && (x < xff) && (y > yf0) && (y < yff) && !f->IsActive();
1010 
1011  if (activate) {
1012  f->Activate(kTRUE);
1013  fLastActive = f;
1014  fLastActiveEl = el;
1015  } else {
1016  f->Activate(kFALSE);
1017  }
1018  if (last != fLastActive) {
1019  ClearViewPort();
1020  }
1021  }
1022  }
1023  return kTRUE;
1024 }
1025 
1026 ////////////////////////////////////////////////////////////////////////////////
1027 /// Autoscroll while close to & beyond The Wall
1028 
1030 {
1031  TGFrameElement* el = 0;
1032  TGLBEntry *f = 0;
1033  Int_t yf0, yff;
1034  Bool_t changed = kFALSE;
1035 
1036  TGDimension dim = GetPageDimension();
1037  TGPosition pos = GetPagePosition();
1038 
1039  Window_t dum1, dum2;
1040  Event_t ev;
1041  ev.fType = kButtonPress;
1042  Int_t x, y;
1043 
1044  // Where's the cursor?
1045  gVirtualX->QueryPointer(fId,dum1,dum2,ev.fXRoot,ev.fYRoot,x,y,ev.fState);
1046  TGVScrollBar *vb = GetVScrollbar();
1047  if (vb && y > 0 && y < 10) {
1048  // scroll 1 line up
1049  Int_t newpos = vb->GetPosition() - 1;
1050  if (newpos < 0) newpos = 0;
1051  vb->SetPosition(newpos);
1052  changed = kTRUE;
1053  }
1054  else if (vb && y > (Int_t)dim.fHeight - 10 && y < (Int_t)dim.fHeight) {
1055  // scroll 1 line down
1056  Int_t newpos = vb->GetPosition() + 1;
1057  vb->SetPosition(newpos);
1058  changed = kTRUE;
1059  }
1060  if (changed && fChangeStatus >= 0) {
1061  pos = GetPagePosition();
1062  TIter next(fList);
1063  while ((el = (TGFrameElement *) next())) {
1064  f = (TGLBEntry *) el->fFrame;
1065  yf0 = f->GetY();
1066  yff = yf0 + f->GetHeight();
1067  if ((y + pos.fY > yf0) && (y + pos.fY < yff)) {
1068  if (fChangeStatus != (f->IsActive() ? 1 : 0)) {
1069  f->Toggle();
1070  ClearViewPort();
1072  f->EntryId(), 0);
1073  }
1074  break;
1075  }
1076  }
1077  }
1078 }
1079 
1080 ////////////////////////////////////////////////////////////////////////////////
1081 /// Activate item.
1082 
1084 {
1086  fLastActive = (TGLBEntry *)el->fFrame;
1087 }
1088 
1089 ////////////////////////////////////////////////////////////////////////////////
1090 /// Returns the position in the list box of the entry id.
1091 /// The first position has position no 0. Returns -1 if entry id
1092 /// is not in the list of entries.
1093 
1095 {
1096  Int_t pos = 0;
1097  TGLBEntry *f;
1098  TGFrameElement *el;
1099 
1100  TIter next(fList);
1101  while ((el = (TGFrameElement *) next())) {
1102  f = (TGLBEntry *) el->fFrame;
1103  if (f->EntryId() == id)
1104  return pos;
1105  pos++;
1106  }
1107 
1108  return -1;
1109 }
1110 
1111 
1112 ////////////////////////////////////////////////////////////////////////////////
1113 /// Create a listbox.
1114 
1116  UInt_t options, ULong_t back) :
1117  TGCompositeFrame(p, 10, 10, options, back)
1118 {
1119  fMsgWindow = p;
1120  fWidgetId = id;
1121 
1122  fItemVsize = 1;
1124 
1125  InitListBox();
1126 }
1127 
1128 ////////////////////////////////////////////////////////////////////////////////
1129 /// Delete a listbox widget.
1130 
1132 {
1133  if (!MustCleanup()) {
1134  delete fVScrollbar;
1135  delete fVport;
1136  delete fLbc;
1137  }
1138 }
1139 
1140 ////////////////////////////////////////////////////////////////////////////////
1141 /// Initiate the internal classes of a list box.
1142 
1144 {
1148  fLbc->fViewPort = fVport;
1149  fLbc->Associate(this);
1150  fLbc->SetListBox(this);
1151  SetContainer(fLbc);
1152 
1153  AddFrame(fVport, 0);
1154  AddFrame(fVScrollbar, 0);
1155 
1156  fVScrollbar->Associate(this);
1157 
1162 
1167 
1168  // layout manager is not used
1169  delete fLayoutManager;
1170  fLayoutManager = 0;
1171 }
1172 
1173 ////////////////////////////////////////////////////////////////////////////////
1174 /// Draw borders of the list box widget.
1175 
1177 {
1178  switch (fOptions & (kSunkenFrame | kRaisedFrame | kDoubleBorder)) {
1179 
1180  case kSunkenFrame | kDoubleBorder:
1181  gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
1182  gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
1183  gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, fWidth-3, 1);
1184  gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, 1, fHeight-3);
1185  if (gClient->GetStyle() > 1) break;
1186  gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, fWidth-1, fHeight-1);
1187  gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, fHeight-1, fWidth-1, 0);
1188  gVirtualX->DrawLine(fId, GetBckgndGC()(), 1, fHeight-2, fWidth-2, fHeight-2);
1189  gVirtualX->DrawLine(fId, GetBckgndGC()(), fWidth-2, 1, fWidth-2, fHeight-2);
1190  break;
1191 
1192  default:
1194  break;
1195  }
1196 }
1197 
1198 ////////////////////////////////////////////////////////////////////////////////
1199 /// Add entry with specified string and id to listbox. The id will be
1200 /// used in the event processing routine when the item is selected.
1201 /// The string will be adopted by the listbox.
1202 
1204 {
1205  TGTextLBEntry *lbe;
1206  TGLayoutHints *lhints;
1207 
1208  lbe = new TGTextLBEntry(fLbc, s, id);
1209  lhints = new TGLayoutHints(kLHintsExpandX | kLHintsTop);
1211  fLbc->AddEntry(lbe, lhints);
1212 }
1213 
1214 ////////////////////////////////////////////////////////////////////////////////
1215 /// Add entry with specified string and id to listbox. The id will be
1216 /// used in the event processing routine when the item is selected.
1217 
1218 void TGListBox::AddEntry(const char *s, Int_t id)
1219 {
1220  AddEntry(new TGString(s), id);
1221 }
1222 
1223 ////////////////////////////////////////////////////////////////////////////////
1224 /// Add specified TGLBEntry and TGLayoutHints to listbox. The
1225 /// entry and layout will be adopted and later deleted by the listbox.
1226 
1228 {
1230  fLbc->AddEntry(lbe, lhints);
1231 }
1232 
1233 ////////////////////////////////////////////////////////////////////////////////
1234 /// Add entry with specified string and id to listbox sorted by increasing id.
1235 /// This sorting works properly only if EntrySort functions are used to add
1236 /// entries without mixing them with other add or insert functions. The id will be
1237 /// used in the event processing routine when the item is selected.
1238 /// The string will be adopted by the listbox.
1239 
1241 {
1242  TGTextLBEntry *lbe;
1243  TGLayoutHints *lhints;
1244 
1245  lbe = new TGTextLBEntry(fLbc, s, id);
1246  lhints = new TGLayoutHints(kLHintsExpandX | kLHintsTop);
1248  fLbc->AddEntrySort(lbe, lhints);
1249 }
1250 
1251 ////////////////////////////////////////////////////////////////////////////////
1252 /// Add entry with specified string and id to listbox sorted by increasing id.
1253 /// This sorting works properly only if EntrySort functions are used to add
1254 /// entries without mixing them with other add or insert functions. The id will be
1255 /// used in the event processing routine when the item is selected.
1256 
1257 void TGListBox::AddEntrySort(const char *s, Int_t id)
1258 {
1259  AddEntrySort(new TGString(s), id);
1260 }
1261 
1262 ////////////////////////////////////////////////////////////////////////////////
1263 /// Add specified TGLBEntry and TGLayoutHints to listbox sorted by increasing id.
1264 /// This sorting works properly only if EntrySort functions are used to add
1265 /// entries without mixing them with other add or insert functions. The
1266 /// entry and layout will be adopted and later deleted by the listbox.
1267 
1269 {
1271  fLbc->AddEntrySort(lbe, lhints);
1272 }
1273 
1274 ////////////////////////////////////////////////////////////////////////////////
1275 /// Insert entry with specified string and id behind the entry with afterID.
1276 /// The string will be adopted and later deleted by the listbox.
1277 
1279 {
1280  TGTextLBEntry *lbe;
1281  TGLayoutHints *lhints;
1282 
1283  lbe = new TGTextLBEntry(fLbc, s, id);
1284  lhints = new TGLayoutHints(kLHintsExpandX | kLHintsTop);
1286  fLbc->InsertEntry(lbe, lhints, afterID);
1287 }
1288 
1289 ////////////////////////////////////////////////////////////////////////////////
1290 /// Insert entry with specified string and id behind the entry with afterID.
1291 
1292 void TGListBox::InsertEntry(const char *s, Int_t id, Int_t afterID)
1293 {
1294  InsertEntry(new TGString(s), id, afterID);
1295 }
1296 
1297 ////////////////////////////////////////////////////////////////////////////////
1298 /// method used to add entry via context menu
1299 
1300 void TGListBox::NewEntry(const char *s)
1301 {
1302  Int_t selected = fLbc->GetSelected();
1303 
1304  // no selected entry or the last entry
1305  if ((selected < 0) || (selected == GetNumberOfEntries())) {
1307  } else {
1308  InsertEntry(s, GetNumberOfEntries()+1, selected);
1309  }
1310  Layout();
1311 }
1312 
1313 ////////////////////////////////////////////////////////////////////////////////
1314 /// remove entry with id.
1315 /// If id = -1 - the selected entry/entries is/are removed.
1316 ///
1317 
1319 {
1320  if (id >= 0) {
1321  fLbc->RemoveEntry(id);
1322  Layout();
1323  return;
1324  }
1325  if (!fLbc->GetMultipleSelections()) {
1327  Layout();
1328  return;
1329  }
1330  TList li;
1331  fLbc->GetSelectedEntries(&li);
1332  TGLBEntry *e;
1333  TIter next(&li);
1334 
1335  while ((e = (TGLBEntry*)next())) {
1336  fLbc->RemoveEntry(e->EntryId());
1337  }
1338  Layout();
1339 }
1340 
1341 ////////////////////////////////////////////////////////////////////////////////
1342 /// Remove all entries.
1343 
1345 {
1346  fLbc->RemoveAll();
1347  Layout();
1348 }
1349 
1350 ////////////////////////////////////////////////////////////////////////////////
1351 /// Remove a range of entries defined by from_ID and to_ID.
1352 
1354 {
1355  fLbc->RemoveEntries(from_ID, to_ID);
1356  Layout();
1357 }
1358 
1359 ////////////////////////////////////////////////////////////////////////////////
1360 /// Insert the specified TGLBEntry and layout hints behind afterID.
1361 /// The entry and layout will be adopted and later deleted by the listbox.
1362 
1363 void TGListBox::InsertEntry(TGLBEntry *lbe, TGLayoutHints *lhints, int afterID)
1364 {
1366  fLbc->InsertEntry(lbe, lhints, afterID);
1367 }
1368 
1369 ////////////////////////////////////////////////////////////////////////////////
1370 /// Returns list box entry with specified id.
1371 
1373 {
1374  TIter next(fLbc->GetList());
1375  TGFrameElement *el;
1376 
1377  while ((el = (TGFrameElement *)next())) {
1378  TGLBEntry *lbe = (TGLBEntry *)el->fFrame;
1379  if (lbe->EntryId() == id) return lbe;
1380  }
1381  return 0;
1382 }
1383 
1384 ////////////////////////////////////////////////////////////////////////////////
1385 /// Scroll the entry with id to the top of the listbox.
1386 
1388 {
1389  Int_t idPos;
1390 
1391  idPos = fLbc->GetPos(id);
1392 
1393  // id not found in list of entries
1394  if (idPos < 0)
1395  return;
1396 
1397  // call layout to define the range of the scroll bars
1398  Layout();
1399 
1400  // SetPosition will send a message which will handled by
1401  // the function TGListBox::ProcessMessage. Now ProcessMessage will
1402  // set the viewport. SetPosition also will check that the idPos is
1403  // not out of range.
1404  fVScrollbar->SetPosition(idPos);
1405 }
1406 
1407 ////////////////////////////////////////////////////////////////////////////////
1408 /// Resize the listbox widget. If fIntegralHeight is true make the height
1409 /// an integral number of the maximum height of a single entry.
1410 
1412 {
1413  if (fIntegralHeight)
1415  + (fBorderWidth << 1);
1416 
1418  DoRedraw();
1419 }
1420 
1421 ////////////////////////////////////////////////////////////////////////////////
1422 /// Move and resize the listbox widget.
1423 
1425 {
1426  if (fIntegralHeight)
1428  + (fBorderWidth << 1);
1430  DoRedraw();
1431 }
1432 
1433 ////////////////////////////////////////////////////////////////////////////////
1434 /// Return default size of listbox widget.
1435 
1437 {
1438  UInt_t h;
1439 
1440  if (fIntegralHeight)
1442  + (fBorderWidth << 1);
1443  else
1444  h = fHeight;
1445 
1446  return TGDimension(fWidth, h);
1447 }
1448 
1449 ////////////////////////////////////////////////////////////////////////////////
1450 /// Layout the listbox components.
1451 
1453 {
1454  TGFrame *container;
1455  UInt_t cw, ch, tch;
1456  Bool_t need_vsb;
1457 
1458  need_vsb = kFALSE;
1459 
1460  container = fVport->GetContainer();
1461 
1462  // test whether we need vertical scrollbar or not
1463 
1464  cw = fWidth - (fBorderWidth << 1);
1465  ch = fHeight - (fBorderWidth << 1);
1466 
1467  container->SetWidth(cw);
1468  container->SetHeight(ch);
1469 
1470  if (container->GetDefaultHeight() > ch) {
1471  need_vsb = kTRUE;
1472  cw -= fVScrollbar->GetDefaultWidth();
1473  if ((Int_t) cw < 0) {
1474  Warning("Layout", "width would become too small, setting to 10");
1475  cw = 10;
1476  }
1477  container->SetWidth(cw);
1478  }
1479 
1481  container->Layout();
1482 
1483  tch = TMath::Max(container->GetDefaultHeight(), ch);
1484  container->SetHeight(0); // force a resize in TGFrame::Resize
1485  container->Resize(cw, tch);
1486  //fVport->SetPos(0, 0);
1487 
1488  if (need_vsb) {
1491  } else {
1494  }
1495 
1498  //fClient->NeedRedraw(container);
1499  ((TGContainer *)container)->ClearViewPort();
1500 }
1501 
1502 ////////////////////////////////////////////////////////////////////////////////
1503 /// Sort entries by name
1504 
1506 {
1507  fLbc->GetList()->Sort(ascend);
1508  Layout();
1509  fLbc->ClearViewPort();
1510 }
1511 
1512 ////////////////////////////////////////////////////////////////////////////////
1513 /// Return id of selected listbox item.
1514 
1516 {
1518  return ct->GetSelected();
1519 }
1520 
1521 ////////////////////////////////////////////////////////////////////////////////
1522 /// Adds all selected entries (TGLBEntry) of the list box into
1523 /// the list selected.
1524 
1526 {
1527  fLbc->GetSelectedEntries(selected);
1528 }
1529 
1530 ////////////////////////////////////////////////////////////////////////////////
1531 /// Change background to all entries
1532 
1534 {
1535  fBackground = back;
1536 
1537  TIter next(fLbc->GetList());
1538  TGFrameElement *el;
1539 
1540  while ((el = (TGFrameElement *)next())) {
1541  TGLBEntry *lbe = (TGLBEntry *)el->fFrame;
1542  lbe->SetBackgroundColor(back);
1543  }
1544  fLbc->ClearViewPort();
1545 }
1546 
1547 ////////////////////////////////////////////////////////////////////////////////
1548 /// Process messages generated by the listbox container and forward
1549 /// messages to the listbox message handling window.
1550 
1552 {
1553  switch (GET_MSG(msg)) {
1554  case kC_VSCROLL:
1555  switch (GET_SUBMSG(msg)) {
1556  case kSB_SLIDERTRACK:
1557  case kSB_SLIDERPOS:
1558  fVport->SetVPos(Int_t(-parm1 * fItemVsize));
1559  break;
1560  }
1561  break;
1562 
1563  case kC_CONTAINER:
1564  switch (GET_SUBMSG(msg)) {
1565  case kCT_ITEMCLICK:
1566  {
1568  fWidgetId, parm1);
1570  TGLBEntry *entry = GetSelectedEntry();
1571  if (entry) {
1572  if (entry->InheritsFrom(TGTextLBEntry::Class())) {
1573  const char *text;
1574  text = ((TGTextLBEntry*)entry)->GetText()->GetString();
1575  Selected(text);
1576  }
1577  Selected(fWidgetId, (Int_t) parm1);
1578  Selected((Int_t) parm1);
1579  }
1580  }
1581  break;
1582  case kCT_ITEMDBLCLICK:
1583  if (!GetMultipleSelections()) {
1584  TGLBEntry *entry = GetSelectedEntry();
1585  if (entry) {
1586  if (entry->InheritsFrom(TGTextLBEntry::Class())) {
1587  const char *text;
1588  text = ((TGTextLBEntry*)entry)->GetText()->GetString();
1590  }
1591  DoubleClicked(fWidgetId, (Int_t) parm1);
1592  DoubleClicked((Int_t) parm1);
1593  }
1594  }
1595  break;
1596  }
1597  break;
1598 
1599  default:
1600  break;
1601 
1602  }
1603  return kTRUE;
1604 }
1605 
1606 ////////////////////////////////////////////////////////////////////////////////
1607 /// Emit Selected signal with list box id and entry id.
1608 
1609 void TGListBox::Selected(Int_t widgetId, Int_t id)
1610 {
1611  Long_t args[2];
1612 
1613  args[0] = widgetId;
1614  args[1] = id;
1615 
1616  Emit("Selected(Int_t,Int_t)", args);
1617 }
1618 
1619 ////////////////////////////////////////////////////////////////////////////////
1620 /// Emit DoubleClicked signal with list box id and entry id.
1621 
1623 {
1624  Long_t args[2];
1625 
1626  args[0] = widgetId;
1627  args[1] = id;
1628 
1629  Emit("DoubleClicked(Int_t,Int_t)", args);
1630 }
1631 
1632 ////////////////////////////////////////////////////////////////////////////////
1633 /// Find entry by name.
1634 
1636 {
1637  TList *list = fLbc->GetList();
1638  TGFrameElement *el = (TGFrameElement *)list->First();
1639  while (el) {
1640  if (el->fFrame->GetTitle() == TString(name))
1641  return (TGLBEntry *)el->fFrame;
1642  el = (TGFrameElement *)list->After(el);
1643  }
1644  return 0;
1645 }
1646 
1647 ////////////////////////////////////////////////////////////////////////////////
1648 /// Save a list box widget as a C++ statement(s) on output stream out.
1649 
1650 void TGListBox::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1651 {
1652  if (fBackground != GetWhitePixel()) SaveUserColor(out, option);
1653 
1654  out << std::endl << " // list box" << std::endl;
1655 
1656  out<<" TGListBox *";
1657  out << GetName() << " = new TGListBox(" << fParent->GetName();
1658 
1659  if (fBackground == GetWhitePixel()) {
1660  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
1661  if (fWidgetId == -1) {
1662  out <<");" << std::endl;
1663  } else {
1664  out << "," << fWidgetId << ");" << std::endl;
1665  }
1666  } else {
1667  out << "," << fWidgetId << "," << GetOptionString() <<");" << std::endl;
1668  }
1669  } else {
1670  out << "," << fWidgetId << "," << GetOptionString() << ",ucolor);" << std::endl;
1671  }
1672  if (option && strstr(option, "keep_names"))
1673  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
1674 
1675  if (!fLbc->GetList()) return;
1676 
1677  TGFrameElement *el;
1678  TIter next(fLbc->GetList());
1679 
1680  while ((el = (TGFrameElement *) next())) {
1681  out << " " << GetName() << "->AddEntry(";
1682  el->fFrame->SavePrimitive(out, option);
1683  out << ");"<< std::endl;
1684  }
1685  out << " " << GetName() << "->Resize(" << GetWidth() << "," << GetHeight()
1686  << ");" << std::endl;
1687 }
1688 
1689 ////////////////////////////////////////////////////////////////////////////////
1690 /// Save a list box entry widget as a C++ statement(s) on output stream out.
1691 
1692 void TGTextLBEntry::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
1693 {
1694  TString content = GetText()->GetString();
1695  content.ReplaceAll('\\', "\\\\");
1696  content.ReplaceAll("\"", "\\\"");
1697  char quote = '"';
1698  out << quote << content << quote << "," << EntryId();
1699 }
TGWindow::SetWindowName
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:129
TGListBox::NewEntry
virtual void NewEntry(const char *s="Entry")
method used to add entry via context menu
Definition: TGListBox.cxx:1300
l
auto * l
Definition: textangle.C:4
TGListBox::RemoveEntry
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
Definition: TGListBox.cxx:1318
Event_t::fType
EGEventType fType
of event (see EGEventType)
Definition: GuiTypes.h:175
TGListBox::SetContainer
void SetContainer(TGFrame *f)
Definition: TGListBox.h:234
TGListBox
A listbox is a box, possibly with scrollbar, containing entries.
Definition: TGListBox.h:221
TGIconLBEntry::TGIconLBEntry
TGIconLBEntry(const TGIconLBEntry &)=delete
TGTextLBEntry::GetDefaultGC
static const TGGC & GetDefaultGC()
Return default graphics context in use for a text listbox entry.
Definition: TGListBox.cxx:225
Event_t::fState
UInt_t fState
key or button mask
Definition: GuiTypes.h:181
GET_MSG
Int_t GET_MSG(Long_t val)
Definition: WidgetMessageTypes.h:110
TGLBContainer::TGLBContainer
TGLBContainer(const TGLBContainer &)=delete
kDefaultScrollBarWidth
@ kDefaultScrollBarWidth
Definition: GuiTypes.h:86
TGContainer::DoRedraw
virtual void DoRedraw()
Redraw content of container in the viewport region.
Definition: TGCanvas.cxx:800
TGFrame::GetHeight
UInt_t GetHeight() const
Definition: TGFrame.h:225
TGLBContainer::AddEntrySort
virtual void AddEntrySort(TGLBEntry *lbe, TGLayoutHints *lhints)
Insert listbox entry before the list box entry with a higher id.
Definition: TGListBox.cxx:580
TGTextLBEntry::fgDefaultGC
static TGGC * fgDefaultGC
Definition: TGListBox.h:61
TGLBFrameElement::Compare
Int_t Compare(const TObject *obj) const
Compare abstract method.
Definition: TGListBox.cxx:461
TGVScrollBar::SetRange
virtual void SetRange(Int_t range, Int_t page_size)
Set range of vertical scrollbar.
Definition: TGScrollBar.cxx:892
TGListBox::fItemVsize
UInt_t fItemVsize
maximum height of single entry
Definition: TGListBox.h:228
TGFrameElement::fLayout
TGLayoutHints * fLayout
Definition: TGLayout.h:114
TGLBContainer::HandleDoubleClick
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click mouse event in the listbox container.
Definition: TGListBox.cxx:931
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kSB_SLIDERPOS
@ kSB_SLIDERPOS
Definition: WidgetMessageTypes.h:47
TGPosition::fY
Int_t fY
y position
Definition: TGDimension.h:39
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
e
#define e(i)
Definition: RSha256.hxx:103
Style_t
short Style_t
Definition: RtypesCore.h:89
TGCompositeFrame::GetList
virtual TList * GetList() const
Definition: TGFrame.h:310
TGVScrollBar
The TGVScrollBar will generate the following event messages: kC_VSCROLL, kSB_SLIDERPOS,...
Definition: TGScrollBar.h:164
TGGC::SetLineStyle
void SetLineStyle(Int_t v)
Set line style (kLineSolid, kLineOnOffDash, kLineDoubleDash).
Definition: TGGC.cxx:311
TList::AddFirst
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
Definition: TList.cxx:100
kSB_SLIDERTRACK
@ kSB_SLIDERTRACK
Definition: WidgetMessageTypes.h:46
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
TGGC::GetGC
GContext_t GetGC() const
Definition: TGGC.h:41
f
#define f(i)
Definition: RSha256.hxx:104
TGDimension
Definition: TGDimension.h:18
TGTextLBEntry::fTHeight
UInt_t fTHeight
text height
Definition: TGListBox.h:53
TGTextLBEntry::DrawCopy
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Draw text listbox entry on window/pixmap.
Definition: TGListBox.cxx:164
Option_t
const char Option_t
Definition: RtypesCore.h:66
TMath::Max
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:212
TGPicture::GetWidth
UInt_t GetWidth() const
Definition: TGPicture.h:52
TGLineLBEntry
Line style and width listbox entries.
Definition: TGListBox.h:97
TGLineLBEntry::fLineLength
UInt_t fLineLength
line length
Definition: TGListBox.h:106
kPointerMotionMask
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:163
kLineSolid
@ kLineSolid
Definition: GuiTypes.h:48
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TGLBContainer::SetMultipleSelections
virtual void SetMultipleSelections(Bool_t multi)
Enables and disables multiple selections of entries.
Definition: TGListBox.cxx:778
TSystem::RemoveTimer
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
Definition: TSystem.cxx:483
TString::Data
const char * Data() const
Definition: TString.h:369
kLHintsTop
@ kLHintsTop
Definition: TGLayout.h:27
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
TGFrameElement::fState
Int_t fState
Definition: TGLayout.h:113
TGContainer::fScrolling
Bool_t fScrolling
kTRUE - when scrolling is ON
Definition: TGCanvas.h:59
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGTextLBEntry::fText
TGString * fText
entry text string
Definition: TGListBox.h:51
TGPicture.h
TGFrame::fWidth
UInt_t fWidth
frame width
Definition: TGFrame.h:87
kVerticalFrame
@ kVerticalFrame
Definition: GuiTypes.h:381
FontStruct_t
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
Long64_t
long long Long64_t
Definition: RtypesCore.h:80
TGListBox::fVScrollbar
TGVScrollBar * fVScrollbar
vertical scrollbar
Definition: TGListBox.h:232
TGLineLBEntry::TGLineLBEntry
TGLineLBEntry(const TGLineLBEntry &)=delete
TGWindow::kEditDisableLayout
@ kEditDisableLayout
window layout cannot be edited
Definition: TGWindow.h:53
TGLBEntry::DoRedraw
virtual void DoRedraw()
Redraw the frame.
Definition: TGListBox.h:31
TGLBContainer::DoRedraw
virtual void DoRedraw()
redraw
Definition: TGListBox.cxx:520
TGLineLBEntry::SetLineStyle
virtual void SetLineStyle(Style_t style)
Set the line style corresponding to the TPad line styles.
Definition: TGListBox.cxx:290
TGCompositeFrame::Cleanup
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:967
TGListBox::Selected
virtual void Selected(Int_t widgetId, Int_t id)
Emit Selected signal with list box id and entry id.
Definition: TGListBox.cxx:1609
TGScrollBar::MoveResize
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGScrollBar.h:117
TGListBox::Resize
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1411
TGFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
TGLBContainer::fListBox
TGListBox * fListBox
list box which contains this container
Definition: TGListBox.h:173
kButton4
@ kButton4
Definition: GuiTypes.h:215
GCValues_t
Graphics context structure.
Definition: GuiTypes.h:224
TGTextLBEntry::~TGTextLBEntry
virtual ~TGTextLBEntry()
Delete text listbox entry.
Definition: TGListBox.cxx:156
TGWindow::kEditDisable
@ kEditDisable
disable edit of this window
Definition: TGWindow.h:50
TGFrame::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a frame widget as a C++ statement(s) on output stream out.
Definition: TGFrame.cxx:3207
TGLBEntry::Activate
virtual void Activate(Bool_t a)
Toggle active state of listbox entry.
Definition: TGListBox.cxx:113
TGLineLBEntry::DrawCopy
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Draw copy on window/pixmap.
Definition: TGListBox.cxx:352
TGLBFrameElement::~TGLBFrameElement
virtual ~TGLBFrameElement()
Definition: TGListBox.cxx:458
TGFrame::fOptions
UInt_t fOptions
frame options
Definition: TGFrame.h:94
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
TGLBContainer::GetVScrollbar
virtual TGVScrollBar * GetVScrollbar() const
Return a pointer to vertical scroll bar.
Definition: TGListBox.cxx:798
TGClient::IsEditable
Bool_t IsEditable() const
Definition: TGClient.h:89
GCValues_t::fDashes
Char_t fDashes[8]
dash pattern list (dash length per byte)
Definition: GuiTypes.h:249
kFillSolid
@ kFillSolid
Definition: GuiTypes.h:51
Int_t
int Int_t
Definition: RtypesCore.h:45
TGVScrollBar::SetPosition
virtual void SetPosition(Int_t pos)
Set logical slider position of vertical scrollbar.
Definition: TGScrollBar.cxx:927
GCValues_t::fFillStyle
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
Definition: GuiTypes.h:234
TGTextLBEntry::fTWidth
UInt_t fTWidth
text width
Definition: TGListBox.h:52
TGContainer::GetPageDimension
virtual TGDimension GetPageDimension() const
Returns page dimension.
Definition: TGCanvas.cxx:751
TGCompositeFrame::SetEditDisabled
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1022
event
Definition: triangle.c:553
TGPicture::Draw
void Draw(Option_t *="")
Default Draw method for all objects.
Definition: TGPicture.h:46
x
Double_t x[n]
Definition: legend1.C:17
TGListBox::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a list box widget as a C++ statement(s) on output stream out.
Definition: TGListBox.cxx:1650
TGListBox::GetSelectedEntry
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGListBox.h:288
TGTextLBEntry::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGListBox.h:60
TGFrame::fgWhitePixel
static Pixel_t fgWhitePixel
Definition: TGFrame.h:103
Handle_t
ULongptr_t Handle_t
Generic resource handle.
Definition: GuiTypes.h:26
TGListBox::InsertEntry
virtual void InsertEntry(TGString *s, Int_t id, Int_t afterID)
Insert entry with specified string and id behind the entry with afterID.
Definition: TGListBox.cxx:1278
TVirtualX.h
TGListBox::SetTopEntry
virtual void SetTopEntry(Int_t id=-1)
Scroll the entry with id to the top of the listbox.
Definition: TGListBox.cxx:1387
TGClient::FreePicture
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:310
TGListBox::SelectionChanged
virtual void SelectionChanged()
Definition: TGListBox.h:300
TGListBox::GetContainer
virtual TGFrame * GetContainer() const
Definition: TGListBox.h:267
TGClient::GetResourcePool
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:124
TGListBox::~TGListBox
virtual ~TGListBox()
Delete a listbox widget.
Definition: TGListBox.cxx:1131
TGGC::SetLineWidth
void SetLineWidth(Int_t v)
Set line width.
Definition: TGGC.cxx:300
TObject::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:403
TGListBox::GetDefaultSize
virtual TGDimension GetDefaultSize() const
Return default size of listbox widget.
Definition: TGListBox.cxx:1436
TGListBox::ChangeBackground
virtual void ChangeBackground(Pixel_t back)
Change background to all entries.
Definition: TGListBox.cxx:1533
TGIconLBEntry::Update
virtual void Update(TGLBEntry *e)
Update icon & text listbox entry.
Definition: TGListBox.cxx:416
TGLBContainer::RemoveEntries
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Remove entries from from_ID to to_ID (including).
Definition: TGListBox.cxx:641
TGFrame::GetBlackGC
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:735
TString
Basic string class.
Definition: TString.h:136
TGFrame::GetForeground
virtual Pixel_t GetForeground() const
Return frame foreground color.
Definition: TGFrame.cxx:303
TGFrame::DrawBorder
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:421
TGFrame
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
kButtonPressMask
const Mask_t kButtonPressMask
Definition: GuiTypes.h:161
TGIconLBEntry::SetPicture
virtual void SetPicture(const TGPicture *pic=nullptr)
Change the icon of listbox entry containing icon & text.
Definition: TGListBox.cxx:445
kC_VSCROLL
@ kC_VSCROLL
Definition: WidgetMessageTypes.h:41
kDoubleBorder
@ kDoubleBorder
Definition: GuiTypes.h:385
kCT_ITEMDBLCLICK
@ kCT_ITEMDBLCLICK
Definition: WidgetMessageTypes.h:55
TObject::InheritsFrom
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
TGFrame::SetHeight
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:247
text
TText * text
Definition: entrylist_figure1.C:10
kOwnBackground
@ kOwnBackground
Definition: GuiTypes.h:391
TGLBEntry::SetBackgroundColor
virtual void SetBackgroundColor(Pixel_t col)
Set background color (override from TGWindow base class).
Definition: TGListBox.h:42
TGLBFrameElement::IsSortable
Bool_t IsSortable() const
Definition: TGListBox.cxx:460
TSystem::AddTimer
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Definition: TSystem.cxx:473
TGFrame::MapWindow
virtual void MapWindow()
map window
Definition: TGFrame.h:204
TGLBEntry::TGLBEntry
TGLBEntry(const TGWindow *p=0, Int_t id=-1, UInt_t options=kHorizontalFrame, Pixel_t back=GetWhitePixel())
Base class entry constructor.
Definition: TGListBox.cxx:99
bool
kGCLineStyle
const Mask_t kGCLineStyle
Definition: GuiTypes.h:291
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TGFrame::GetWidth
UInt_t GetWidth() const
Definition: TGFrame.h:224
TGCompositeFrame::fList
TList * fList
container of frame elements
Definition: TGFrame.h:292
id
XFontStruct * id
Definition: TGX11.cxx:109
TGWindow::kEditDisableBtnEnable
@ kEditDisableBtnEnable
window can handle mouse button events
Definition: TGWindow.h:57
TGFrameElement::fFrame
TGFrame * fFrame
Definition: TGLayout.h:112
TGLBContainer::Select
virtual TGLBEntry * Select(Int_t id, Bool_t sel)
Select / deselect the entry with the specified id.
Definition: TGListBox.cxx:702
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2480
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:197
TList::Sort
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
Definition: TList.cxx:937
GContext_t
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
TGListBox::Layout
virtual void Layout()
Layout the listbox components.
Definition: TGListBox.cxx:1452
gClient
#define gClient
Definition: TGClient.h:157
TGContainer::fMsgWindow
const TGWindow * fMsgWindow
window handling container messages
Definition: TGCanvas.h:42
style
TCanvas * style()
Definition: style.C:1
TList::First
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:659
TRefCnt::AddReference
void AddReference()
Definition: TRefCnt.h:40
TGTextLBEntry::fNormGC
GContext_t fNormGC
text drawing graphics context
Definition: TGListBox.h:55
TGString::GetLength
Int_t GetLength() const
Definition: TGString.h:29
TGGC::SetCapStyle
void SetCapStyle(Int_t v)
Set cap style (kCapNotLast, kCapButt, kCapRound, kCapProjecting).
Definition: TGGC.cxx:322
TGFrame::AddInput
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:339
TGIconLBEntry::DoRedraw
virtual void DoRedraw()
Redraw icon & text listbox entry.
Definition: TGListBox.cxx:437
TGFrame::GetHilightGC
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:755
TList::After
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition: TList.cxx:330
TGLBContainer
A Composite frame that contains a list of TGLBEnties.
Definition: TGListBox.h:163
TGScrollBar::GetPosition
virtual Int_t GetPosition() const
Definition: TGScrollBar.h:113
TGLBContainer::OnAutoScroll
virtual void OnAutoScroll()
Autoscroll while close to & beyond The Wall.
Definition: TGListBox.cxx:1029
TGContainer::GetPagePosition
virtual TGPosition GetPagePosition() const
Returns page position.
Definition: TGCanvas.cxx:737
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TGContainer::HandleDoubleClick
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click mouse event.
Definition: TGCanvas.cxx:1098
kLineOnOffDash
@ kLineOnOffDash
Definition: GuiTypes.h:48
TGListBox::RemoveEntries
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Remove a range of entries defined by from_ID and to_ID.
Definition: TGListBox.cxx:1353
TGLBContainer::RemoveAll
virtual void RemoveAll()
Remove all entries in this container.
Definition: TGListBox.cxx:667
TGWindow::kEditDisableGrab
@ kEditDisableGrab
window grab cannot be edited
Definition: TGWindow.h:52
TGLBContainer::fMultiSelect
Bool_t fMultiSelect
true if multi selection is switched on
Definition: TGListBox.h:174
TGLBContainer::GetSelectedEntries
virtual void GetSelectedEntries(TList *selected)
Adds all selected entries (TGLBEntry) of the list box into the list selected.
Definition: TGListBox.cxx:761
TSystem.h
TGPosition::fX
Int_t fX
x position
Definition: TGDimension.h:38
TGLineLBEntry::Update
virtual void Update(TGLBEntry *e)
Update line style listbox entry.
Definition: TGListBox.cxx:278
kGCFillStyle
const Mask_t kGCFillStyle
Definition: GuiTypes.h:294
TGDimension::fHeight
UInt_t fHeight
Definition: TGDimension.h:21
TGLBEntry::Toggle
virtual void Toggle()
Toggle active state of listbox entry.
Definition: TGListBox.cxx:123
TGListBox::GetVScrollbar
virtual TGVScrollBar * GetVScrollbar() const
Definition: TGListBox.h:270
h
#define h(i)
Definition: RSha256.hxx:106
TGContainer::Layout
virtual void Layout()
Layout container entries.
Definition: TGCanvas.cxx:422
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
window which handles widget events
Definition: TGWidget.h:48
kButton3
@ kButton3
Definition: GuiTypes.h:214
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:336
TGViewPort::SetVPos
virtual void SetVPos(Int_t ypos)
Moves content of container frame in vertical direction.
Definition: TGCanvas.cxx:229
TGContainer::fLastActiveEl
TGFrameElement * fLastActiveEl
last active item
Definition: TGCanvas.h:43
TGGC
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:72
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:605
TGObject::fId
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:26
a
auto * a
Definition: textangle.C:12
TGTextLBEntry::SetText
void SetText(TGString *new_text)
Set or change text in text entry.
Definition: TGListBox.cxx:196
TGLBEntry::fActive
Bool_t fActive
true if entry is active
Definition: TGListBox.h:29
Event_t::fCode
UInt_t fCode
key or button code
Definition: GuiTypes.h:180
TGFrame::SendMessage
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:645
TList::AddBefore
virtual void AddBefore(const TObject *before, TObject *obj)
Insert object before object before in the list.
Definition: TList.cxx:196
TGLBEntry::fEntryId
Int_t fEntryId
message id of listbox entry
Definition: TGListBox.h:27
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TGLBEntry::fBkcolor
Pixel_t fBkcolor
entry background color
Definition: TGListBox.h:28
GCValues_t::fLineStyle
Int_t fLineStyle
kLineSolid, kLineOnOffDash, kLineDoubleDash
Definition: GuiTypes.h:230
kCM_LISTBOX
@ kCM_LISTBOX
Definition: WidgetMessageTypes.h:37
TGLBContainer::AddEntry
virtual void AddEntry(TGLBEntry *lbe, TGLayoutHints *lhints)
Add listbox entry with hints to container.
Definition: TGListBox.cxx:529
TGListBox::MoveResize
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize the listbox widget.
Definition: TGListBox.cxx:1424
TGFrame::fBorderWidth
Int_t fBorderWidth
frame border width
Definition: TGFrame.h:93
kButtonPress
@ kButtonPress
Definition: GuiTypes.h:60
Long_t
long Long_t
Definition: RtypesCore.h:54
TGListBox::GetMultipleSelections
virtual Bool_t GetMultipleSelections() const
Definition: TGListBox.h:261
TGLBContainer::GetMultipleSelections
virtual Bool_t GetMultipleSelections() const
Definition: TGListBox.h:215
kButtonReleaseMask
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:162
kButtonRelease
@ kButtonRelease
Definition: GuiTypes.h:60
TGContainer::fScrollTimer
TTimer * fScrollTimer
autoscroll timer
Definition: TGCanvas.h:50
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGFrame::SaveUserColor
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2453
TGIconLBEntry::DrawCopy
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Draw copy on window/pixmap.
Definition: TGListBox.cxx:424
kC_CONTAINER
@ kC_CONTAINER
Definition: WidgetMessageTypes.h:53
TGViewPort
Definition: TGCanvas.h:158
TGLineLBEntry::SetLineWidth
virtual void SetLineWidth(Int_t width)
Set or change line width in an entry.
Definition: TGListBox.cxx:343
kGCLineWidth
const Mask_t kGCLineWidth
Definition: GuiTypes.h:290
GCValues_t::fDashOffset
Int_t fDashOffset
patterned/dashed line information
Definition: GuiTypes.h:248
TGListBox::GetSelected
virtual Int_t GetSelected() const
Return id of selected listbox item.
Definition: TGListBox.cxx:1515
Window_t
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
TGContainer::ClearViewPort
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition: TGCanvas.cxx:891
TSystem::Now
virtual TTime Now()
Get current time in milliseconds since 0:00 Jan 1 1995.
Definition: TSystem.cxx:465
y
Double_t y[n]
Definition: legend1.C:17
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGWindow::kEditDisableKeyEnable
@ kEditDisableKeyEnable
window can handle keyboard events
Definition: TGWindow.h:58
TGTextLBEntry::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use for a text listbox entry.
Definition: TGListBox.cxx:215
TGGC::SetDashList
void SetDashList(const char v[], Int_t len)
Set dash pattern. First use SetDashOffset() if not 0.
Definition: TGGC.cxx:488
TGCompositeFrame::MustCleanup
virtual Int_t MustCleanup() const
Definition: TGFrame.h:361
TGListBox.h
Event_t::fXRoot
Int_t fXRoot
Definition: GuiTypes.h:179
TGFrame::GetBckgndGC
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:775
TGLBEntry
Basic listbox entries.
Definition: TGListBox.h:24
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
TGTextLBEntry::fTextChanged
Bool_t fTextChanged
true if text has been changed
Definition: TGListBox.h:54
TGContainer::DoubleClicked
virtual void DoubleClicked(TGFrame *f, Int_t btn)
Emit DoubleClicked() signal.
Definition: TGCanvas.cxx:538
kGCDashList
const Mask_t kGCDashList
Definition: GuiTypes.h:307
TGListBox::RemoveAll
virtual void RemoveAll()
Remove all entries.
Definition: TGListBox.cxx:1344
Event_t::fYRoot
Int_t fYRoot
coordinates relative to root
Definition: GuiTypes.h:179
kRaisedFrame
@ kRaisedFrame
Definition: GuiTypes.h:384
TGListBox::GetEntry
virtual TGLBEntry * GetEntry(Int_t id) const
Returns list box entry with specified id.
Definition: TGListBox.cxx:1372
TGLBContainer::RemoveEntry
virtual void RemoveEntry(Int_t id)
Remove the entry with specified id from the listbox container.
Definition: TGListBox.cxx:613
TGLBFrameElement
Definition: TGListBox.cxx:455
unsigned int
TGLBContainer::fChangeStatus
Int_t fChangeStatus
defines the changes (select or unselect) while the mouse moves over a multi selectable list box
Definition: TGListBox.h:175
TGIconLBEntry::~TGIconLBEntry
virtual ~TGIconLBEntry()
Delete icon & text listbox entry.
Definition: TGListBox.cxx:408
TGViewPort::GetContainer
TGFrame * GetContainer() const
Definition: TGCanvas.h:173
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
TGListBox::GetNumberOfEntries
virtual Int_t GetNumberOfEntries() const
Definition: TGListBox.h:263
TGLBContainer::Associate
virtual void Associate(const TGWindow *w)
Definition: TGListBox.h:195
TGTextLBEntry::TGTextLBEntry
TGTextLBEntry(const TGTextLBEntry &)=delete
TGListBox::GetSelectedEntries
virtual void GetSelectedEntries(TList *selected)
Adds all selected entries (TGLBEntry) of the list box into the list selected.
Definition: TGListBox.cxx:1525
TGCompositeFrame::fMapSubwindows
Bool_t fMapSubwindows
kTRUE - map subwindows
Definition: TGFrame.h:295
TGWindow::GetParent
const TGWindow * GetParent() const
Definition: TGWindow.h:76
TGWidget::fWidgetId
Int_t fWidgetId
the widget id (used for event processing)
Definition: TGWidget.h:46
TGListBox::TGListBox
TGListBox(const TGListBox &)=delete
TGClient::GetGC
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Definition: TGClient.cxx:322
f1
TF1 * f1
Definition: legend1.C:11
TGLBContainer::InsertEntry
virtual void InsertEntry(TGLBEntry *lbe, TGLayoutHints *lhints, Int_t afterID)
Insert listbox entry after specified entry with id afterID.
Definition: TGListBox.cxx:544
TGLBContainer::Layout
virtual void Layout()
Layout container.
Definition: TGListBox.cxx:511
Double_t
double Double_t
Definition: RtypesCore.h:59
TGLBContainer::GetSelected
virtual Int_t GetSelected() const
Returns id of selected entry.
Definition: TGListBox.cxx:733
TGListBox::FindEntry
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGListBox.cxx:1635
TGContainer
Manages a content area.
Definition: TGCanvas.h:31
TList::AddAfter
virtual void AddAfter(const TObject *after, TObject *obj)
Insert object after object after in the list.
Definition: TList.cxx:250
TGFrame::UnmapWindow
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:206
TGFrame::SetWidth
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:246
TGCompositeFrame::fgDefaultHints
static TGLayoutHints * fgDefaultHints
Definition: TGFrame.h:297
TGTextLBEntry::Update
virtual void Update(TGLBEntry *e)
Definition: TGListBox.h:85
TGLBContainer::ActivateItem
virtual void ActivateItem(TGFrameElement *el)
Activate item.
Definition: TGListBox.cxx:1083
TList::Remove
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:822
t1
auto * t1
Definition: textangle.C:20
TGListBox::fLbc
TGLBContainer * fLbc
listbox container
Definition: TGListBox.h:230
GCValues_t::fMask
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:251
TGObject::fClient
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
TGFrame::MoveResize
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:629
TGListBox::fIntegralHeight
Bool_t fIntegralHeight
true if height should be multiple of fItemVsize
Definition: TGListBox.h:229
TGTextLBEntry::fFontStruct
FontStruct_t fFontStruct
font used to draw string
Definition: TGListBox.h:56
TGLBContainer::fLastActive
TGLBEntry * fLastActive
last active listbox entry in single selection listbox
Definition: TGListBox.h:172
kC_COMMAND
@ kC_COMMAND
Definition: WidgetMessageTypes.h:31
TGLBEntry::EntryId
Int_t EntryId() const
Definition: TGListBox.h:40
TGLineLBEntry::fLineStyle
Style_t fLineStyle
line style
Definition: TGListBox.h:105
TGLBContainer::SetVsbPosition
virtual void SetVsbPosition(Int_t newPos)
Set new vertical scroll bar position.
Definition: TGListBox.cxx:806
TGCompositeFrame::fLayoutManager
TGLayoutManager * fLayoutManager
layout manager
Definition: TGFrame.h:291
TGLBContainer::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in the listbox container.
Definition: TGListBox.cxx:818
GCValues_t::fDashLen
Int_t fDashLen
number of dashes in fDashes
Definition: GuiTypes.h:250
TGListBox::AddEntrySort
virtual void AddEntrySort(TGString *s, Int_t id)
Add entry with specified string and id to listbox sorted by increasing id.
Definition: TGListBox.cxx:1240
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TGListBox::SortByName
virtual void SortByName(Bool_t ascend=kTRUE)
Sort entries by name.
Definition: TGListBox.cxx:1505
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TGLineLBEntry::fLineGC
TGGC * fLineGC
line graphics context
Definition: TGListBox.h:107
TGWindow::SetEditDisabled
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition: TGWindow.h:106
TGContainer::ActivateItem
virtual void ActivateItem(TGFrameElement *el)
Activate item.
Definition: TGCanvas.cxx:701
Event_t
Event structure.
Definition: GuiTypes.h:174
TGListBox::InitListBox
virtual void InitListBox()
Initiate the internal classes of a list box.
Definition: TGListBox.cxx:1143
GET_SUBMSG
Int_t GET_SUBMSG(Long_t val)
Definition: WidgetMessageTypes.h:111
TGIconLBEntry::fPicture
const TGPicture * fPicture
Definition: TGListBox.h:139
name
char name[80]
Definition: TGX11.cxx:110
TGTextLBEntry
Text string listbox entries.
Definition: TGListBox.h:48
TGTextLBEntry::DoRedraw
virtual void DoRedraw()
Redraw text listbox entry.
Definition: TGListBox.cxx:188
TGLineLBEntry::fLineWidth
UInt_t fLineWidth
line width
Definition: TGListBox.h:104
kButton5
@ kButton5
Definition: GuiTypes.h:215
TGString::Draw
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
Definition: TGString.cxx:56
TGFrame::GetWhitePixel
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:709
TGFrameElement
Definition: TGLayout.h:105
TGFrame::GetShadowGC
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:765
TGContainer::fViewPort
TGViewPort * fViewPort
container viewport
Definition: TGCanvas.h:40
TGString::GetString
const char * GetString() const
Definition: TGString.h:30
TIter
Definition: TCollection.h:233
kCT_ITEMCLICK
@ kCT_ITEMCLICK
Definition: WidgetMessageTypes.h:54
TGLineLBEntry::DoRedraw
virtual void DoRedraw()
Redraw line style listbox entry.
Definition: TGListBox.cxx:370
kLHintsExpandX
@ kLHintsExpandX
Definition: TGLayout.h:30
TGLBContainer::GetSelection
virtual Bool_t GetSelection(Int_t id)
Returns kTrue if entry id is selected.
Definition: TGListBox.cxx:742
TGResourcePool.h
TGListBox::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by the listbox container and forward messages to the listbox message handl...
Definition: TGListBox.cxx:1551
TGFont::GetFontStruct
FontStruct_t GetFontStruct() const
Definition: TGFont.h:184
TGListBox::DrawBorder
virtual void DrawBorder()
Draw borders of the list box widget.
Definition: TGListBox.cxx:1176
TGFrame::fHeight
UInt_t fHeight
frame height
Definition: TGFrame.h:88
TGTextLBEntry::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TGListBox.h:81
TGFrame::RemoveInput
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
Definition: TGFrame.cxx:348
TGFrame::fBackground
Pixel_t fBackground
frame background color
Definition: TGFrame.h:95
TGFrame::Activate
virtual void Activate(Bool_t)
Definition: TGFrame.h:210
TGFont
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
TGWindow::fEditDisabled
UInt_t fEditDisabled
flags used for "guibuilding"
Definition: TGWindow.h:32
TGFrame::Layout
virtual void Layout()
Definition: TGFrame.h:199
TGTextLBEntry::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a list box entry widget as a C++ statement(s) on output stream out.
Definition: TGListBox.cxx:1692
TGFrame::fgDefaultSelectedBackground
static Pixel_t fgDefaultSelectedBackground
Definition: TGFrame.h:102
Class
void Class()
Definition: Class.C:29
TGListBox::AddEntry
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
Definition: TGListBox.cxx:1203
TGListBox::GetViewPort
virtual TGViewPort * GetViewPort() const
Definition: TGListBox.h:268
TGPosition
Definition: TGDimension.h:36
TGCompositeFrame
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGResourcePool::GetBlackColor
Pixel_t GetBlackColor() const
Definition: TGResourcePool.h:102
TTimer::Reset
void Reset()
Reset the timer.
Definition: TTimer.cxx:157
TGPicture::GetHeight
UInt_t GetHeight() const
Definition: TGPicture.h:53
TGListBox::fVport
TGViewPort * fVport
listbox viewport (see TGCanvas.h)
Definition: TGListBox.h:231
TGCompositeFrame::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
TGFrame::GetDefaultWidth
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:190
TGString
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
TGResourcePool::GetSelectedFgndColor
Pixel_t GetSelectedFgndColor() const
Definition: TGResourcePool.h:114
TGLBContainer::HandleMotion
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in listbox container.
Definition: TGListBox.cxx:949
TGListBox::DoubleClicked
virtual void DoubleClicked(Int_t widgetId, Int_t id)
Emit DoubleClicked signal with list box id and entry id.
Definition: TGListBox.cxx:1622
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:108
TGLBContainer::~TGLBContainer
virtual ~TGLBContainer()
Delete the listbox container.
Definition: TGListBox.cxx:503
TGLBFrameElement::TGLBFrameElement
TGLBFrameElement(TGFrame *f, TGLayoutHints *l)
Definition: TGListBox.cxx:457
TGWindow::fParent
const TGWindow * fParent
Parent window.
Definition: TGWindow.h:28
TMath::Ceil
Double_t Ceil(Double_t x)
Definition: TMath.h:695
TGLBContainer::GetPos
virtual Int_t GetPos(Int_t id)
Returns the position in the list box of the entry id.
Definition: TGListBox.cxx:1094
TList
A doubly linked list.
Definition: TList.h:44
TQObject::Emit
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
kButtonMotionMask
const Mask_t kButtonMotionMask
Definition: GuiTypes.h:164
TMath.h
GCValues_t::fLineWidth
Int_t fLineWidth
line width
Definition: GuiTypes.h:229
TGLineLBEntry::~TGLineLBEntry
virtual ~TGLineLBEntry()
Delete line style listbox entry.
Definition: TGListBox.cxx:270
kChildFrame
@ kChildFrame
Definition: GuiTypes.h:379
int
TGTextLBEntry::GetText
const TGString * GetText() const
Definition: TGListBox.h:79
TGFrame::DoRedraw
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:430
TGLBContainer::SetListBox
virtual void SetListBox(TGListBox *lb)
Definition: TGListBox.h:196
TGClient::FreeGC
void FreeGC(const TGGC *gc)
Free a graphics context.
Definition: TGClient.cxx:330
TGWindow::IsMapped
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:295