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