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