Logo ROOT   6.16/01
Reference Guide
TGComboBox.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 13/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// TGComboBox, TGComboBoxPopup //
26// //
27// A combobox (also known as a drop down listbox) allows the selection //
28// of one item out of a list of items. The selected item is visible in //
29// a little window. To view the list of possible items one has to click //
30// on a button on the right of the little window. This will drop down //
31// a listbox. After selecting an item from the listbox the box will //
32// disappear and the newly selected item will be shown in the little //
33// window. //
34// //
35// The TGComboBox is user callable. The TGComboBoxPopup is a service //
36// class of the combobox. //
37// //
38// Selecting an item in the combobox will generate the event: //
39// kC_COMMAND, kCM_COMBOBOX, combobox id, item id. //
40// //
41//////////////////////////////////////////////////////////////////////////
42
43#include "TGComboBox.h"
44#include "TGScrollBar.h"
45#include "TGPicture.h"
46#include "TGResourcePool.h"
47#include "Riostream.h"
48#include "TGTextEntry.h"
49#include "KeySymbols.h"
50#include "RConfigure.h"
51
52
55
59
60////////////////////////////////////////////////////////////////////////////////
61/// Create a combo box popup frame.
62
64 UInt_t options, ULong_t back) :
65 TGCompositeFrame (p, w, h, options, back), fListBox(0), fSelected(0)
66{
68
72 wattr.fSaveUnder = kTRUE;
74 wattr.fBorderWidth = 1;
75 gVirtualX->ChangeWindowAttributes(fId, &wattr);
76
80}
81
82////////////////////////////////////////////////////////////////////////////////
83/// Handle mouse button event in combo box popup.
84
86{
87 if (event->fType == kButtonPress && event->fCode == kButton1) {
88 if ((fListBox != 0) && (fSelected != 0) &&
90 // in the case the combo box popup is closed by clicking outside the
91 // list box, then select the previously selected entry
93 }
94 EndPopup();
95 }
96 else {
97 // reset the dragging flag of the scrollbar when the button is
98 // released outside the scrollbar itself
100 }
101 return kTRUE;
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Ungrab pointer and unmap popup window.
106
108{
109 if (IsMapped()) {
111 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Up),
113 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Down),
115 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Enter),
117 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Return),
119 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Escape),
121 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Space),
123 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);
124 UnmapWindow();
125 }
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Popup combo box popup window at the specified place.
130
132{
133 Int_t rx, ry;
134 UInt_t rw, rh;
135
136 // Parent is root window for the popup:
137 gVirtualX->GetWindowSize(fParent->GetId(), rx, ry, rw, rh);
138
139 if (x < 0) x = 0;
140 if (x + fWidth > rw) x = rw - fWidth;
141 if (y < 0) y = 0;
142 if (y + fHeight > rh) y = rh - fHeight;
143
144 // remember the current selected entry
145 if (fListBox == 0) {
146 // the listbox should be the first in the list
148 fListBox = dynamic_cast<TGListBox *>(el->fFrame);
149 }
151
152 MoveResize(x, y, w, h);
154 Layout();
155 MapRaised();
156
158 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Up),
160 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Down),
162 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Enter),
164 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Return),
166 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Escape),
168 gVirtualX->GrabKey(id, gVirtualX->KeysymToKeycode(kKey_Space),
171
175
176 if (fClient->IsEditable()) {
177 fClient->RegisterPopup(this);
178 }
179
180 fClient->WaitForUnmap(this);
181 EndPopup();
182}
183
184////////////////////////////////////////////////////////////////////////////////
185/// Slot handling the key press events.
186
188{
189 switch ((EKeySym)keysym) {
190 case kKey_Enter:
191 case kKey_Return:
192 case kKey_Space:
193 if (fListBox && f) {
194 TGLBEntry *entry = dynamic_cast<TGLBEntry *>(f);
195 if (entry) {
196 fListBox->Select(entry->EntryId());
198 entry->EntryId(), 0);
199 }
200 }
201 EndPopup();
202 break;
203 case kKey_Escape:
204 if (fListBox)
205 ((TGContainer *)fListBox->GetContainer())->UnSelectAll();
206 EndPopup();
207 break;
208 default:
209 break;
210 }
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Create a combo box widget.
215
217 ULong_t back) :
218 TGCompositeFrame (p, 10, 10, options | kOwnBackground, back)
219{
220 fWidgetId = id;
221 fMsgWindow = p;
222 fTextEntry = 0;
223
224 fSelEntry = new TGTextLBEntry(this, new TGString(""), 0);
226
229 Init();
230}
231
232////////////////////////////////////////////////////////////////////////////////
233/// Create an editable combo box widget.
234
235TGComboBox::TGComboBox(const TGWindow *p, const char *text, Int_t id,
236 UInt_t options, ULong_t back) :
237 TGCompositeFrame (p, 10, 10, options | kOwnBackground, back)
238{
239 fWidgetId = id;
240 fMsgWindow = p;
241 fSelEntry = 0;
242
243 fTextEntry = new TGTextEntry(this, text, id);
245 fTextEntry->Connect("ReturnPressed()", "TGComboBox", this, "ReturnPressed()");
246
249 Init();
250}
251
252////////////////////////////////////////////////////////////////////////////////
253/// Delete a combo box widget.
254
256{
258
259 if (!MustCleanup()) {
265 }
266
269 if (fComboFrame) {
270 fComboFrame->EndPopup(); // force popdown in case of Qt interface
272 }
273}
274
275////////////////////////////////////////////////////////////////////////////////
276/// Initiate the internal classes of a combo box.
277
279{
280 fBpic = fClient->GetPicture("arrow_down.xpm");
281
282 if (!fBpic)
283 Error("TGComboBox", "arrow_down.xpm not found");
284
287
290
292
294
295 fListBox->Resize(100, 100);
296 fListBox->Associate(this);
297 fListBox->GetScrollBar()->GrabPointer(kFALSE); // combobox will do a pointergrab
298
304
307
308 fListBox->GetContainer()->Connect("KeyPressed(TGFrame*, UInt_t, UInt_t)",
309 "TGComboBoxPopup", fComboFrame,
310 "KeyPressed(TGFrame*, UInt_t, UInt_t)");
311 // Drop down listbox of combo box should react to pointer motion
312 // so it will be able to Activate() (i.e. highlight) the different
313 // items when the mouse crosses.
316
323
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Draw border of combo box widget.
329
331{
334 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
335 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
336 gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, fWidth-3, 1);
337 gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, 1, fHeight-3);
338 if (gClient->GetStyle() > 1) break;
339 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, fWidth-1, fHeight-1);
340 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, fHeight-1, fWidth-1, 0);
341 gVirtualX->DrawLine(fId, GetBckgndGC()(), 1, fHeight-2, fWidth-2, fHeight-2);
342 gVirtualX->DrawLine(fId, GetBckgndGC()(), fWidth-2, 1, fWidth-2, fHeight-2);
343 break;
344
345 default:
347 break;
348 }
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Switch text input or readonly mode of combobox (not perfect yet).
353
355{
356 // UInt_t w, h;
357 const char *text = "";
358 Pixel_t back = TGFrame::GetWhitePixel(); // default
359
360 if (on) {
361 if (fSelEntry) {
362 back = fSelEntry->GetBackground();
363 text = ((TGTextLBEntry*)fSelEntry)->GetText()->GetString();
366 }
368 //w = fSelEntry->GetWidth();
369 //h = fSelEntry->GetHeight();
371 delete fSelEntry;
372 fSelEntry = 0;
373 }
374 if (!fTextEntry) {
375 fTextEntry = new TGTextEntry(this, text, 0);
377 fTextEntry->Connect("ReturnPressed()", "TGComboBox", this, "ReturnPressed()");
380 }
383 // coverity[returned_null]
384 // coverity[dereference]
386 } else {
387 if (fTextEntry) {
388 back = fTextEntry->GetBackground();
392 //w = fTextEntry->GetWidth();
393 //h = fTextEntry->GetHeight();
394 delete fTextEntry;
395 fTextEntry = 0;
396 }
397 if (!fSelEntry) {
398 fSelEntry = new TGTextLBEntry(this, new TGString(text), 0);
402 }
405 // coverity[returned_null]
406 // coverity[dereference]
408 }
409}
410
411////////////////////////////////////////////////////////////////////////////////
412/// Find entry by name.
413
415{
416 TGLBEntry *sel = 0;
417 sel = fListBox->FindEntry(s);
418 return sel;
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Set a new combo box value (normally update of text string in
423/// fSelEntry is done via fSelEntry::Update()).
424
426{
427 if (!fSelEntry) return;
428
431 delete fSelEntry;
432 delete fLhs;
433 fSelEntry = e;
434 fLhs = lh;
436 Layout();
437}
438
439////////////////////////////////////////////////////////////////////////////////
440/// Make the selected item visible in the combo box window
441/// and emit signals according to the second parameter.
442
444{
445 if (id!=GetSelected()) {
446 TGLBEntry *e;
447 e = fListBox->Select(id);
448 if (e) {
449 if (fSelEntry) {
451 Layout();
452 } else if (fTextEntry && e->InheritsFrom(TGTextLBEntry::Class())) {
455 }
456 if (emit) {
457 Selected(fWidgetId, id);
458 Selected(id);
459 }
460 }
461 }
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Handle mouse button events in the combo box.
466
468{
469 if (!fDDButton || !fDDButton->IsEnabled()) return kFALSE;
470
471 if (event->fType == kButtonPress) {
472 Window_t child = (Window_t)event->fUser[0]; // fUser[0] = child window
473
474 if (child == fDDButton->GetId() || (fSelEntry && child == fSelEntry->GetId())) {
476
477 if (fTextEntry && (child == fTextEntry->GetId())) {
478 return fTextEntry->HandleButton(event);
479 }
480 int ax, ay;
481 Window_t wdummy;
482 gVirtualX->TranslateCoordinates(fId, fComboFrame->GetParent()->GetId(),
483 0, fHeight, ax, ay, wdummy);
484 // Drop down listbox of combo box should react to pointer motion...
486#ifdef R__HAS_COCOA
487 gVirtualX->SetWMTransientHint(fComboFrame->GetId(), GetId());
488#endif
491#ifdef R__HAS_COCOA
492 //tp: I need this modification - "button" is not repainted correctly
493 //with Cocoa, when combobox is closed (reason is quite complex), happens
494 //when item is wider than combobox.
495 //TODO: find another way :)
497#endif
498 } else if (fTextEntry) {
499 return fTextEntry->HandleButton(event);
500 }
501 }
502 return kTRUE;
503}
504
505////////////////////////////////////////////////////////////////////////////////
506/// Remove entry. If id == -1, the currently selected entry is removed
507
509{
511
512 if (id < 0) {
513 if (fSelEntry) {
514 ((TGTextLBEntry*)fSelEntry)->SetTitle("");
516 } else {
517 fTextEntry->SetTitle("");
519 }
520 }
521 Resize();
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// layout combobox
526
528{
531
532 if (h && (h < 100)) {
534 }
535}
536
537////////////////////////////////////////////////////////////////////////////////
538/// Handle double click in text entry.
539
541{
542 return fTextEntry ? fTextEntry->HandleDoubleClick(event) : kTRUE;
543}
544
545////////////////////////////////////////////////////////////////////////////////
546/// Handle pointer motion in text entry.
547
549{
550 return fTextEntry ? fTextEntry->HandleMotion(event) : kTRUE;
551}
552
553////////////////////////////////////////////////////////////////////////////////
554/// Handle selection in text entry.
555
557{
558 return fTextEntry ? fTextEntry->HandleSelection(event) : kTRUE;
559}
560
561////////////////////////////////////////////////////////////////////////////////
562/// Handle selection request in text entry.
563
565{
567}
568
569////////////////////////////////////////////////////////////////////////////////
570/// Process messages generated by the listbox and forward
571/// messages to the combobox message handling window. Parm2 contains
572/// the id of the selected listbox entry.
573
575{
576 TGLBEntry *e;
577
578 switch (GET_MSG(msg)) {
579 case kC_COMMAND:
580 switch (GET_SUBMSG(msg)) {
581 case kCM_LISTBOX:
583 if (fSelEntry) {
585 } else if (fTextEntry &&
586 e->InheritsFrom(TGTextLBEntry::Class())) {
589 }
590 // coverity[returned_null]
591 // coverity[dereference]
596 fWidgetId, parm2);
597 if (e->InheritsFrom(TGTextLBEntry::Class())) {
598 const char *text;
599 text = ((TGTextLBEntry*)e)->GetText()->GetString();
600 Selected(text);
601 }
602 Selected(fWidgetId, (Int_t)parm2);
603 Selected((Int_t)parm2);
604 fClient->NeedRedraw(this);
605 break;
606 }
607 break;
608
609 default:
610 break;
611 }
612 return kTRUE;
613}
614
615////////////////////////////////////////////////////////////////////////////////
616/// Emit signal.
617
619{
620 Long_t args[2];
621
622 args[0] = widgetId;
623 args[1] = id;
624
625 Emit("Selected(Int_t,Int_t)", args);
626}
627
628////////////////////////////////////////////////////////////////////////////////
629/// Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
630
632{
634 if (on) {
637 } else {
640 }
642}
643
644////////////////////////////////////////////////////////////////////////////////
645/// Add new entry to combo box when return key pressed inside text entry
646/// ReturnPressed signal is emitted.
647
649{
650 if (!fTextEntry) return;
651
654
655 TIter next(lbc->GetList());
656 TGFrameElement *el;
657
658 Emit("ReturnPressed()");
659
660 while ((el = (TGFrameElement *)next())) {
661 TGTextLBEntry *lbe = (TGTextLBEntry *)el->fFrame;
662 if (lbe->GetText()->GetString() == text) {
663 return;
664 }
665 }
666
667 Int_t nn = GetNumberOfEntries() + 1;
668 AddEntry(text.Data(), nn);
669 Select(nn);
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// Remove all entries from combo box.
674
676{
678
679 if (fSelEntry) {
680 ((TGTextLBEntry*)fSelEntry)->SetTitle("");
682 } else {
683 fTextEntry->SetTitle("");
685 }
686}
687
688////////////////////////////////////////////////////////////////////////////////
689/// Save a combo box widget as a C++ statement(s) on output stream out.
690
691void TGComboBox::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
692{
694
695 out << std::endl << " // combo box" << std::endl;
696 out << " TGComboBox *";
697
698 if (!fTextEntry) {
699 out << GetName() << " = new TGComboBox(" << fParent->GetName() << "," << fWidgetId;
700 } else {
701 out << GetName() << " = new TGComboBox(" << fParent->GetName() << ",";
702 out << '\"' << fTextEntry->GetText() << '\"' << "," <<fWidgetId;
703 }
704
705 if (fBackground == GetWhitePixel()) {
707 out <<");" << std::endl;
708 } else {
709 out << "," << GetOptionString() << ");" << std::endl;
710 }
711 } else {
712 out << "," << GetOptionString() << ",ucolor);" << std::endl;
713 }
714 if (option && strstr(option, "keep_names"))
715 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
716
718 TGFrameElement *el;
719 TGListBox *lb = GetListBox();
720
721 TIter next(((TGLBContainer *)lb->GetContainer())->GetList());
722
723 while ((el = (TGFrameElement *) next())) {
724 b = (TGTextLBEntry *) el->fFrame;
725 out << " " << GetName() << "->AddEntry(";
726 b->SavePrimitive(out, option);
727 out << ");" << std::endl;
728 }
729
730 out << " " << GetName() << "->Resize(" << GetWidth() << ","
731 << GetHeight() << ");" << std::endl;
732 out << " " << GetName() << "->Select(" << GetSelected() << ");" << std::endl;
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Create a line style combo box.
737
739 UInt_t options, Pixel_t back)
740 : TGComboBox(p, id, options, back)
741{
742 SetTopEntry(new TGLineLBEntry(this, 0),
745
746 for (Int_t i = 1; i <= 10; i++)
747 AddEntry(new TGLineLBEntry(GetListBox()->GetContainer(), i,
748 TString::Format("%d",i), 0, i),
750
751 Select(1, kFALSE); // to have first entry selected
752
754}
755
756////////////////////////////////////////////////////////////////////////////////
757/// Save a line style combo box widget as a C++ statement(s).
758
759void TGLineStyleComboBox::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
760{
761 out << std::endl << " // line style combo box" << std::endl;
762 out << " TGLineStyleComboBox *";
763
764 out << GetName() << " = new TGLineStyleComboBox(" << fParent->GetName()
765 << "," << fWidgetId << ");" << std::endl;
766 if (option && strstr(option, "keep_names"))
767 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
768 out << " " << GetName() << "->Resize(" << GetWidth() << ","
769 << GetHeight() << ");" << std::endl;
770 out << " " << GetName() << "->Select(" << GetSelected() << ");" << std::endl;
771}
772
773////////////////////////////////////////////////////////////////////////////////
774/// Create a line width combo box.
775/// If "none" is equal to kTRUE the first entry is "None".
776
778 UInt_t options, Pixel_t back, Bool_t none)
779 : TGComboBox(p, id, options, back)
780{
781 SetTopEntry(new TGLineLBEntry(this,0),
784
785 if (none) {
786 AddEntry(new TGLineLBEntry(GetListBox()->GetContainer(), 0, "None", 0, 0),
788 }
789
790 for (Int_t i = 0; i < 16; i++)
791 AddEntry(new TGLineLBEntry(GetListBox()->GetContainer(), i,
792 TString::Format("%d",i), i, 0),
794 Select(1, kFALSE); // to have first entry selected
796}
797
798////////////////////////////////////////////////////////////////////////////////
799/// Save a line width combo box widget as a C++ statement(s).
800
801void TGLineWidthComboBox::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
802{
803 out << std::endl << " // line width combo box" << std::endl;
804 out << " TGLineWidthComboBox *";
805
806 out << GetName() << " = new TGLineWidthComboBox(" << fParent->GetName()
807 << "," << fWidgetId << ");" << std::endl;
808 if (option && strstr(option, "keep_names"))
809 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
810 out << " " << GetName() << "->Resize(" << GetWidth() << ","
811 << GetHeight() << ");" << std::endl;
812 out << " " << GetName() << "->Select(" << GetSelected() << ");" << std::endl;
813}
814
815static const char *gFonts[][2] = { // unix name, name
816 { "", "" }, //not used
817 { "-*-times-medium-i-*-*-12-*-*-*-*-*-*-*", "1. times italic" },
818 { "-*-times-bold-r-*-*-12-*-*-*-*-*-*-*", "2. times bold" },
819 { "-*-times-bold-i-*-*-12-*-*-*-*-*-*-*", "3. times bold italic" },
820 { "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*", "4. helvetica" },
821 { "-*-helvetica-medium-o-*-*-12-*-*-*-*-*-*-*", "5. helvetica italic" },
822 { "-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*", "6. helvetica bold" },
823 { "-*-helvetica-bold-o-*-*-12-*-*-*-*-*-*-*", "7. helvetica bold italic" },
824 { "-*-courier-medium-r-*-*-12-*-*-*-*-*-*-*", "8. courier" },
825 { "-*-courier-medium-o-*-*-12-*-*-*-*-*-*-*", "9. courier italic" },
826 { "-*-courier-bold-r-*-*-12-*-*-*-*-*-*-*", "10. courier bold" },
827 { "-*-courier-bold-o-*-*-12-*-*-*-*-*-*-*", "11. courier bold italic" },
828 { "-*-symbol-medium-r-*-*-12-*-*-*-*-*-*-*", "12. symbol" },
829 { "-*-times-medium-r-*-*-12-*-*-*-*-*-*-*", "13. times" },
830 { 0, 0}
831};
832
833////////////////////////////////////////////////////////////////////////////////
834/// Create a text font combo box.
835
837 UInt_t options, Pixel_t back) :
838 TGComboBox(p, id, options, back)
839{
840 Int_t noFonts = 0;
841
842 for (Int_t i = 1; gFonts[i][0] != 0 && noFonts < kMaxFonts; i++) {
843
844 fFonts[noFonts] = gVirtualX->LoadQueryFont(gFonts[i][0]);
845
846 if (fFonts[noFonts] == 0)
848
849 GCValues_t gval;
850 gval.fMask = kGCFont;
851 gval.fFont = gVirtualX->GetFontHandle(fFonts[noFonts]);
852
853 AddEntry(new TGTextLBEntry(GetListBox()->GetContainer(),
854 new TGString(gFonts[i][1]), i,
855 fClient->GetGC(&gval, kTRUE)->GetGC(), fFonts[noFonts]),
857 noFonts++;
858 }
859
860 if (noFonts < kMaxFonts - 1)
861 fFonts[noFonts] = 0;
862
863 Select(1, kFALSE); // to have first entry selected
865}
866
867////////////////////////////////////////////////////////////////////////////////
868/// Text font combo box dtor.
869
871{
872 for (int i = 0; i < kMaxFonts && fFonts[i] != 0; i++) {
873 if (fFonts[i] != TGTextLBEntry::GetDefaultFontStruct()) gVirtualX->DeleteFont(fFonts[i]);
874 }
875}
void Class()
Definition: Class.C:29
@ kDefaultScrollBarWidth
Definition: GuiTypes.h:85
@ kButtonPress
Definition: GuiTypes.h:59
const Mask_t kWABorderPixel
Definition: GuiTypes.h:141
const Mask_t kWAOverrideRedirect
Definition: GuiTypes.h:148
ULong_t Handle_t
Definition: GuiTypes.h:25
const Mask_t kButtonPressMask
Definition: GuiTypes.h:160
const Mask_t kWASaveUnder
Definition: GuiTypes.h:149
const Mask_t kAnyModifier
Definition: GuiTypes.h:209
const Mask_t kGCFont
Definition: GuiTypes.h:299
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
const Handle_t kNone
Definition: GuiTypes.h:87
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:165
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:161
ULong_t Pixel_t
Definition: GuiTypes.h:39
@ kButton1
Definition: GuiTypes.h:213
Handle_t Window_t
Definition: GuiTypes.h:28
const Mask_t kWABorderWidth
Definition: GuiTypes.h:142
EKeySym
Definition: KeySymbols.h:25
@ kKey_Down
Definition: KeySymbols.h:43
@ kKey_Space
Definition: KeySymbols.h:93
@ kKey_Up
Definition: KeySymbols.h:41
@ kKey_Return
Definition: KeySymbols.h:30
@ kKey_Escape
Definition: KeySymbols.h:26
@ kKey_Enter
Definition: KeySymbols.h:31
#define SafeDelete(p)
Definition: RConfig.hxx:529
#define b(i)
Definition: RSha256.hxx:100
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:363
@ kButtonDown
Definition: TGButton.h:54
@ kButtonUp
Definition: TGButton.h:53
#define gClient
Definition: TGClient.h:166
static const char * gFonts[][2]
Definition: TGComboBox.cxx:815
const Int_t kMaxFonts
Definition: TGComboBox.h:204
@ kChildFrame
Definition: TGFrame.h:57
@ kRaisedFrame
Definition: TGFrame.h:62
@ kSunkenFrame
Definition: TGFrame.h:61
@ kVerticalFrame
Definition: TGFrame.h:59
@ kDoubleBorder
Definition: TGFrame.h:63
@ kHorizontalFrame
Definition: TGFrame.h:60
@ kOwnBackground
Definition: TGFrame.h:69
@ kLHintsRight
Definition: TGLayout.h:33
@ kLHintsExpandY
Definition: TGLayout.h:38
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
@ kWidgetIsEnabled
Definition: TGWidget.h:48
#define gVirtualX
Definition: TVirtualX.h:345
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
@ kCM_COMBOBOX
@ kCT_ITEMCLICK
@ kC_COMMAND
@ kCM_LISTBOX
@ kC_CONTAINER
Int_t GET_SUBMSG(Long_t val)
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:234
Bool_t IsEditable() const
Definition: TGClient.h:98
void RegisterPopup(TGWindow *w)
Add a popup menu to the list of popups.
Definition: TGClient.cxx:532
void WaitForUnmap(TGWindow *w)
Wait for window to be unmapped.
Definition: TGClient.cxx:736
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get graphics context from the gc pool.
Definition: TGClient.cxx:320
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:133
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:289
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:372
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:308
void KeyPressed(TGFrame *, UInt_t, UInt_t)
Slot handling the key press events.
Definition: TGComboBox.cxx:187
TGLBEntry * fSelected
Definition: TGComboBox.h:45
virtual Bool_t HandleButton(Event_t *)
Handle mouse button event in combo box popup.
Definition: TGComboBox.cxx:85
void EndPopup()
Ungrab pointer and unmap popup window.
Definition: TGComboBox.cxx:107
TGComboBoxPopup(const TGComboBoxPopup &)
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
Popup combo box popup window at the specified place.
Definition: TGComboBox.cxx:131
void SetListBox(TGListBox *lb)
Definition: TGComboBox.h:59
TGListBox * fListBox
Definition: TGComboBox.h:44
virtual Int_t GetSelected() const
Definition: TGComboBox.h:134
TGLBEntry * fSelEntry
Definition: TGComboBox.h:74
virtual Bool_t HandleSelectionRequest(Event_t *event)
Handle selection request in text entry.
Definition: TGComboBox.cxx:564
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events in the combo box.
Definition: TGComboBox.cxx:467
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
TGListBox * fListBox
Definition: TGComboBox.h:78
virtual void RemoveAll()
Remove all entries from combo box.
Definition: TGComboBox.cxx:675
virtual void SetTopEntry(TGLBEntry *e, TGLayoutHints *lh)
Set a new combo box value (normally update of text string in fSelEntry is done via fSelEntry::Update(...
Definition: TGComboBox.cxx:425
virtual Bool_t HandleSelection(Event_t *event)
Handle selection in text entry.
Definition: TGComboBox.cxx:556
virtual void RemoveEntry(Int_t id=-1)
Remove entry. If id == -1, the currently selected entry is removed.
Definition: TGComboBox.cxx:508
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:130
virtual ~TGComboBox()
Delete a combo box widget.
Definition: TGComboBox.cxx:255
TGTextEntry * fTextEntry
Definition: TGComboBox.h:75
virtual Bool_t HandleMotion(Event_t *event)
Handle pointer motion in text entry.
Definition: TGComboBox.cxx:548
TGScrollBarElement * fDDButton
Definition: TGComboBox.h:76
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
TGLayoutHints * fLhs
Definition: TGComboBox.h:80
TGLayoutHints * fLhdd
Definition: TGComboBox.h:82
virtual void ReturnPressed()
Add new entry to combo box when return key pressed inside text entry ReturnPressed signal is emitted.
Definition: TGComboBox.cxx:648
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click in text entry.
Definition: TGComboBox.cxx:540
virtual void DrawBorder()
Draw border of combo box widget.
Definition: TGComboBox.cxx:330
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a combo box widget as a C++ statement(s) on output stream out.
Definition: TGComboBox.cxx:691
virtual void SetEnabled(Bool_t on=kTRUE)
Set state of combo box. If kTRUE=enabled, kFALSE=disabled.
Definition: TGComboBox.cxx:631
virtual void Selected(Int_t widgetId, Int_t id)
Emit signal.
Definition: TGComboBox.cxx:618
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGComboBox.cxx:414
TGComboBox(const TGComboBox &)
virtual void EnableTextInput(Bool_t on)
Switch text input or readonly mode of combobox (not perfect yet).
Definition: TGComboBox.cxx:354
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages generated by the listbox and forward messages to the combobox message handling windo...
Definition: TGComboBox.cxx:574
virtual void Layout()
layout combobox
Definition: TGComboBox.cxx:527
virtual Int_t GetNumberOfEntries() const
Definition: TGComboBox.h:127
virtual void Init()
Initiate the internal classes of a combo box.
Definition: TGComboBox.cxx:278
TGComboBoxPopup * fComboFrame
Definition: TGComboBox.h:77
const TGPicture * fBpic
Definition: TGComboBox.h:79
TGLayoutHints * fLhb
Definition: TGComboBox.h:81
virtual TList * GetList() const
Definition: TGFrame.h:369
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual TGLayoutManager * GetLayoutManager() const
Definition: TGFrame.h:397
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
virtual Int_t MustCleanup() const
Definition: TGFrame.h:420
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
TList * fList
Definition: TGFrame.h:351
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:373
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1004
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition: TGFrame.cxx:1131
virtual ~TGFontTypeComboBox()
Text font combo box dtor.
Definition: TGComboBox.cxx:870
TGFontTypeComboBox(const TGWindow *p=0, Int_t id=-1, UInt_t options=kHorizontalFrame|kSunkenFrame|kDoubleBorder, Pixel_t bask=GetWhitePixel())
Create a text font combo box.
Definition: TGComboBox.cxx:836
FontStruct_t fFonts[kMaxFonts]
Definition: TGComboBox.h:209
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:303
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:321
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:717
UInt_t fOptions
Definition: TGFrame.h:141
virtual void MapRaised()
Definition: TGFrame.h:252
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:691
UInt_t fHeight
Definition: TGFrame.h:135
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:403
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:737
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:294
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:627
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
virtual UInt_t GetOptions() const
Definition: TGFrame.h:244
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2460
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:747
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
UInt_t fWidth
Definition: TGFrame.h:134
UInt_t GetHeight() const
Definition: TGFrame.h:272
virtual Pixel_t GetBackground() const
Definition: TGFrame.h:239
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:611
UInt_t GetWidth() const
Definition: TGFrame.h:271
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2433
Pixel_t fBackground
Definition: TGFrame.h:142
static Pixel_t fgBlackPixel
Definition: TGFrame.h:151
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:757
virtual void UnmapWindow()
Definition: TGFrame.h:253
GContext_t GetGC() const
Definition: TGGC.h:50
virtual void SetBackgroundColor(Pixel_t col)
Set background color (override from TGWindow base class).
Definition: TGListBox.h:70
virtual void Update(TGLBEntry *)
Definition: TGListBox.h:67
Int_t EntryId() const
Definition: TGListBox.h:68
virtual void Layout()=0
TGLineStyleComboBox(const TGWindow *p=0, Int_t id=-1, UInt_t options=kHorizontalFrame|kSunkenFrame|kDoubleBorder, Pixel_t back=GetWhitePixel())
Create a line style combo box.
Definition: TGComboBox.cxx:738
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a line style combo box widget as a C++ statement(s).
Definition: TGComboBox.cxx:759
TGLineWidthComboBox(const TGWindow *p=0, Int_t id=-1, UInt_t options=kHorizontalFrame|kSunkenFrame|kDoubleBorder, Pixel_t back=GetWhitePixel(), Bool_t none=kFALSE)
Create a line width combo box.
Definition: TGComboBox.cxx:777
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a line width combo box widget as a C++ statement(s).
Definition: TGComboBox.cxx:801
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
Definition: TGListBox.cxx:1419
virtual TGLBEntry * Select(Int_t id, Bool_t sel=kTRUE)
Definition: TGListBox.h:352
virtual Int_t GetNumberOfEntries() const
Definition: TGListBox.h:331
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGListBox.h:356
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
Definition: TGListBox.cxx:1326
virtual void RemoveAll()
Remove all entries.
Definition: TGListBox.cxx:1352
virtual TGScrollBar * GetScrollBar() const
Definition: TGListBox.h:337
UInt_t GetItemVsize() const
Definition: TGListBox.h:358
virtual TGFrame * GetContainer() const
Definition: TGListBox.h:335
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGListBox.cxx:1643
TGClient * fClient
Definition: TGObject.h:37
Handle_t GetId() const
Definition: TGObject.h:47
Handle_t fId
Definition: TGObject.h:36
Cursor_t GetGrabCursor() const
virtual Bool_t IsEnabled() const
Definition: TGScrollBar.h:73
virtual void SetEnabled(Bool_t on=kTRUE)
Enable/Disable scroll bar button chaging the state.
virtual void SetState(Int_t state)
Change state of scrollbar element (either up or down).
void GrabPointer(Bool_t grab)
Definition: TGScrollBar.h:120
virtual void SetDragging(Bool_t drag)
Definition: TGScrollBar.h:129
const char * GetString() const
Definition: TGString.h:40
virtual Bool_t HandleSelectionRequest(Event_t *event)
Handle request to send current clipboard contents to requestor window.
const char * GetText() const
Definition: TGTextEntry.h:134
virtual void SetTitle(const char *label)
Definition: TGTextEntry.h:170
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in the text entry widget.
virtual void SetFrameDrawn(Bool_t flag=kTRUE)
Sets the text entry to draw itself inside a two-pixel frame if enable is kTRUE, and to draw itself wi...
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
virtual Bool_t HandleSelection(Event_t *event)
Handle text selection event.
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle mouse double click event in the text entry widget.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in text entry widget.
const TGString * GetText() const
Definition: TGListBox.h:115
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use for a text listbox entry.
Definition: TGListBox.cxx:189
Int_t fWidgetId
Definition: TGWidget.h:58
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
Int_t ClearFlags(Int_t flags)
Definition: TGWidget.h:71
Int_t SetFlags(Int_t flags)
Definition: TGWidget.h:70
const TGWindow * fMsgWindow
Definition: TGWidget.h:60
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:118
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:221
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition: TGWindow.h:117
const TGWindow * fParent
Definition: TGWindow.h:37
@ kEditDisableHeight
Definition: TGWindow.h:64
@ kEditDisableLayout
Definition: TGWindow.h:62
@ kEditDisableBtnEnable
Definition: TGWindow.h:66
@ kEditDisableGrab
Definition: TGWindow.h:61
@ kEditDisable
Definition: TGWindow.h:59
@ kEditDisableEvents
Definition: TGWindow.h:60
virtual void DestroyWindow()
Definition: TGWindow.h:92
const TGWindow * GetParent() const
Definition: TGWindow.h:85
virtual void RequestFocus()
Definition: TGWindow.h:98
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:180
UInt_t fEditDisabled
Definition: TGWindow.h:41
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:655
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:867
Basic string class.
Definition: TString.h:131
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2286
TText * text
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double s
EGEventType fType
Definition: GuiTypes.h:174
Long_t fUser[5]
Definition: GuiTypes.h:186
UInt_t fCode
Definition: GuiTypes.h:179
Mask_t fMask
Definition: GuiTypes.h:250
FontH_t fFont
Definition: GuiTypes.h:241
Bool_t fOverrideRedirect
Definition: GuiTypes.h:106
ULong_t fBorderPixel
Definition: GuiTypes.h:96