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// //
25// TGTab, TGTabElement, TGTabLayout //
26// //
27// A tab widget contains a set of composite frames each with a little //
28// tab with a name (like a set of folders with tabs). //
29// //
30// The TGTab is user callable. The TGTabElement and TGTabLayout are //
31// service classes of the tab widget. //
32// //
33// Clicking on a tab will bring the associated composite frame to the //
34// front and generate the following event: //
35// kC_COMMAND, kCM_TAB, tab id, 0. //
36// //
37//////////////////////////////////////////////////////////////////////////
38
39#include "TGTab.h"
40#include "TGResourcePool.h"
41#include "TList.h"
42#include "TClass.h"
43#include "TGPicture.h"
44#include "TVirtualX.h"
45
46#include <iostream>
47
48const TGFont *TGTab::fgDefaultFont = nullptr;
49const TGGC *TGTab::fgDefaultGC = nullptr;
50
54
55
56////////////////////////////////////////////////////////////////////////////////
57/// Create a tab element. Text is adopted by tab element.
58
60 GContext_t norm, FontStruct_t font,
61 UInt_t options, ULong_t back) :
62 TGFrame(p, w, h, options, back)
63{
64 fClosePic = 0;
65 fClosePicD = 0;
68 fText = text;
69 fBorderWidth = 0;
70 fTWidth = 0;
71 fNormGC = norm;
72 fFontStruct = font;
74
75 fClosePic = fClient->GetPicture("closetab.png");
76 fClosePicD = fClient->GetPicture("closetab_d.png");
77 int max_ascent, max_descent;
78 if (fText)
80 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
81 fTHeight = max_ascent + max_descent;
85}
86
87////////////////////////////////////////////////////////////////////////////////
88/// Delete tab element.
89
91{
92 if (fClosePic) gClient->FreePicture(fClosePic);
93 if (fClosePicD) gClient->FreePicture(fClosePicD);
94 if (fText) delete fText;
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Draw little tab element.
99
101{
102 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, 0, 2);
103 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, 2, 2, 0);
104 gVirtualX->DrawLine(fId, GetHilightGC()(), 2, 0, fWidth-3, 0);
105 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth-2, 1, fWidth-2, fHeight-1);
106 if (gClient->GetStyle() < 2) {
107 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth-2, 1, fWidth-1, 2);
108 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth-1, 2, fWidth-1, fHeight-2);
109 }
110 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, fHeight-1, fWidth-1, fHeight-1);
111
112 if (fText) {
113 int max_ascent, max_descent;
114 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
115 if (fEnabled) {
116 fText->Draw(fId, fNormGC, 6, max_ascent+3);
117 } else {
118 fText->Draw(fId, GetHilightGC()(), 7, max_ascent + 1);
119 fText->Draw(fId, GetShadowGC()(), 6, max_ascent);
120 }
121 }
122 if (fShowClose && fClosePic && fClosePicD) {
123 if (fEnabled && fActive)
125 else
127 }
128}
129
130////////////////////////////////////////////////////////////////////////////////
131/// Handle button event in the tab widget. Basically we only handle
132/// button events in the small tabs.
133
135{
136 if (event->fType == kButtonPress) {
137 TGTab* main = (TGTab*)fParent;
138 if (main) {
139 if (fShowClose && event->fWindow == GetId() &&
140 (UInt_t)event->fX > fTWidth+12 && (UInt_t)event->fX < fTWidth+26 &&
141 (UInt_t)event->fY > fHeight/2-7 && (UInt_t)event->fY < fHeight/2+7) {
142 if (main->GetTabTab(main->GetCurrent()) == this) {
143 main->CloseTab(main->GetCurrent()); // emit signal
144 //main->RemoveTab(main->GetCurrent());
145 return kTRUE;
146 }
147 }
148 TGFrameElement *el;
149 TIter next(main->GetList());
150
151 next(); // skip first container
152
153 Int_t i = 0;
154 Int_t c = main->GetCurrent();
155 while ((el = (TGFrameElement *) next())) {
156 if (el->fFrame->GetId() == (Window_t)event->fWindow)
157 c = i;
158 next(); i++;
159 }
160
161 // change tab and generate event
162 main->SetTab(c);
163 }
164 }
165 return kTRUE;
166}
167
168////////////////////////////////////////////////////////////////////////////////
169/// Return default size of tab element.
170
172{
174 return TGDimension(TMath::Max(fTWidth+30, (UInt_t)45), fTHeight+6);
175 else
176 return TGDimension(TMath::Max(fTWidth+12, (UInt_t)45), fTHeight+6);
177}
178
179////////////////////////////////////////////////////////////////////////////////
180/// Set new tab text.
181
183{
184 if (fText) delete fText;
185 fText = text;
186
187 int max_ascent, max_descent;
189 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
190 fTHeight = max_ascent + max_descent;
191
192 fClient->NeedRedraw(this);
193}
194
195////////////////////////////////////////////////////////////////////////////////
196/// Show/hide close icon on the tab element, then apply layout
197/// to compute correct elements size.
198
200{
201 TGTab* main = (TGTab*)fParent;
202 fShowClose = show;
205 else
207 if (main)
208 main->GetLayoutManager()->Layout();
209}
210
211////////////////////////////////////////////////////////////////////////////////
212/// Create a tab layout manager.
213
215{
216 fMain = main;
217 fList = fMain->GetList();
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Layout the tab widget.
222
224{
225 Int_t i, xtab;
226 UInt_t tw;
227 UInt_t tabh = fMain->GetTabHeight(), bw = fMain->GetBorderWidth();
228 UInt_t w = fMain->GetWidth();
229 UInt_t h = fMain->GetHeight();
230
231 xtab = 2;
232
233 fMain->GetContainer()->MoveResize(0, tabh, w, h - tabh);
234
235 // first frame is the container, so take next...
236 TGFrameElement *el, *elnxt;
237 TIter next(fList);
238 i = 0;
239 next(); // skip first
240 while ((el = (TGFrameElement *) next())) {
241 elnxt = (TGFrameElement *) next();
242 tw = el->fFrame->GetDefaultWidth();
243 if (i == fMain->GetCurrent()) {
244 el->fFrame->MoveResize(xtab-2, 0, tw+3, tabh+1);
245 if (elnxt) elnxt->fFrame->RaiseWindow();
246 el->fFrame->RaiseWindow();
247 } else {
248 el->fFrame->MoveResize(xtab, 2, tw, tabh-1);
249 el->fFrame->LowerWindow();
250 }
251 UInt_t nw = (w - (bw << 1));
252 if (nw > 32768) nw = 1;
253 UInt_t nh = (h - tabh - (bw << 1));
254 if (nh > 32768) nh = 1;
255 if (elnxt) {
256 elnxt->fFrame->MoveResize(bw, tabh + bw, nw, nh);
257 elnxt->fFrame->Layout();
258 }
259 xtab += (Int_t)tw;
260 i++;
261 }
262}
263
264////////////////////////////////////////////////////////////////////////////////
265/// Get default size of tab widget.
266
268{
269 TGDimension dsize, dsize_te;
270 TGDimension size(0,0), size_te(0,0);
271
272 TGFrameElement *el, *elnxt;
273 TIter next(fList);
274 next(); // skip first container
275 while ((el = (TGFrameElement *)next())) {
276 dsize_te = el->fFrame->GetDefaultSize();
277 size_te.fWidth += dsize_te.fWidth;
278 elnxt = (TGFrameElement *) next();
279 if (elnxt) {
280 dsize = elnxt->fFrame->GetDefaultSize();
281 if (size.fWidth < dsize.fWidth) size.fWidth = dsize.fWidth;
282 if (size.fHeight < dsize.fHeight) size.fHeight = dsize.fHeight;
283 }
284 }
285
286 // check if tab elements make a larger width than the containers
287 if (size.fWidth < size_te.fWidth) size.fWidth = size_te.fWidth;
288
289 size.fWidth += fMain->GetBorderWidth() << 1;
290 size.fHeight += fMain->GetTabHeight() + (fMain->GetBorderWidth() << 1);
291
292 return size;
293}
294
295
296////////////////////////////////////////////////////////////////////////////////
297/// Create tab widget.
298
300 GContext_t norm, FontStruct_t font,
301 UInt_t options, ULong_t back) :
302 TGCompositeFrame(p, w, h, options, back)
303{
304 fMsgWindow = p;
305
306 fBorderWidth = 2;
307 fCurrent = 0;
308 fRemoved = new TList;
309
310 fNormGC = norm;
311 fFontStruct = font;
312
313 int max_ascent, max_descent;
314 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
315 fTabh = max_ascent + max_descent + 6;
316
317 SetLayoutManager(new TGTabLayout(this));
318
319 // we need this in order to avoid border blinking when switching tabs...
323
326}
327
328////////////////////////////////////////////////////////////////////////////////
329/// Delete tab widget. This deletes the tab windows and the containers.
330/// The tab string is deleted by the TGTabElement dtor.
331
333{
334 Cleanup();
335 fRemoved->Delete();
336 delete fRemoved;
337}
338
339////////////////////////////////////////////////////////////////////////////////
340/// Add a tab to the tab widget. Returns the new container, which
341/// is owned by the tab widget. The text is adopted by the tab widget.
342
344{
345 TGTabElement *te = new TGTabElement(this, text, 50, 20, fNormGC, fFontStruct);
346 AddFrame(te, 0);
347
348 TGCompositeFrame* cf = new TGCompositeFrame(this, fWidth, fHeight-21);
349 AddFrame(cf, 0);
351
352 te->MapWindow();
353 cf->MapWindow();
354
355 return cf;
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Add a tab to the tab widget. Returns the new container. The container
360/// is owned by the tab widget.
361
363{
364 return AddTab(new TGString(text));
365}
366
367////////////////////////////////////////////////////////////////////////////////
368/// Add a tab to the tab widget and fill it with given TGCompositeFrame.
369
370void TGTab::AddTab(const char *text, TGCompositeFrame *cf)
371{
372 AddTab(new TGString(text), cf);
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Add a tab to the tab widget and fill it with given TGCompositeFrame.
377
379{
380 TGTabElement *te = new TGTabElement(this, text, 50, 20, fNormGC, fFontStruct);
381 AddFrame(te, 0);
382
383 AddFrame(cf, 0);
385
386 te->MapWindow();
387 cf->MapWindow();
388}
389
390////////////////////////////////////////////////////////////////////////////////
391/// Remove container and tab of tab with index tabIndex.
392/// Does NOT remove the container contents!
393
394void TGTab::RemoveTab(Int_t tabIndex, Bool_t storeRemoved)
395{
396 if (tabIndex < 0) {
397 tabIndex = fCurrent;
398 }
399
400 TGFrameElement *elTab, *elCont;
401 Int_t count = 0;
402
403 // Notify (signal) for removed tab "tabIndex"
404 Removed(tabIndex);
405
406 TIter next(fList) ;
407 next() ; // skip first container
408
409 while ((elTab = (TGFrameElement *) next())) {
410 elCont = (TGFrameElement *) next();
411
412 if (count == tabIndex) {
413 elCont->fFrame->UnmapWindow(); // will be destroyed later
414 TGFrame *frame = elTab->fFrame;
415 RemoveFrame(elTab->fFrame);
416 frame->DestroyWindow();
417 delete frame;
418 if (storeRemoved)
419 fRemoved->Add(elCont->fFrame); // delete only in dtor
420 RemoveFrame(elCont->fFrame);
421 if (tabIndex == fCurrent) {
422 // select another tab only if the current is the one we delete
423 SetTab(0);
424 } else
425 fCurrent--;
426 break;
427 }
428 count++;
429 }
430
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// Enable or disable tab.
436
438{
439 TGTabElement *te = GetTabTab(tabIndex);
440 if (te) {
441 te->SetEnabled(on);
442 fClient->NeedRedraw(te);
443 }
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// Returns true if tab is enabled.
448
450{
451 TGTabElement *te = GetTabTab(tabIndex);
452
453 return te ? te->IsEnabled() : kFALSE;
454}
455
456////////////////////////////////////////////////////////////////////////////////
457/// Make tabIdx the current tab. Utility method called by SetTab and
458/// HandleButton().
459
460void TGTab::ChangeTab(Int_t tabIndex, Bool_t emit)
461{
462 TGTabElement *te = GetTabTab(tabIndex);
463 if (!te || !te->IsEnabled()) return;
464
465 if (tabIndex != fCurrent) {
466 if (GetTabTab(fCurrent)) {
469 }
470 TGFrameElement *el, *elnxt;
471 UInt_t tw;
472 Int_t xtab = 2;
473 Int_t count = 0;
474
475 TIter next(fList);
476 next(); // skip first container
477
478 fCurrent = tabIndex;
479 while ((el = (TGFrameElement *) next())) {
480 elnxt = (TGFrameElement *) next();
481 tw = el->fFrame->GetDefaultWidth();
482 if (count == fCurrent) {
483 el->fFrame->MoveResize(xtab-2, 0, tw+3, fTabh+1);
484 if (elnxt) elnxt->fFrame->RaiseWindow();
485 el->fFrame->RaiseWindow();
486 } else {
487 el->fFrame->MoveResize(xtab, 2, tw, fTabh-1);
488 el->fFrame->LowerWindow();
489 }
490 xtab += tw;
491 count++;
492 }
493 if (emit) {
497 }
500 }
501}
502
503////////////////////////////////////////////////////////////////////////////////
504/// Brings the composite frame with the index tabIndex to the
505/// front and generate the following event if the front tab has changed:
506/// kC_COMMAND, kCM_TAB, tab id, 0.
507/// Returns kFALSE if tabIndex is a not valid index
508
510{
511 // check if tabIndex is a valid index
512 if (tabIndex < 0)
513 return kFALSE;
514
515 // count the tabs
516 TIter next(fList);
517 Int_t count = 0;
518 while (next())
519 count++;
520
521 count = count / 2 - 1;
522 if (tabIndex > count)
523 return kFALSE;
524
525 // change tab and generate event
526 ChangeTab(tabIndex, emit);
527
528 return kTRUE;
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Brings the composite frame with the name to the
533/// front and generate the following event if the front tab has changed:
534/// kC_COMMAND, kCM_TAB, tab id, 0.
535/// Returns kFALSE if tab with name does not exist.
536
537Bool_t TGTab::SetTab(const char *name, Bool_t emit)
538{
539 TGFrameElement *el;
540 Int_t count = 0;
541 TGTabElement *tab = 0;
542
543 TIter next(fList);
544 next(); // skip first container
545
546 while ((el = (TGFrameElement *) next())) {
547 next(); // skip tab containter
548 tab = (TGTabElement *)el->fFrame;
549
550 if (*(tab->GetText()) == name) {
551 // change tab and generate event
552 ChangeTab(count, emit);
553 return kTRUE;
554 }
555 count++;
556 }
557
558 return kFALSE;
559}
560
561////////////////////////////////////////////////////////////////////////////////
562/// Return container of tab with index tabIndex.
563/// Return 0 in case tabIndex is out of range.
564
566{
567 if (tabIndex < 0) return 0;
568
569 TGFrameElement *el;
570 Int_t count = 0;
571
572 TIter next(fList);
573 next(); // skip first container
574
575 while (next()) {
576 el = (TGFrameElement *) next();
577 if (el && count == tabIndex)
578 return (TGCompositeFrame *) el->fFrame;
579 count++;
580 }
581
582 return 0;
583}
584
585////////////////////////////////////////////////////////////////////////////////
586/// Return the tab container of tab with string name.
587/// Returns 0 in case name is not found.
588
590{
591 TGFrameElement *el;
592 TGTabElement *tab = 0;
593 TGCompositeFrame *comp = 0;
594
595 TIter next(fList);
596 next();
597
598 while ((el = (TGFrameElement *) next())) {
599 tab = (TGTabElement *) el->fFrame;
600 el = (TGFrameElement *) next();
601 comp = (TGCompositeFrame *) el->fFrame;
602 if (*tab->GetText() == name){
603 return comp;
604 }
605 }
606
607 return 0;
608}
609
610////////////////////////////////////////////////////////////////////////////////
611/// Return the tab element of tab with index tabIndex.
612/// Returns 0 in case tabIndex is out of range.
613
615{
616 if (tabIndex < 0) return 0;
617
618 TGFrameElement *el;
619 Int_t count = 0;
620
621 TIter next(fList);
622 next(); // skip first container
623
624 while ((el = (TGFrameElement *) next())) {
625 next();
626 if (count == tabIndex)
627 return (TGTabElement *) el->fFrame;
628 count++;
629 }
630
631 return 0;
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Return the tab element of tab with string name.
636/// Returns 0 in case name is not found.
637
639{
640 TGFrameElement *el;
641 TGTabElement *tab = 0;
642
643 TIter next(fList);
644 next();
645
646 while ((el = (TGFrameElement *) next())) {
647 tab = (TGTabElement *)el->fFrame;
648 if (name == *(tab->GetText())) {
649 return tab;
650 }
651 next();
652 }
653
654 return 0;
655}
656
657////////////////////////////////////////////////////////////////////////////////
658/// Return number of tabs.
659
661{
662 Int_t count = 0;
663
664 TIter next(fList);
665 next(); // skip first container
666
667 while (next()) {
668 next();
669 count++;
670 }
671
672 return count;
673}
674
675////////////////////////////////////////////////////////////////////////////////
676/// Return default font structure in use.
677
679{
680 if (!fgDefaultFont)
681 fgDefaultFont = gClient->GetResourcePool()->GetDefaultFont();
683}
684
685////////////////////////////////////////////////////////////////////////////////
686/// Return default graphics context in use.
687
689{
690 if (!fgDefaultGC)
691 fgDefaultGC = gClient->GetResourcePool()->GetFrameGC();
692 return *fgDefaultGC;
693}
694
695////////////////////////////////////////////////////////////////////////////////
696/// Create new tab. Used in context menu.
697
698void TGTab::NewTab(const char *text)
699{
701 if (text)
702 name = text;
703 else
704 name = TString::Format("tab%d", GetNumberOfTabs()+1);
705 AddTab(name.Data());
706
708}
709
710////////////////////////////////////////////////////////////////////////////////
711/// Set text to current tab.
712
713void TGTab::SetText(const char *text)
714{
717}
718
719////////////////////////////////////////////////////////////////////////////////
720/// Return layout manager.
721
723{
724 TGTab *tab = (TGTab*)this;
725
726 if (tab->fLayoutManager->IsA() != TGTabLayout::Class()) {
727 tab->SetLayoutManager(new TGTabLayout(tab));
728 }
729
730 return tab->fLayoutManager;
731}
732
733////////////////////////////////////////////////////////////////////////////////
734/// Save a tab widget as a C++ statement(s) on output stream out.
735
736void TGTab::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
737{
738 char quote = '"';
739
740 // font + GC
741 option = GetName()+5; // unique digit id of the name
742 TString parGC, parFont;
743 parFont.Form("%s::GetDefaultFontStruct()",IsA()->GetName());
744 parGC.Form("%s::GetDefaultGC()()",IsA()->GetName());
745
746 if ((GetDefaultFontStruct() != fFontStruct) || (GetDefaultGC()() != fNormGC)) {
747 TGFont *ufont = gClient->GetResourcePool()->GetFontPool()->FindFont(fFontStruct);
748 if (ufont) {
749 ufont->SavePrimitive(out, option);
750 parFont.Form("ufont->GetFontStruct()");
751 }
752
753 TGGC *userGC = gClient->GetResourcePool()->GetGCPool()->FindGC(fNormGC);
754 if (userGC) {
755 userGC->SavePrimitive(out, option);
756 parGC.Form("uGC->GetGC()");
757 }
758 }
759
761
762 out << std::endl << " // tab widget" << std::endl;
763
764 out << " TGTab *";
765 out << GetName() << " = new TGTab(" << fParent->GetName()
766 << "," << GetWidth() << "," << GetHeight();
767
769 if (GetOptions() == kChildFrame) {
771 if (fNormGC == GetDefaultGC()()) {
772 out <<");" << std::endl;
773 } else {
774 out << "," << parGC.Data() <<");" << std::endl;
775 }
776 } else {
777 out << "," << parGC.Data() << "," << parFont.Data() <<");" << std::endl;
778 }
779 } else {
780 out << "," << parGC.Data() << "," << parFont.Data() << "," << GetOptionString() <<");" << std::endl;
781 }
782 } else {
783 out << "," << parGC.Data() << "," << parFont.Data() << "," << GetOptionString() << ",ucolor);" << std::endl;
784 }
785 if (option && strstr(option, "keep_names"))
786 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
787
789 TGLayoutManager * lm;
790 for (Int_t i=0; i<GetNumberOfTabs(); i++) {
791 cf = GetTabContainer(i);
792 if (!cf || !GetTabTab(i)) continue;
793 out << std::endl << " // container of " << quote
794 << GetTabTab(i)->GetString() << quote << std::endl;
795 out << " TGCompositeFrame *" << cf->GetName() << ";" << std::endl;
796 out << " " << cf->GetName() << " = " << GetName()
797 << "->AddTab(" << quote << GetTabTab(i)->GetString()
798 << quote << ");" << std::endl;
799 lm = cf->GetLayoutManager();
800 if (lm) {
801 if ((cf->GetOptions() & kHorizontalFrame) &&
802 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
803 ;
804 } else if ((GetOptions() & kVerticalFrame) &&
805 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
806 ;
807 } else {
808 out << " " << cf->GetName() <<"->SetLayoutManager(";
809 lm->SavePrimitive(out, option);
810 out << ");" << std::endl;
811 }
812 if (!IsEnabled(i)) {
813 out << " " << GetName() << "->SetEnabled(" << i << ", kFALSE);" << std::endl;
814 }
815 }
816 cf->SavePrimitiveSubframes(out, option);
817
818 if (GetTabTab(i)->IsCloseShown()) {
819 out << " TGTabElement *tab" << i << " = "
820 << GetName() << "->GetTabTab(" << i << ");" << std::endl;
821 out << " tab" << i << "->ShowClose(kTRUE);" << std::endl;
822 }
824 GetTabTab(i)->SaveUserColor(out, option);
825 out << " TGTabElement *tab" << i << " = "
826 << GetName() << "->GetTabTab(" << i << ");" << std::endl;
827 out << " tab" << i << "->ChangeBackground(ucolor);" << std::endl;
828 }
829
830 }
831 out << std::endl << " " << GetName() << "->SetTab(" << GetCurrent() << ");" << std::endl;
832 out << std::endl << " " << GetName() << "->Resize(" << GetName()
833 << "->GetDefaultSize());" << std::endl;
834}
835
836// __________________________________________________________________________
837void TGTabLayout::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
838{
839 // Save tab layout manager as a C++ statement(s) on out stream.
840
841 out << "new TGTabLayout(" << fMain->GetName() << ")";
842
843}
@ kButtonPress
Definition GuiTypes.h:60
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kAnyModifier
Definition GuiTypes.h:210
@ kChildFrame
Definition GuiTypes.h:379
@ 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
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
@ kButton1
Definition GuiTypes.h:214
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
#define gClient
Definition TGClient.h:166
char name[80]
Definition TGX11.cxx:110
#define gVirtualX
Definition TVirtualX.h:338
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:913
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:371
TGLayoutManager * fLayoutManager
Definition TGFrame.h:327
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:985
virtual TList * GetList() const
Definition TGFrame.h:346
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual TGLayoutManager * GetLayoutManager() const
Definition TGFrame.h:374
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:952
virtual void SavePrimitiveSubframes(std::ostream &out, Option_t *option="")
Auxilary protected method used to save subframes.
Definition TGFrame.cxx:2626
TList * fList
Definition TGFrame.h:328
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1007
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1134
UInt_t fHeight
Definition TGDimension.h:30
UInt_t fWidth
Definition TGDimension.h:29
FontStruct_t GetFontStruct() const
Definition TGFont.h:193
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save the used font as a C++ statement(s) on output stream out.
Definition TGFont.cxx:1871
TGFrame * fFrame
Definition TGLayout.h:119
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.cxx:569
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:720
Int_t GetBorderWidth() const
Definition TGFrame.h:257
UInt_t fHeight
Definition TGFrame.h:112
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:214
Int_t fBorderWidth
Definition TGFrame.h:117
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:740
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition TGFrame.cxx:630
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:668
virtual UInt_t GetOptions() const
Definition TGFrame.h:221
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2465
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:750
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
UInt_t fWidth
Definition TGFrame.h:111
UInt_t GetHeight() const
Definition TGFrame.h:249
virtual void Layout()
Definition TGFrame.h:223
virtual Pixel_t GetBackground() const
Definition TGFrame.h:216
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:614
virtual void MapWindow()
map window
Definition TGFrame.h:228
UInt_t GetWidth() const
Definition TGFrame.h:248
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2438
Pixel_t fBackground
Definition TGFrame.h:119
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:230
Definition TGGC.h:31
void SavePrimitive(std::ostream &out, Option_t *option="")
Save graphics context info as a C++ statement(s) on output stream out.
Definition TGGC.cxx:626
virtual void Layout()=0
TGClient * fClient
Definition TGObject.h:37
Handle_t GetId() const
Definition TGObject.h:47
Handle_t fId
Definition TGObject.h:36
void Draw(Option_t *="")
Default Draw method for all objects.
Definition TGPicture.h:57
Int_t GetLength() const
Definition TGString.h:39
const char * GetString() const
Definition TGString.h:40
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
Definition TGString.cxx:51
virtual TGDimension GetDefaultSize() const
Return default size of tab element.
Definition TGTab.cxx:171
virtual ~TGTabElement()
Delete tab element.
Definition TGTab.cxx:90
Bool_t fActive
Definition TGTab.h:142
Bool_t fShowClose
Definition TGTab.h:141
TGString * fText
Definition TGTab.h:133
void SetText(TGString *text)
Set new tab text.
Definition TGTab.cxx:182
GContext_t fNormGC
Definition TGTab.h:136
virtual void DrawBorder()
Draw little tab element.
Definition TGTab.cxx:100
virtual void SetEnabled(Bool_t on=kTRUE)
Definition TGTab.h:162
Bool_t fEnabled
Definition TGTab.h:140
const char * GetString() const
Definition TGTab.h:159
UInt_t fTHeight
Definition TGTab.h:139
FontStruct_t fFontStruct
Definition TGTab.h:137
const TGPicture * fClosePic
Definition TGTab.h:134
UInt_t fTWidth
Definition TGTab.h:138
const TGString * GetText() const
Definition TGTab.h:158
TGTabElement(const TGTabElement &)=delete
virtual void SetActive(Bool_t on=kTRUE)
Definition TGTab.h:167
const TGPicture * fClosePicD
Definition TGTab.h:135
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:199
Bool_t IsEnabled() const
Definition TGTab.h:163
virtual Bool_t HandleButton(Event_t *event)
Handle button event in the tab widget.
Definition TGTab.cxx:134
TList * fList
Definition TGTab.h:44
TGTab * fMain
Definition TGTab.h:43
TGTabLayout(const TGTabLayout &)=delete
virtual void Layout()
Layout the tab widget.
Definition TGTab.cxx:223
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition TGTab.cxx:837
virtual TGDimension GetDefaultSize() const
Get default size of tab widget.
Definition TGTab.cxx:267
Definition TGTab.h:62
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition TGTab.cxx:678
virtual TGLayoutManager * GetLayoutManager() const
Return layout manager.
Definition TGTab.cxx:722
virtual void NewTab(const char *text="tab")
Create new tab. Used in context menu.
Definition TGTab.cxx:698
TGCompositeFrame * GetContainer() const
Definition TGTab.h:104
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a tab widget as a C++ statement(s) on output stream out.
Definition TGTab.cxx:736
TGCompositeFrame * fContainer
Definition TGTab.h:67
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition TGTab.cxx:437
virtual void SetText(const char *text="tab")
Set text to current tab.
Definition TGTab.cxx:713
FontStruct_t fFontStruct
Definition TGTab.h:69
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition TGTab.cxx:688
virtual void Removed(Int_t id)
Definition TGTab.h:121
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition TGTab.cxx:614
Int_t fCurrent
Definition TGTab.h:65
GContext_t fNormGC
Definition TGTab.h:70
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition TGTab.cxx:660
static const TGGC * fgDefaultGC
Definition TGTab.h:75
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:509
Int_t GetCurrent() const
Definition TGTab.h:105
UInt_t fTabh
Definition TGTab.h:66
TList * fRemoved
Definition TGTab.h:68
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
Definition TGTab.cxx:394
virtual void Selected(Int_t id)
Definition TGTab.h:122
void ChangeTab(Int_t tabIndex, Bool_t emit=kTRUE)
Make tabIdx the current tab.
Definition TGTab.cxx:460
UInt_t GetTabHeight() const
Definition TGTab.h:112
virtual ~TGTab()
Delete tab widget.
Definition TGTab.cxx:332
TGCompositeFrame * GetTabContainer(Int_t tabIndex) const
Return container of tab with index tabIndex.
Definition TGTab.cxx:565
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition TGTab.cxx:343
TGTab(const TGTab &)=delete
TGTabElement * GetCurrentTab() const
Definition TGTab.h:111
static const TGFont * fgDefaultFont
Definition TGTab.h:74
TString fCommand
Definition TGWidget.h:59
const TGWindow * fMsgWindow
Definition TGWidget.h:58
Bool_t IsEnabled() const
Definition TGWidget.h:79
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:335
const TGWindow * fParent
Definition TGWindow.h:36
@ kEditDisableResize
Definition TGWindow.h:62
@ kEditDisableLayout
Definition TGWindow.h:61
@ kEditDisableBtnEnable
Definition TGWindow.h:65
@ kEditDisableGrab
Definition TGWindow.h:60
@ kEditDisable
Definition TGWindow.h:58
virtual void LowerWindow()
lower window
Definition TGWindow.cxx:215
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:191
virtual void RaiseWindow()
raise window
Definition TGWindow.cxx:207
UInt_t fEditDisabled
Definition TGWindow.h:40
A doubly linked list.
Definition TList.h:44
virtual void Add(TObject *obj)
Definition TList.h:87
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition TObject.cxx:666
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:445
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
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:2331
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2309
TText * text
int main()
Short_t Max(Short_t a, Short_t b)
Definition TMathBase.h:212
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