Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGTab.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/** \class TGTab
25 \ingroup guiwidgets
26
27A tab widget contains a set of composite frames each with a little
28tab with a name (like a set of folders with tabs).
29
30Clicking on a tab will bring the associated composite frame to the
31front and generate the following event:
32kC_COMMAND, kCM_TAB, tab id, 0.
33
34\class TGTabElement
35\ingroup guiwidgets
36Service classes of the tab widget.
37
38\class TGTabLayout
39\ingroup guiwidgets
40Service classes of the tab widget.
41
42*/
43
44
45#include "TGTab.h"
46#include "TGResourcePool.h"
47#include "TList.h"
48#include "TClass.h"
49#include "TGPicture.h"
50#include "TVirtualX.h"
51
52#include <iostream>
53
54const TGFont *TGTab::fgDefaultFont = nullptr;
55const TGGC *TGTab::fgDefaultGC = nullptr;
56
57
58
59////////////////////////////////////////////////////////////////////////////////
60/// Create a tab element. Text is adopted by tab element.
61
64 UInt_t options, Pixel_t back) :
65 TGFrame(p, w, h, options, back)
66{
67 fClosePic = 0;
68 fClosePicD = 0;
71 fText = text;
72 fBorderWidth = 0;
73 fTWidth = 0;
74 fNormGC = norm;
75 fFontStruct = font;
77
78 fClosePic = fClient->GetPicture("closetab.png");
79 fClosePicD = fClient->GetPicture("closetab_d.png");
81 if (fText)
83 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
85 Resize(std::max(fTWidth+12, (UInt_t)45), fTHeight+6);
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Delete tab element.
93
95{
96 if (fClosePic) gClient->FreePicture(fClosePic);
97 if (fClosePicD) gClient->FreePicture(fClosePicD);
98 if (fText) delete fText;
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Draw little tab element.
103
105{
106 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, 0, 2);
107 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, 2, 2, 0);
108 gVirtualX->DrawLine(fId, GetHilightGC()(), 2, 0, fWidth-3, 0);
109 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth-2, 1, fWidth-2, fHeight-1);
110 if (gClient->GetStyle() < 2) {
111 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth-2, 1, fWidth-1, 2);
112 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth-1, 2, fWidth-1, fHeight-2);
113 }
114 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, fHeight-1, fWidth-1, fHeight-1);
115
116 if (fText) {
118 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
119 if (fEnabled) {
121 } else {
122 fText->Draw(fId, GetHilightGC()(), 7, max_ascent + 1);
124 }
125 }
126 if (fShowClose && fClosePic && fClosePicD) {
127 if (fEnabled && fActive)
128 fClosePic->Draw(fId, fNormGC, fTWidth+12, fHeight/2-7);
129 else
130 fClosePicD->Draw(fId, fNormGC, fTWidth+12, fHeight/2-7);
131 }
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// Handle button event in the tab widget. Basically we only handle
136/// button and scroll events in the small tabs.
137
139{
140 if (event->fCode == kButton4 || event->fCode == kButton5) { //scroll wheel events
141 if (fParent) {
142 TGTab* main = (TGTab*)fParent;
143 if (main->IsScrollingEnabled())
144 {
145 if (event->fCode == kButton4) { //scroll up = move left, as in Firefox
146 for (Int_t c = main->GetCurrent() - 1; c >= 0; --c) {
147 if (main->GetTabTab(c)->IsEnabled()) {
148 // change tab and generate event
149 main->SetTab(c);
150 break;
151 }
152 }
153 } else if (event->fCode == kButton5) { //scroll down = move right, as in Firefox
154 for (Int_t c = main->GetCurrent() + 1; c < main->GetNumberOfTabs(); ++c) {
155 if (main->GetTabTab(c)->IsEnabled()) {
156 // change tab and generate event
157 main->SetTab(c);
158 break;
159 }
160 }
161 }
162 }
163 }
164 } else if (event->fType == kButtonPress) { //normal button press events
165 TGTab* main = (TGTab*)fParent;
166 if (main) {
167 if (fShowClose && event->fWindow == GetId() &&
168 (UInt_t)event->fX > fTWidth+12 && (UInt_t)event->fX < fTWidth+26 &&
169 (UInt_t)event->fY > fHeight/2-7 && (UInt_t)event->fY < fHeight/2+7) {
170 if (main->GetTabTab(main->GetCurrent()) == this) {
171 main->CloseTab(main->GetCurrent()); // emit signal
172 //main->RemoveTab(main->GetCurrent());
173 return kTRUE;
174 }
175 }
177 TIter next(main->GetList());
178
179 next(); // skip first container
180
181 Int_t i = 0;
182 Int_t c = main->GetCurrent();
183 while ((el = (TGFrameElement *) next())) {
184 if (el->fFrame->GetId() == (Window_t)event->fWindow)
185 c = i;
186 next(); i++;
187 }
188
189 // change tab and generate event
190 main->SetTab(c);
191 }
192 }
193 return kTRUE;
194}
195
196////////////////////////////////////////////////////////////////////////////////
197/// Return default size of tab element.
198
200{
202 return TGDimension(std::max(fTWidth+30, (UInt_t)45), fTHeight+6);
203 else
204 return TGDimension(std::max(fTWidth+12, (UInt_t)45), fTHeight+6);
205}
206
207////////////////////////////////////////////////////////////////////////////////
208/// Set new tab text.
209
211{
212 if (fText) delete fText;
213 fText = text;
214
217 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
219
220 fClient->NeedRedraw(this);
221}
222
223////////////////////////////////////////////////////////////////////////////////
224/// Show/hide close icon on the tab element, then apply layout
225/// to compute correct elements size.
226
228{
229 TGTab* main = (TGTab*)fParent;
232 Resize(std::max(fTWidth+30, (UInt_t)45), fTHeight+6);
233 else
234 Resize(std::max(fTWidth+12, (UInt_t)45), fTHeight+6);
235 if (main)
236 main->GetLayoutManager()->Layout();
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// Create a tab layout manager.
241
247
248////////////////////////////////////////////////////////////////////////////////
249/// Layout the tab widget.
250
252{
253 Int_t i, xtab;
254 UInt_t tw;
256 UInt_t w = fMain->GetWidth();
257 UInt_t h = fMain->GetHeight();
258
259 xtab = 2;
260
262
263 // first frame is the container, so take next...
265 TIter next(fList);
266 i = 0;
267 next(); // skip first
268 while ((el = (TGFrameElement *) next())) {
269 elnxt = (TGFrameElement *) next();
270 tw = el->fFrame->GetDefaultWidth();
271 if (i == fMain->GetCurrent()) {
272 el->fFrame->MoveResize(xtab-2, 0, tw+3, tabh+1);
273 if (elnxt) elnxt->fFrame->RaiseWindow();
274 el->fFrame->RaiseWindow();
275 } else {
276 el->fFrame->MoveResize(xtab, 2, tw, tabh-1);
277 el->fFrame->LowerWindow();
278 }
279 UInt_t nw = (w - (bw << 1));
280 if (nw > 32768) nw = 1;
281 UInt_t nh = (h - tabh - (bw << 1));
282 if (nh > 32768) nh = 1;
283 if (elnxt) {
284 elnxt->fFrame->MoveResize(bw, tabh + bw, nw, nh);
285 elnxt->fFrame->Layout();
286 }
287 xtab += (Int_t)tw;
288 i++;
289 }
290}
291
292////////////////////////////////////////////////////////////////////////////////
293/// Get default size of tab widget.
294
296{
298 TGDimension size(0,0), size_te(0,0);
299
301 TIter next(fList);
302 next(); // skip first container
303 while ((el = (TGFrameElement *)next())) {
304 dsize_te = el->fFrame->GetDefaultSize();
305 size_te.fWidth += dsize_te.fWidth;
306 elnxt = (TGFrameElement *) next();
307 if (elnxt) {
308 dsize = elnxt->fFrame->GetDefaultSize();
309 if (size.fWidth < dsize.fWidth) size.fWidth = dsize.fWidth;
310 if (size.fHeight < dsize.fHeight) size.fHeight = dsize.fHeight;
311 }
312 }
313
314 // check if tab elements make a larger width than the containers
315 if (size.fWidth < size_te.fWidth) size.fWidth = size_te.fWidth;
316
317 size.fWidth += fMain->GetBorderWidth() << 1;
318 size.fHeight += fMain->GetTabHeight() + (fMain->GetBorderWidth() << 1);
319
320 return size;
321}
322
323
324////////////////////////////////////////////////////////////////////////////////
325/// Create tab widget.
326
329 UInt_t options, Pixel_t back) :
330 TGCompositeFrame(p, w, h, options, back)
331{
332 fMsgWindow = p;
333
334 fBorderWidth = 2;
335 fCurrent = 0;
336 fRemoved = new TList;
337
338 fNormGC = norm;
339 fFontStruct = font;
340
342
344 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
346
347 SetLayoutManager(new TGTabLayout(this));
348
349 // we need this in order to avoid border blinking when switching tabs...
353
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Delete tab widget. This deletes the tab windows and the containers.
360/// The tab string is deleted by the TGTabElement dtor.
361
363{
364 Cleanup();
365 fRemoved->Delete();
366 delete fRemoved;
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Add a tab to the tab widget. Returns the new container, which
371/// is owned by the tab widget. The text is adopted by the tab widget.
372
374{
375 TGTabElement *te = new TGTabElement(this, text, 50, 20, fNormGC, fFontStruct);
376 AddFrame(te, 0);
377
379 AddFrame(cf, 0);
380 cf->SetEditDisabled(kEditDisableResize);
381
382 te->MapWindow();
383 cf->MapWindow();
384
385 return cf;
386}
387
388////////////////////////////////////////////////////////////////////////////////
389/// Add a tab to the tab widget. Returns the new container. The container
390/// is owned by the tab widget.
391
393{
394 return AddTab(new TGString(text));
395}
396
397////////////////////////////////////////////////////////////////////////////////
398/// Add a tab to the tab widget and fill it with given TGCompositeFrame.
399
401{
402 AddTab(new TGString(text), cf);
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Add a tab to the tab widget and fill it with given TGCompositeFrame.
407
409{
410 TGTabElement *te = new TGTabElement(this, text, 50, 20, fNormGC, fFontStruct);
411 AddFrame(te, 0);
412
413 AddFrame(cf, 0);
414 cf->SetEditDisabled(kEditDisableResize);
415
416 te->MapWindow();
417 cf->MapWindow();
418}
419
420////////////////////////////////////////////////////////////////////////////////
421/// Remove container and tab of tab with index tabIndex.
422/// Does NOT remove the container contents!
423
425{
426 if (tabIndex < 0) {
428 }
429
431 Int_t count = 0;
432
433 // Notify (signal) for removed tab "tabIndex"
435
436 TIter next(fList) ;
437 next() ; // skip first container
438
439 while ((elTab = (TGFrameElement *) next())) {
440 elCont = (TGFrameElement *) next();
441
442 if (count == tabIndex) {
443 elCont->fFrame->UnmapWindow(); // will be destroyed later
444 TGFrame *frame = elTab->fFrame;
445 RemoveFrame(elTab->fFrame);
446 frame->DestroyWindow();
447 delete frame;
448 if (storeRemoved)
449 fRemoved->Add(elCont->fFrame); // delete only in dtor
450 RemoveFrame(elCont->fFrame);
451 if (tabIndex == fCurrent) {
452 // select another tab only if the current is the one we delete
453 SetTab(0);
454 } else
455 fCurrent--;
456 break;
457 }
458 count++;
459 }
460
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Enable or disable tab.
466
468{
470 if (te) {
471 te->SetEnabled(on);
473 }
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Returns true if tab scrolling is enabled.
478
480{
481 return fScrolling;
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Enable or disable tab scrolling.
486
491
492////////////////////////////////////////////////////////////////////////////////
493/// Returns true if tab is enabled.
494
496{
498
499 return te ? te->IsEnabled() : kFALSE;
500}
501
502////////////////////////////////////////////////////////////////////////////////
503/// Make tabIdx the current tab. Utility method called by SetTab and
504/// HandleButton().
505
507{
509 if (!te || !te->IsEnabled()) return;
510
511 if (tabIndex != fCurrent) {
512 if (GetTabTab(fCurrent)) {
515 }
517 UInt_t tw;
518 Int_t xtab = 2;
519 Int_t count = 0;
520
521 TIter next(fList);
522 next(); // skip first container
523
525 while ((el = (TGFrameElement *) next())) {
526 elnxt = (TGFrameElement *) next();
527 tw = el->fFrame->GetDefaultWidth();
528 if (count == fCurrent) {
529 el->fFrame->MoveResize(xtab-2, 0, tw+3, fTabh+1);
530 if (elnxt) elnxt->fFrame->RaiseWindow();
531 el->fFrame->RaiseWindow();
532 } else {
533 el->fFrame->MoveResize(xtab, 2, tw, fTabh-1);
534 el->fFrame->LowerWindow();
535 }
536 xtab += tw;
537 count++;
538 }
539 if (emit) {
543 }
546 }
547}
548
549////////////////////////////////////////////////////////////////////////////////
550/// Brings the composite frame with the index tabIndex to the
551/// front and generate the following event if the front tab has changed:
552/// kC_COMMAND, kCM_TAB, tab id, 0.
553/// Returns kFALSE if tabIndex is a not valid index
554
556{
557 // check if tabIndex is a valid index
558 if (tabIndex < 0)
559 return kFALSE;
560
561 // count the tabs
562 TIter next(fList);
563 Int_t count = 0;
564 while (next())
565 count++;
566
567 count = count / 2 - 1;
568 if (tabIndex > count)
569 return kFALSE;
570
571 // change tab and generate event
573
574 return kTRUE;
575}
576
577////////////////////////////////////////////////////////////////////////////////
578/// Brings the composite frame with the name to the
579/// front and generate the following event if the front tab has changed:
580/// kC_COMMAND, kCM_TAB, tab id, 0.
581/// Returns kFALSE if tab with name does not exist.
582
584{
586 Int_t count = 0;
587 TGTabElement *tab = 0;
588
589 TIter next(fList);
590 next(); // skip first container
591
592 while ((el = (TGFrameElement *) next())) {
593 next(); // skip tab container
594 tab = (TGTabElement *)el->fFrame;
595
596 if (*(tab->GetText()) == name) {
597 // change tab and generate event
598 ChangeTab(count, emit);
599 return kTRUE;
600 }
601 count++;
602 }
603
604 return kFALSE;
605}
606
607////////////////////////////////////////////////////////////////////////////////
608/// Return container of tab with index tabIndex.
609/// Return 0 in case tabIndex is out of range.
610
612{
613 if (tabIndex < 0) return 0;
614
616 Int_t count = 0;
617
618 TIter next(fList);
619 next(); // skip first container
620
621 while (next()) {
622 el = (TGFrameElement *) next();
623 if (el && count == tabIndex)
624 return (TGCompositeFrame *) el->fFrame;
625 count++;
626 }
627
628 return 0;
629}
630
631////////////////////////////////////////////////////////////////////////////////
632/// Return the tab container of tab with string name.
633/// Returns 0 in case name is not found.
634
636{
638 TGTabElement *tab = 0;
640
641 TIter next(fList);
642 next();
643
644 while ((el = (TGFrameElement *) next())) {
645 tab = (TGTabElement *) el->fFrame;
646 el = (TGFrameElement *) next();
647 comp = (TGCompositeFrame *) el->fFrame;
648 if (*tab->GetText() == name){
649 return comp;
650 }
651 }
652
653 return 0;
654}
655
656////////////////////////////////////////////////////////////////////////////////
657/// Return the tab element of tab with index tabIndex.
658/// Returns 0 in case tabIndex is out of range.
659
661{
662 if (tabIndex < 0) return 0;
663
665 Int_t count = 0;
666
667 TIter next(fList);
668 next(); // skip first container
669
670 while ((el = (TGFrameElement *) next())) {
671 next();
672 if (count == tabIndex)
673 return (TGTabElement *) el->fFrame;
674 count++;
675 }
676
677 return 0;
678}
679
680////////////////////////////////////////////////////////////////////////////////
681/// Return the tab element of tab with string name.
682/// Returns 0 in case name is not found.
683
685{
687 TGTabElement *tab = 0;
688
689 TIter next(fList);
690 next();
691
692 while ((el = (TGFrameElement *) next())) {
693 tab = (TGTabElement *)el->fFrame;
694 if (name == *(tab->GetText())) {
695 return tab;
696 }
697 next();
698 }
699
700 return 0;
701}
702
703////////////////////////////////////////////////////////////////////////////////
704/// Return number of tabs.
705
707{
708 Int_t count = 0;
709
710 TIter next(fList);
711 next(); // skip first container
712
713 while (next()) {
714 next();
715 count++;
716 }
717
718 return count;
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Return default font structure in use.
723
725{
726 if (!fgDefaultFont)
727 fgDefaultFont = gClient->GetResourcePool()->GetDefaultFont();
728 return fgDefaultFont->GetFontStruct();
729}
730
731////////////////////////////////////////////////////////////////////////////////
732/// Return default graphics context in use.
733
735{
736 if (!fgDefaultGC)
737 fgDefaultGC = gClient->GetResourcePool()->GetFrameGC();
738 return *fgDefaultGC;
739}
740
741////////////////////////////////////////////////////////////////////////////////
742/// Create new tab. Used in context menu.
743
744void TGTab::NewTab(const char *text)
745{
747 if (text)
748 name = text;
749 else
750 name = TString::Format("tab%d", GetNumberOfTabs()+1);
751 AddTab(name.Data());
752
754}
755
756////////////////////////////////////////////////////////////////////////////////
757/// Set text to current tab.
758
759void TGTab::SetText(const char *text)
760{
763}
764
765////////////////////////////////////////////////////////////////////////////////
766/// Return layout manager.
767
769{
770 TGTab *tab = (TGTab*)this;
771
772 if (tab->fLayoutManager->IsA() != TGTabLayout::Class()) {
773 tab->SetLayoutManager(new TGTabLayout(tab));
774 }
775
776 return tab->fLayoutManager;
777}
778
779////////////////////////////////////////////////////////////////////////////////
780/// Save a tab widget as a C++ statement(s) on output stream out.
781
782void TGTab::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
783{
784 // font + GC
785 option = GetName() + 5; // unique digit id of the name
787 parFont.Form("%s::GetDefaultFontStruct()", IsA()->GetName());
788 parGC.Form("%s::GetDefaultGC()()", IsA()->GetName());
789
790 if ((GetDefaultFontStruct() != fFontStruct) || (GetDefaultGC()() != fNormGC)) {
791 TGFont *ufont = gClient->GetResourcePool()->GetFontPool()->FindFont(fFontStruct);
792 if (ufont) {
793 ufont->SavePrimitive(out, option);
794 parFont.Form("ufont->GetFontStruct()");
795 }
796
797 TGGC *userGC = gClient->GetResourcePool()->GetGCPool()->FindGC(fNormGC);
798 if (userGC) {
799 userGC->SavePrimitive(out, option);
800 parGC.Form("uGC->GetGC()");
801 }
802 }
803
804 auto extra_args = SaveCtorArgs(out);
805
806 out << "\n // tab widget\n";
807
808 out << " TGTab *" << GetName() << " = new TGTab(" << fParent->GetName() << "," << GetWidth() << "," << GetHeight();
809
810 if (!extra_args.IsNull() || (fFontStruct != GetDefaultFontStruct()))
811 out << "," << parGC << "," << parFont << extra_args;
812 else if (fNormGC != GetDefaultGC()())
813 out << "," << parGC;
814 out << ");\n";
815
816 if (option && strstr(option, "keep_names"))
817 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
818
819 for (Int_t i = 0; i < GetNumberOfTabs(); i++) {
820 auto cf = GetTabContainer(i);
821 if (!cf || !GetTabTab(i))
822 continue;
823 out << "\n // container of \"" << GetTabTab(i)->GetString() << "\"\n";
824 out << " TGCompositeFrame *" << cf->GetName() << " = " << GetName() << "->AddTab(\""
825 << GetTabTab(i)->GetString() << "\");\n";
826 auto lm = cf->GetLayoutManager();
827 if (lm) {
828 if (!((cf->GetOptions() & kHorizontalFrame) && lm->InheritsFrom(TGHorizontalLayout::Class())) &&
829 !((GetOptions() & kVerticalFrame) && lm->InheritsFrom(TGVerticalLayout::Class()))) {
830 out << " " << cf->GetName() << "->SetLayoutManager(";
831 lm->SavePrimitive(out, option);
832 out << ");\n";
833 }
834 if (!IsEnabled(i)) {
835 out << " " << GetName() << "->SetEnabled(" << i << ", kFALSE);\n";
836 }
837 }
838 cf->SavePrimitiveSubframes(out, option);
839
840 if (GetTabTab(i)->IsCloseShown()) {
841 out << " TGTabElement *tab" << i << " = " << GetName() << "->GetTabTab(" << i << ");\n";
842 out << " tab" << i << "->ShowClose(kTRUE);\n";
843 }
846 out << " TGTabElement *tab" << i << " = " << GetName() << "->GetTabTab(" << i << ");\n";
847 out << " tab" << i << "->ChangeBackground(ucolor);\n";
848 }
849 }
850 out << "\n " << GetName() << "->SetTab(" << GetCurrent() << ");\n";
851 out << " " << GetName() << "->Resize(" << GetName() << "->GetDefaultSize());\n";
852}
853
854// __________________________________________________________________________
855void TGTabLayout::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
856{
857 // Save tab layout manager as a C++ statement(s) on out stream.
858
859 out << "new TGTabLayout(" << fMain->GetName() << ")";
860
861}
@ kButtonPress
Definition GuiTypes.h:60
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
const Mask_t kAnyModifier
Definition GuiTypes.h:210
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kRaisedFrame
Definition GuiTypes.h:384
@ kVerticalFrame
Definition GuiTypes.h:381
@ kDoubleBorder
Definition GuiTypes.h:385
@ kHorizontalFrame
Definition GuiTypes.h:382
const Handle_t kNone
Definition GuiTypes.h:88
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton4
Definition GuiTypes.h:215
@ kButton5
Definition GuiTypes.h:215
@ kAnyButton
Definition GuiTypes.h:214
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
int main()
Definition Prototype.cxx:12
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gClient
Definition TGClient.h:157
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition TGX11.cxx:110
#define gVirtualX
Definition TVirtualX.h:337
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
@ kCM_TAB
@ kC_COMMAND
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
Definition TGClient.cxx:922
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:380
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:992
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
virtual TList * GetList() const
Definition TGFrame.h:312
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:959
TGCompositeFrame(const TGCompositeFrame &)=delete
TList * fList
container of frame elements
Definition TGFrame.h:294
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1141
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1014
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:621
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:727
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
Int_t GetBorderWidth() const
Definition TGFrame.h:235
UInt_t fHeight
frame height
Definition TGFrame.h:88
Int_t fBorderWidth
frame border width
Definition TGFrame.h:93
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:747
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:675
virtual UInt_t GetOptions() const
Definition TGFrame.h:199
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:637
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:757
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:227
TString SaveCtorArgs(std::ostream &out, UInt_t dflt_options=kChildFrame, Bool_t check_white_pixel=kFALSE)
Return options and custom color as constructor args Used in the SavePrimitive methods,...
Definition TGFrame.cxx:2493
virtual Pixel_t GetBackground() const
Definition TGFrame.h:194
UInt_t GetWidth() const
Definition TGFrame.h:226
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2471
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
static TClass * Class()
Frame layout manager.
Definition TGLayout.h:135
virtual void Layout()=0
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Int_t GetLength() const
Definition TGString.h:29
const char * GetString() const
Definition TGString.h:30
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
Definition TGString.cxx:54
Service classes of the tab widget.
Definition TGTab.h:117
TGDimension GetDefaultSize() const override
Return default size of tab element.
Definition TGTab.cxx:199
Bool_t fActive
true if active (in front)
Definition TGTab.h:129
Bool_t fShowClose
show or hide close icon
Definition TGTab.h:128
TGString * fText
text on tab
Definition TGTab.h:120
void SetText(TGString *text)
Set new tab text.
Definition TGTab.cxx:210
Bool_t HandleButton(Event_t *event) override
Handle button event in the tab widget.
Definition TGTab.cxx:138
GContext_t fNormGC
graphics context for drawing tab
Definition TGTab.h:123
~TGTabElement() override
Delete tab element.
Definition TGTab.cxx:94
Bool_t fEnabled
enabled or disabled
Definition TGTab.h:127
const char * GetString() const
Definition TGTab.h:146
UInt_t fTHeight
height of tab text
Definition TGTab.h:126
FontStruct_t fFontStruct
font used for tab
Definition TGTab.h:124
const TGPicture * fClosePic
"close tab" icon
Definition TGTab.h:121
UInt_t fTWidth
width of tab text
Definition TGTab.h:125
TGTabElement(const TGTabElement &)=delete
virtual void SetActive(Bool_t on=kTRUE)
Definition TGTab.h:154
const TGPicture * fClosePicD
"close tab" icon (disabled)
Definition TGTab.h:122
virtual void ShowClose(Bool_t on=kTRUE)
Show/hide close icon on the tab element, then apply layout to compute correct elements size.
Definition TGTab.cxx:227
void DrawBorder() override
Draw little tab element.
Definition TGTab.cxx:104
Service classes of the tab widget.
Definition TGTab.h:24
TList * fList
Definition TGTab.h:28
void Layout() override
Layout the tab widget.
Definition TGTab.cxx:251
TGTab * fMain
Definition TGTab.h:27
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Definition TGTab.cxx:855
TGTabLayout(const TGTabLayout &)=delete
static TClass * Class()
TGDimension GetDefaultSize() const override
Get default size of tab widget.
Definition TGTab.cxx:295
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
Definition TGTab.h:46
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition TGTab.cxx:724
virtual void NewTab(const char *text="tab")
Create new tab. Used in context menu.
Definition TGTab.cxx:744
TGCompositeFrame * GetContainer() const
Definition TGTab.h:89
TGCompositeFrame * fContainer
main container
Definition TGTab.h:51
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition TGTab.cxx:467
virtual void SetText(const char *text="tab")
Set text to current tab.
Definition TGTab.cxx:759
TClass * IsA() const override
Definition TGTab.h:112
FontStruct_t fFontStruct
font
Definition TGTab.h:53
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition TGTab.cxx:734
virtual void Removed(Int_t id)
Definition TGTab.h:108
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition TGTab.cxx:660
Int_t fCurrent
index of current tab
Definition TGTab.h:49
~TGTab() override
Delete tab widget.
Definition TGTab.cxx:362
GContext_t fNormGC
drawing context
Definition TGTab.h:54
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition TGTab.cxx:706
static const TGGC * fgDefaultGC
Definition TGTab.h:60
Bool_t fScrolling
true if tab scrolling enabled
Definition TGTab.h:55
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition TGTab.cxx:555
Int_t GetCurrent() const
Definition TGTab.h:90
UInt_t fTabh
tab height
Definition TGTab.h:50
virtual void SetScrollingEnabled(Bool_t on=kTRUE)
Enable or disable tab scrolling.
Definition TGTab.cxx:487
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a tab widget as a C++ statement(s) on output stream out.
Definition TGTab.cxx:782
TList * fRemoved
list of removed tabs
Definition TGTab.h:52
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
Definition TGTab.cxx:424
virtual void Selected(Int_t id)
Definition TGTab.h:109
void ChangeTab(Int_t tabIndex, Bool_t emit=kTRUE)
Make tabIdx the current tab.
Definition TGTab.cxx:506
UInt_t GetTabHeight() const
Definition TGTab.h:97
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition TGTab.cxx:611
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition TGTab.cxx:373
Bool_t IsScrollingEnabled() const
Returns true if tab scrolling is enabled.
Definition TGTab.cxx:479
TGTab(const TGTab &)=delete
TGTabElement * GetCurrentTab() const
Definition TGTab.h:96
TGLayoutManager * GetLayoutManager() const override
Return layout manager.
Definition TGTab.cxx:768
static const TGFont * fgDefaultFont
Definition TGTab.h:59
static TClass * Class()
TString fCommand
command to be executed
Definition TGWidget.h:49
const TGWindow * fMsgWindow
window which handles widget events
Definition TGWidget.h:48
Bool_t IsEnabled() const
Definition TGWidget.h:69
ROOT GUI Window base class.
Definition TGWindow.h:23
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kEditDisableResize
window size cannot be edited
Definition TGWindow.h:61
@ kEditDisableLayout
window layout cannot be edited
Definition TGWindow.h:60
@ kEditDisableBtnEnable
window can handle mouse button events
Definition TGWindow.h:64
@ kEditDisableGrab
window grab cannot be edited
Definition TGWindow.h:59
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:190
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:334
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
A doubly linked list.
Definition TList.h:38
void Add(TObject *obj) override
Definition TList.h:81
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:467
Basic string class.
Definition TString.h:138
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:2384
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Window_t fWindow
window reported event is relative to
Definition GuiTypes.h:176
Int_t fX
Definition GuiTypes.h:178
UInt_t fCode
key or button code
Definition GuiTypes.h:180