Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGFrame.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 03/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 TGFrame
25 \ingroup guiwidgets
26
27A subclasses of TGWindow, and is used as base
28class for some simple widgets (buttons, labels, etc.).
29It provides:
30 - position & dimension fields
31 - an 'options' attribute (see constant above)
32 - a generic event handler
33 - a generic layout mechanism
34 - a generic border
35
36
37\class TGCompositeFrame
38\ingroup guiwidgets
39
40The base class for composite widgets
41(menu bars, list boxes, etc.).
42It provides:
43 - a layout manager
44 - a frame container (TList *)
45
46
47\class TGVerticalFrame
48\ingroup guiwidgets
49A composite frame that layout their children in vertical way.
50
51
52\class TGHorizontalFrame
53\ingroup guiwidgets
54A composite frame that layout their children in horizontal way.
55
56
57\class TGMainFrame
58\ingroup guiwidgets
59Defines top level windows that interact with the system Window Manager.
60
61
62\class TGTransientFrame
63\ingroup guiwidgets
64Defines transient windows that typically are used for dialogs windows.
65
66
67\class TGGroupFrame
68\ingroup guiwidgets
69A composite frame with a border and a title.
70It is typically used to group a number of logically related widgets visually together.
71
72\class TGHeaderFrame
73\ingroup guiwidgets
74Horizontal Frame used to contain header buttons and splitters
75in a list view. Used to have resizable column headers.
76
77*/
78
79
80#include "TError.h"
81#include "TGFrame.h"
82#include "TGResourcePool.h"
83#include "TGPicture.h"
84#include "TList.h"
85#include "TApplication.h"
86#include "TTimer.h"
87#include "TClass.h"
88
89#include "TObjString.h"
90#include "TBits.h"
91#include "TColor.h"
92#include "TROOT.h"
93#include "TDatime.h"
94#include "KeySymbols.h"
95#include "TGFileDialog.h"
96#include "TGMsgBox.h"
97#include "TSystem.h"
98#include "TVirtualDragManager.h"
99#include "TGuiBuilder.h"
100#include "TQConnection.h"
101#include "TGButton.h"
102#include "TGSplitter.h"
103#include "TGDNDManager.h"
104#include "TImage.h"
105#include "TObjectSpy.h"
106#include "TVirtualX.h"
107
108#include <iostream>
109#include <fstream>
110
111
117const TGGC *TGFrame::fgBlackGC = nullptr;
118const TGGC *TGFrame::fgWhiteGC = nullptr;
119const TGGC *TGFrame::fgHilightGC = nullptr;
120const TGGC *TGFrame::fgShadowGC = nullptr;
121const TGGC *TGFrame::fgBckgndGC = nullptr;
128
129const TGFont *TGGroupFrame::fgDefaultFont = nullptr;
130const TGGC *TGGroupFrame::fgDefaultGC = nullptr;
131
133
134static const char *gSaveMacroTypes[] = {
135 "ROOT macros", "*.C",
136 "GIF", "*.gif",
137 "PNG", "*.png",
138 "JPEG", "*.jpg",
139 "TIFF", "*.tiff",
140 "XPM", "*.xpm",
141 "All files", "*",
142 0, 0
143};
144
146
155
156
157////////////////////////////////////////////////////////////////////////////////
158/// Create a TGFrame object. Options is an OR of the EFrameTypes.
159
161 UInt_t options, Pixel_t back)
162 : TGWindow(p, 0, 0, w, h, 0, 0, 0, 0, 0, options)
163{
164 if (!fgInit && gClient) {
174 fgInit = kTRUE;
175 }
176
178
179 fDNDState = 0;
180 fBackground = back;
181 fOptions = options;
182 fWidth = w; fHeight = h; fX = fY = fBorderWidth = 0;
183 fMinWidth = 0;
184 fMinHeight = 0;
187 fFE = 0;
188
190 fBorderWidth = (gClient->GetStyle() > 1) ? 1 : (fOptions & kDoubleBorder) ? 2 : 1;
191
193 wattr.fBackgroundPixel = back;
195 if (fOptions & kMainFrame) {
197 gVirtualX->ChangeWindowAttributes(fId, &wattr);
198 //if (fgDefaultBackgroundPicture)
199 // SetBackgroundPixmap(fgDefaultBackgroundPicture->GetPicture());
200 } else {
201 gVirtualX->ChangeWindowAttributes(fId, &wattr);
202 //if (!(fOptions & kOwnBackground))
203 // SetBackgroundPixmap(kParentRelative);
204 }
205 fEventMask = (UInt_t) wattr.fEventMask;
206
207 if ((fOptions & kDoubleBorder) && (gClient->GetStyle() > 1))
209
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Create a frame using an externally created window. For example
215/// to register the root window (called by TGClient), or a window
216/// created via TVirtualX::InitWindow() (id is obtained with
217/// TVirtualX::GetWindowID()).
218
220 : TGWindow(c, id, parent)
221{
222 if (!fgInit && gClient) {
232 fgInit = kTRUE;
233 }
234
235 WindowAttributes_t attributes;
236 // Initialize some values - needed for batch mode!
237 attributes.fX = 0;
238 attributes.fY = 0;
239 attributes.fWidth = 100;
240 attributes.fHeight = 100;
241 attributes.fBorderWidth = 4;
242 attributes.fYourEventMask = 0;
243 gVirtualX->GetWindowAttributes(id, attributes);
244
245 fDNDState = 0;
246 fX = attributes.fX;
247 fY = attributes.fY;
248 fWidth = attributes.fWidth;
249 fHeight = attributes.fHeight;
250 fBorderWidth = attributes.fBorderWidth;
251 fEventMask = (UInt_t) attributes.fYourEventMask;
252 fBackground = 0;
253 fOptions = 0;
254 fMinWidth = 0;
255 fMinHeight = 0;
258 fFE = 0;
259
261}
262
263////////////////////////////////////////////////////////////////////////////////
264/// Destructor.
265
267{
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// Delete window. Use single shot timer to call final delete method.
272/// We use this indirect way since deleting the window in its own
273/// execution "thread" can cause side effects because frame methods
274/// can still be called while the window object has already been deleted.
275
277{
278 if (gDNDManager) {
279 if (gDNDManager->GetMainFrame() == this)
281 }
283 // coverity[returned_null]
284 // coverity[dereference]
285 TTimer::SingleShot(150, IsA()->GetName(), this, "ReallyDelete()");
286 }
288}
289
290////////////////////////////////////////////////////////////////////////////////
291/// Change frame background color.
292
294{
295 fBackground = back;
296 gVirtualX->SetWindowBackground(fId, back);
297 fClient->NeedRedraw(this);
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Return frame foreground color.
302
304{
305 return fgBlackPixel;
306}
307
308////////////////////////////////////////////////////////////////////////////////
309/// Set background color (override from TGWindow base class).
310/// Same effect as ChangeBackground().
311
313{
314 fBackground = back;
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Change frame options. Options is an OR of the EFrameTypes.
320
323 if ((options & (kDoubleBorder | kSunkenFrame | kRaisedFrame)) !=
325 if (!InheritsFrom(TGGroupFrame::Class())) {
326 if (options & (kSunkenFrame | kRaisedFrame))
327 fBorderWidth = (gClient->GetStyle() > 1) ? 1 : (fOptions & kDoubleBorder) ? 2 : 1;
328 else
329 fBorderWidth = 0;
330 }
331 }
332
333 fOptions = options;
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Add events specified in the emask to the events the frame should handle.
338
340{
341 fEventMask |= emask;
342 gVirtualX->SelectInput(fId, fEventMask);
343}
344
345////////////////////////////////////////////////////////////////////////////////
346/// Remove events specified in emask from the events the frame should handle.
347
349{
350 fEventMask &= ~emask;
351 gVirtualX->SelectInput(fId, fEventMask);
352}
353
354////////////////////////////////////////////////////////////////////////////////
355/// Draw 3D rectangle on the frame border.
356
358 UInt_t w, UInt_t h)
359{
360 switch (type) {
361 case kSunkenFrame:
362 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x+w-2, y);
363 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, y+h-2);
364 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y+h-1, x+w-1, y+h-1);
365 gVirtualX->DrawLine(fId, GetHilightGC()(), x+w-1, y+h-1, x+w-1, y);
366 break;
367
369 if (gClient->GetStyle() < 2) {
370 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x+w-2, y);
371 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, y+h-2);
372 gVirtualX->DrawLine(fId, GetBlackGC()(), x+1, y+1, x+w-3, y+1);
373 gVirtualX->DrawLine(fId, GetBlackGC()(), x+1, y+1, x+1, y+h-3);
374 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y+h-1, x+w-1, y+h-1);
375 gVirtualX->DrawLine(fId, GetHilightGC()(), x+w-1, y+h-1, x+w-1, y);
376 gVirtualX->DrawLine(fId, GetBckgndGC()(), x+1, y+h-2, x+w-2, y+h-2);
377 gVirtualX->DrawLine(fId, GetBckgndGC()(), x+w-2, y+1, x+w-2, y+h-2);
378 }
379 else {
380 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x+w-2, y);
381 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, y+h-2);
382 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y+h-1, x+w-1, y+h-1);
383 gVirtualX->DrawLine(fId, GetHilightGC()(), x+w-1, y+h-1, x+w-1, y);
384 }
385 break;
386
387 case kRaisedFrame:
388 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y, x+w-2, y);
389 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y, x, y+h-2);
390 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y+h-1, x+w-1, y+h-1);
391 gVirtualX->DrawLine(fId, GetShadowGC()(), x+w-1, y+h-1, x+w-1, y);
392 break;
393
395 if (gClient->GetStyle() < 2) {
396 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y, x+w-2, y);
397 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y, x, y+h-2);
398 gVirtualX->DrawLine(fId, GetBckgndGC()(), x+1, y+1, x+w-3, y+1);
399 gVirtualX->DrawLine(fId, GetBckgndGC()(), x+1, y+1, x+1, y+h-3);
400 gVirtualX->DrawLine(fId, GetShadowGC()(), x+1, y+h-2, x+w-2, y+h-2);
401 gVirtualX->DrawLine(fId, GetShadowGC()(), x+w-2, y+h-2, x+w-2, y+1);
402 gVirtualX->DrawLine(fId, GetBlackGC()(), x, y+h-1, x+w-1, y+h-1);
403 gVirtualX->DrawLine(fId, GetBlackGC()(), x+w-1, y+h-1, x+w-1, y);
404 }
405 else {
406 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y, x+w-2, y);
407 gVirtualX->DrawLine(fId, GetHilightGC()(), x, y, x, y+h-2);
408 gVirtualX->DrawLine(fId, GetShadowGC()(), x, y+h-1, x+w-1, y+h-1);
409 gVirtualX->DrawLine(fId, GetShadowGC()(), x+w-1, y+h-1, x+w-1, y);
410 }
411 break;
412
413 default:
414 break;
415 }
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Draw frame border.
420
422{
424 0, 0, fWidth, fHeight);
425}
426
427////////////////////////////////////////////////////////////////////////////////
428/// Redraw the frame.
429
431{
433 fWidth - (fBorderWidth << 1), fHeight - (fBorderWidth << 1));
434
435 // border will only be drawn if we have a 3D option hint
436 // (kRaisedFrame or kSunkenFrame)
437 DrawBorder();
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// This event is generated when the frame is resized.
442
444{
445 if ((event->fWidth != fWidth) || (event->fHeight != fHeight)) {
446 fWidth = event->fWidth;
447 fHeight = event->fHeight;
448 Layout();
449 }
450 return kTRUE;
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Handle all frame events. Events are dispatched to the specific
455/// event handlers.
456
458{
461
462 TObjectSpy deleteCheck(this);
463
464 switch (event->fType) {
465
466 case kExpose:
468 break;
469
470 case kConfigureNotify:
471 while (gVirtualX->CheckEvent(fId, kConfigureNotify, *event))
472 ;
473 // protection
474 if ((event->fWidth < 32768) && (event->fHeight < 32768)){
475 ProcessedConfigure(event); // emit signal
477 }
478 break;
479
480 case kGKeyPress:
481 case kKeyRelease:
483 break;
484
485 case kFocusIn:
486 case kFocusOut:
488 break;
489
490 case kButtonPress:
491 {
492 Int_t dbl_clk = kFALSE;
493
494 if ((event->fTime - fgLastClick < 350) &&
495 (event->fCode == fgLastButton) &&
496 (TMath::Abs(event->fXRoot - fgDbx) < 6) &&
497 (TMath::Abs(event->fYRoot - fgDby) < 6) &&
498 (event->fWindow == fgDbw))
499 dbl_clk = kTRUE;
500
501 fgLastClick = event->fTime;
502 fgLastButton = event->fCode;
503 fgDbx = event->fXRoot;
504 fgDby = event->fYRoot;
505 fgDbw = event->fWindow;
506
507 if (dbl_clk) {
508 if ((event->fState & kKeyControlMask) &&
511 return kTRUE;
512 }
513
514 if (!HandleDoubleClick(event)) {
516 }
517 } else {
519 }
520 }
521 break;
522
524 {
525 fgLastClick = event->fTime;
526 fgLastButton = event->fCode;
527 fgDbx = event->fXRoot;
528 fgDby = event->fYRoot;
529 fgDbw = event->fWindow;
530
532 }
533 break;
534
535 case kButtonRelease:
537 break;
538
539 case kEnterNotify:
540 case kLeaveNotify:
542 break;
543
544 case kMotionNotify:
545 while (gVirtualX->CheckEvent(fId, kMotionNotify, *event))
546 ;
548 break;
549
550 case kClientMessage:
552 break;
553
554 case kSelectionNotify:
556 break;
557
560 break;
561
562 case kSelectionClear:
564 break;
565
566 case kColormapNotify:
568 break;
569
570 default:
571 //Warning("HandleEvent", "unknown event (%#x) for (%#x)", event->fType, fId);
572 break;
573 }
574
575 if (deleteCheck.GetObject())
576 ProcessedEvent(event); // emit signal
577
578 return kTRUE;
579}
580
581////////////////////////////////////////////////////////////////////////////////
582/// std::cout << fWidth << "x" << fHeight << std::endl;
583
585{
586 return TGDimension(fWidth, fHeight);
587}
588
589
590////////////////////////////////////////////////////////////////////////////////
591/// Move frame.
592
594{
595 if (x != fX || y != fY) {
597 fX = x; fY = y;
598 }
599}
600
601////////////////////////////////////////////////////////////////////////////////
602/// Resize the frame.
603/// If w=0 && h=0 - Resize to default size
604
606{
607 if (w != fWidth || h != fHeight) {
608 TGDimension siz(0,0);
609 siz = GetDefaultSize();
610 fWidth = w ? w : siz.fWidth;
611 fHeight = h ? h : siz.fHeight;
613 Layout();
614 }
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Resize the frame.
619
621{
622 Resize(size.fWidth, size.fHeight);
623}
624
625////////////////////////////////////////////////////////////////////////////////
626/// Move and/or resize the frame.
627/// If w=0 && h=0 - Resize to default size
628
630{
631 // we do it anyway as we don't know if it's only a move or only a resize
632 TGDimension siz(0,0);
633 siz = GetDefaultSize();
634 fWidth = w ? w : siz.fWidth;
635 fHeight = h ? h : siz.fHeight;
636 fX = x; fY = y;
638 Layout();
639}
640
641////////////////////////////////////////////////////////////////////////////////
642/// Send message (i.e. event) to window w. Message is encoded in one long
643/// as message type and up to two long parameters.
644
646{
648
649 if (w) {
650 event.fType = kClientMessage;
651 event.fFormat = 32;
652 event.fHandle = gROOT_MESSAGE;
653
654 event.fWindow = w->GetId();
655 event.fUser[0] = msg;
656 event.fUser[1] = parm1;
657 event.fUser[2] = parm2;
658 event.fUser[3] = 0;
659 event.fUser[4] = 0;
660
661 gVirtualX->SendEvent(w->GetId(), &event);
662 }
663}
664
665////////////////////////////////////////////////////////////////////////////////
666/// Handle a client message. Client messages are the ones sent via
667/// TGFrame::SendMessage (typically by widgets).
668
670{
671 if (gDNDManager) {
673 }
674 if (event->fHandle == gROOT_MESSAGE) {
675 ProcessMessage(event->fUser[0], event->fUser[1], event->fUser[2]);
676 }
677 return kTRUE;
678}
679
680////////////////////////////////////////////////////////////////////////////////
681/// Get default frame background.
682
684{
685 static Bool_t init = kFALSE;
686 if (!init && gClient) {
687 fgDefaultFrameBackground = gClient->GetResourcePool()->GetFrameBgndColor();
688 init = kTRUE;
689 }
691}
692
693////////////////////////////////////////////////////////////////////////////////
694/// Get default selected frame background.
695
697{
698 static Bool_t init = kFALSE;
699 if (!init && gClient) {
700 fgDefaultSelectedBackground = gClient->GetResourcePool()->GetSelectedBgndColor();
701 init = kTRUE;
702 }
704}
705
706////////////////////////////////////////////////////////////////////////////////
707/// Get white pixel value.
708
710{
711 static Bool_t init = kFALSE;
712 if (!init && gClient) {
713 fgWhitePixel = gClient->GetResourcePool()->GetWhiteColor();
714 init = kTRUE;
715 }
716 return fgWhitePixel;
717}
718
719////////////////////////////////////////////////////////////////////////////////
720/// Get black pixel value.
721
723{
724 static Bool_t init = kFALSE;
725 if (!init && gClient) {
726 fgBlackPixel = gClient->GetResourcePool()->GetBlackColor();
727 init = kTRUE;
728 }
729 return fgBlackPixel;
730}
731
732////////////////////////////////////////////////////////////////////////////////
733/// Get black graphics context.
734
736{
737 if (!fgBlackGC && gClient)
738 fgBlackGC = gClient->GetResourcePool()->GetBlackGC();
739 return *fgBlackGC;
740}
741
742////////////////////////////////////////////////////////////////////////////////
743/// Get white graphics context.
744
746{
747 if (!fgWhiteGC && gClient)
748 fgWhiteGC = gClient->GetResourcePool()->GetWhiteGC();
749 return *fgWhiteGC;
750}
751
752////////////////////////////////////////////////////////////////////////////////
753/// Get highlight color graphics context.
754
756{
757 if (!fgHilightGC && gClient)
758 fgHilightGC = gClient->GetResourcePool()->GetFrameHiliteGC();
759 return *fgHilightGC;
760}
761
762////////////////////////////////////////////////////////////////////////////////
763/// Get shadow color graphics context.
764
766{
767 if (!fgShadowGC && gClient)
768 fgShadowGC = gClient->GetResourcePool()->GetFrameShadowGC();
769 return *fgShadowGC;
770}
771
772////////////////////////////////////////////////////////////////////////////////
773/// Get background color graphics context.
774
776{
777 if (!fgBckgndGC && gClient)
778 fgBckgndGC = gClient->GetResourcePool()->GetFrameBckgndGC();
779 return *fgBckgndGC;
780}
781
782////////////////////////////////////////////////////////////////////////////////
783/// Get time of last mouse click.
784
786{
787 return fgLastClick;
788}
789
790////////////////////////////////////////////////////////////////////////////////
791/// Print window id.
792
793void TGFrame::Print(Option_t *option) const
794{
795 TString opt = option;
796 if (opt.Contains("tree")) {
797 TGWindow::Print(option);
798 return;
799 }
800
801 std::cout << option << ClassName() << ":\tid=" << fId << " parent=" << fParent->GetId();
802 std::cout << " x=" << fX << " y=" << fY;
803 std::cout << " w=" << fWidth << " h=" << fHeight << std::endl;
804}
805
806////////////////////////////////////////////////////////////////////////////////
807/// SetDragType
808
810{
811}
812
813////////////////////////////////////////////////////////////////////////////////
814/// SetDropType
815
817{
818}
819
820////////////////////////////////////////////////////////////////////////////////
821/// Returns drag source type.
822/// If frame is not "draggable" - return zero
823
825{
826 return fClient->IsEditable();
827}
828
829////////////////////////////////////////////////////////////////////////////////
830/// Returns drop target type.
831/// If frame cannot accept drop - return zero
832
834{
835 return 0;
836}
837
838////////////////////////////////////////////////////////////////////////////////
839/// Go into GUI building mode.
840
842{
843 if (GetEditDisabled()) return;
845 if (!gDragManager) return;
846
847 TGCompositeFrame *comp = 0;
848
849 if (InheritsFrom(TGCompositeFrame::Class())) {
850 comp = (TGCompositeFrame *)this;
851 } else if (fParent->InheritsFrom(TGCompositeFrame::Class())) {
852 comp = (TGCompositeFrame*)fParent;
853 }
854 if (comp) comp->SetEditable(on);
855}
856
857////////////////////////////////////////////////////////////////////////////////
858/// Create a composite frame. A composite frame has in addition to a TGFrame
859/// also a layout manager and a list of child frames.
860
862 UInt_t options, Pixel_t back) : TGFrame(p, w, h, options, back)
863{
864 fLayoutManager = 0;
865 fList = new TList;
869 if (!fgDefaultHints)
871
874 else
876
878}
879
880////////////////////////////////////////////////////////////////////////////////
881/// Create a frame using an externally created window. For example
882/// to register the root window (called by TGClient), or a window
883/// created via TVirtualX::InitWindow() (id is obtained with TVirtualX::GetWindowID()).
884
886 : TGFrame(c, id, parent)
887{
888 fLayoutManager = 0;
889 fList = new TList;
893 if (!fgDefaultHints)
895
897
899}
900
901////////////////////////////////////////////////////////////////////////////////
902/// Delete a composite frame.
903
905{
906 if (fMustCleanup != kNoCleanup) {
907 Cleanup();
908 } else {
909 TGFrameElement *el = 0;
910 TIter next(fList);
911
912 while ((el = (TGFrameElement *) next())) {
913 fList->Remove(el);
914 delete el;
915 }
916 }
917
918 delete fList;
919 delete fLayoutManager;
920 fList = 0;
921 fLayoutManager = 0;
922}
923
924////////////////////////////////////////////////////////////////////////////////
925/// Return kTRUE if frame is being edited.
926
928{
929 return (fClient->GetRoot() == (TGWindow*)this);
930}
931
932////////////////////////////////////////////////////////////////////////////////
933/// Switch ON/OFF edit mode.
934/// If edit mode is ON it is possible:
935///
936/// 1. embed other ROOT GUI application (a la ActiveX)
937///
938/// For example:
939/// TGMainFrame *m = new TGMainFrame(gClient->GetRoot(), 500, 500);
940/// m->SetEditable();
941/// gSystem->Load("$ROOTSYS/test/Aclock"); // load Aclock demo
942/// Aclock a;
943/// gROOT->Macro("$ROOTSYS/tutorials/gui/guitest.C");
944/// m->SetEditable(0);
945/// m->MapWindow();
946///
947
949{
950 if (on && ((fEditDisabled & kEditDisable) ||
952
953 if (on) {
954 fClient->SetRoot(this);
955 } else {
956 fClient->SetRoot(0);
957 }
959}
960
961////////////////////////////////////////////////////////////////////////////////
962/// Cleanup and delete all objects contained in this composite frame.
963/// This will delete all objects added via AddFrame().
964/// CAUTION: all objects (frames and layout hints) must be unique, i.e.
965/// cannot be shared.
966
968{
969 if (!fList) return;
970
971 TGFrameElement *el;
972 TIter next(fList);
973
974 while ((el = (TGFrameElement *) next())) {
975 if (el->fFrame) {
976 el->fFrame->SetFrameElement(0);
977 if (!gVirtualX->InheritsFrom("TGX11") && !gVirtualX->InheritsFrom("TGCocoa"))
978 el->fFrame->DestroyWindow();
979 delete el->fFrame;
980 }
981
982 if (el->fLayout && (el->fLayout != fgDefaultHints) &&
983 (el->fLayout->References() > 0)) {
985 if (!el->fLayout->References()) {
986 el->fLayout->fFE = 0;
987 delete el->fLayout;
988 }
989 }
990 fList->Remove(el);
991 delete el;
992 }
993}
994
995////////////////////////////////////////////////////////////////////////////////
996/// Set the layout manager for the composite frame.
997/// The layout manager is adopted by the frame and will be deleted
998/// by the frame.
999
1001{
1002 if (l) {
1003 delete fLayoutManager;
1004 fLayoutManager = l;
1005 } else
1006 Error("SetLayoutManager", "no layout manager specified");
1007}
1008
1009////////////////////////////////////////////////////////////////////////////////
1010/// Set broken layout. No Layout method is called.
1011
1013{
1014 fLayoutBroken = on;
1015}
1016
1017////////////////////////////////////////////////////////////////////////////////
1018/// Set edit disable flag for this frame and subframes
1019///
1020/// - if (on & kEditDisable) - disable edit for this frame and all subframes.
1021
1023{
1024 fEditDisabled = on;
1025 UInt_t set = on & kEditDisable;
1026
1027 // propagate only kEditDisable
1028 if (set == kEditDisable) {
1029
1030 TGFrameElement *el;
1031 TIter next(fList);
1032 while ((el = (TGFrameElement *) next())) {
1033 if (el->fFrame) {
1034 el->fFrame->SetEditDisabled(set);
1035 }
1036 }
1037 }
1038}
1039
1040////////////////////////////////////////////////////////////////////////////////
1041/// Change composite frame options. Options is an OR of the EFrameTypes.
1042
1044{
1045 TGFrame::ChangeOptions(options);
1046
1047 if (options & kHorizontalFrame)
1049 else if (options & kVerticalFrame)
1051}
1052
1053////////////////////////////////////////////////////////////////////////////////
1054/// Turn on automatic cleanup of child frames in dtor.
1055///
1056/// if mode = kNoCleanup - no automatic cleanup
1057/// if mode = kLocalCleanup - automatic cleanup in this composite frame only
1058/// if mode = kDeepCleanup - automatic deep cleanup in this composite frame
1059/// and all child composite frames (hierarchical)
1060///
1061/// Attention!
1062/// Hierarchical cleaning is dangerous and must be used with caution.
1063/// There are many GUI components (in ROOT and in user code) which do not
1064/// use Clean method in destructor ("custom deallocation").
1065/// Adding such component to GUI container which is using hierarchical
1066/// cleaning will produce seg. violation when container is deleted.
1067/// The reason is double deletion: first when Clean method is invoked,
1068/// then at "custom deallocation".
1069/// We are going to correct all ROOT code to make it to be
1070/// consistent with hierarchical cleaning scheme.
1071
1073{
1074 if (mode == fMustCleanup)
1075 return;
1076
1077 fMustCleanup = mode;
1078
1079 if (fMustCleanup == kDeepCleanup) {
1080 TGFrameElement *el;
1081 TIter next(fList);
1082
1083 while ((el = (TGFrameElement *) next())) {
1084 if (el->fFrame->InheritsFrom(TGCompositeFrame::Class())) {
1086 }
1087 }
1088 }
1089}
1090
1091////////////////////////////////////////////////////////////////////////////////
1092/// Find frame-element holding frame f.
1093
1095{
1096 if (!fList) return 0;
1097
1098 TGFrameElement *el;
1099 TIter next(fList);
1100
1101 while ((el = (TGFrameElement *) next()))
1102 if (el->fFrame == f)
1103 return el;
1104
1105 return 0;
1106}
1107
1108////////////////////////////////////////////////////////////////////////////////
1109/// Add frame to the composite frame using the specified layout hints.
1110/// If no hints are specified default hints TGLayoutHints(kLHintsNormal,0,0,0,0)
1111/// will be used. Most of the time, however, you will want to provide
1112/// specific hints. User specified hints can be reused many times
1113/// and need to be destroyed by the user. The added frames cannot not be
1114/// added to different composite frames but still need to be deleted by
1115/// the user.
1116
1118{
1120 fList->Add(nw);
1121
1122 // in case of recursive cleanup, propagate cleanup setting to all
1123 // child composite frames
1125 f->SetCleanup(kDeepCleanup);
1126}
1127
1128////////////////////////////////////////////////////////////////////////////////
1129/// Remove all frames from composite frame.
1130
1132{
1133 if (!fList) return;
1134
1135 TGFrameElement *el;
1136 TIter next(fList);
1137
1138 while ((el = (TGFrameElement *) next())) {
1139 fList->Remove(el);
1140 if (el->fLayout) el->fLayout->RemoveReference();
1141// el->fFrame->SetFrameElement(0);
1142 delete el;
1143 }
1144}
1145
1146////////////////////////////////////////////////////////////////////////////////
1147/// Remove frame from composite frame.
1148
1150{
1152
1153 if (el) {
1154 fList->Remove(el);
1155 if (el->fLayout) el->fLayout->RemoveReference();
1156 f->SetFrameElement(0);
1157 delete el;
1158 }
1159}
1160
1161////////////////////////////////////////////////////////////////////////////////
1162/// Map all sub windows that are part of the composite frame.
1163
1165{
1166 if (!fMapSubwindows) {
1167 //MapWindow();
1168 return;
1169 }
1170
1172
1173 if (!fList) return;
1174
1175 TGFrameElement *el;
1176 TIter next(fList);
1177
1178 while ((el = (TGFrameElement *) next())) {
1179 if (el->fFrame) {
1180 el->fFrame->MapSubwindows();
1182 if (fe) fe->fState |= kIsVisible;
1183 }
1184 }
1185}
1186
1187////////////////////////////////////////////////////////////////////////////////
1188/// Hide sub frame.
1189
1191{
1193
1194 if (el) {
1195 el->fState = 0;
1196 el->fFrame->UnmapWindow();
1197 Layout();
1198 }
1199}
1200
1201////////////////////////////////////////////////////////////////////////////////
1202/// Show sub frame.
1203
1205{
1207
1208 if (el) {
1209 el->fState = 1;
1210 el->fFrame->MapWindow();
1211 Layout();
1212 }
1213}
1214
1215////////////////////////////////////////////////////////////////////////////////
1216/// Get state of sub frame.
1217
1219{
1221
1222 if (el)
1223 return el->fState;
1224 else
1225 return 0;
1226}
1227
1228////////////////////////////////////////////////////////////////////////////////
1229/// Get state of sub frame.
1230
1232{
1234
1235 if (el)
1236 return (el->fState & kIsVisible);
1237 else
1238 return kFALSE;
1239}
1240
1241////////////////////////////////////////////////////////////////////////////////
1242/// Get state of sub frame.
1243
1245{
1247
1248 if (el)
1249 return (el->fState & kIsArranged);
1250 else
1251 return kFALSE;
1252}
1253
1254////////////////////////////////////////////////////////////////////////////////
1255/// Layout the elements of the composite frame.
1256
1258{
1259 if (IsLayoutBroken()) return;
1261}
1262
1263////////////////////////////////////////////////////////////////////////////////
1264/// Print all frames in this composite frame.
1265
1267{
1268 TString opt = option;
1269 if (opt.Contains("tree")) {
1270 TGWindow::Print(option);
1271 return;
1272 }
1273
1274 TGFrameElement *el;
1275 TIter next(fList);
1276 TString tab = option;
1277
1278 TGFrame::Print(tab.Data());
1279 tab += " ";
1280 while ((el = (TGFrameElement*)next())) {
1281 el->fFrame->Print(tab.Data());
1282 }
1283}
1284
1285////////////////////////////////////////////////////////////////////////////////
1286/// Change background color for this frame and all subframes.
1287
1289{
1291 TGFrameElement *el;
1292
1293 TIter next(fList);
1294
1295 while ((el = (TGFrameElement*)next())) {
1296 el->fFrame->SetBackgroundColor(back);
1297 if (el->fFrame->InheritsFrom(TGCompositeFrame::Class())) {
1298 ((TGCompositeFrame*)el->fFrame)->ChangeSubframesBackground(back);
1299 }
1301 }
1302 fClient->NeedRedraw(this);
1303}
1304
1305////////////////////////////////////////////////////////////////////////////////
1306/// Get frame located at specified point.
1307
1309{
1310 if (!Contains(x, y)) return 0;
1311
1312 if (!fList) return this;
1313
1314 TGFrame *f;
1315 TGFrameElement *el;
1316 TIter next(fList);
1317
1318 while ((el = (TGFrameElement *) next())) {
1319 //if (el->fFrame->IsVisible()) { //for this need to move IsVisible to TGFrame
1320 if (el->fState & kIsVisible) {
1321 f = el->fFrame->GetFrameFromPoint(x - el->fFrame->GetX(),
1322 y - el->fFrame->GetY());
1323 if (f) return f;
1324 }
1325 }
1326 return this;
1327}
1328
1329////////////////////////////////////////////////////////////////////////////////
1330/// Translate coordinates to child frame.
1331
1333 Int_t &fx, Int_t &fy)
1334{
1335 if (child == this) {
1336 fx = x;
1337 fy = y;
1338 return kTRUE;
1339 }
1340
1341 if (!Contains(x, y)) return kFALSE;
1342
1343 if (!fList) return kFALSE;
1344
1345 TGFrameElement *el;
1346 TIter next(fList);
1347
1348 while ((el = (TGFrameElement *) next())) {
1349 if (el->fFrame == child) {
1350 fx = x - el->fFrame->GetX();
1351 fy = y - el->fFrame->GetY();
1352 return kTRUE;
1353 } else if (el->fFrame->IsComposite()) {
1354 if (((TGCompositeFrame *)el->fFrame)->TranslateCoordinates(child,
1355 x - el->fFrame->GetX(), y - el->fFrame->GetY(), fx, fy))
1356 return kTRUE;
1357 }
1358 }
1359 return kFALSE;
1360}
1361
1362////////////////////////////////////////////////////////////////////////////////
1363/// Handle drag enter event.
1364
1366{
1367 if (fClient && fClient->IsEditable() &&
1368 (fId != fClient->GetRoot()->GetId())) {
1369
1370 // the dragged frame cannot be dropped
1372
1373 //
1374 if (IsEditable()) {
1375 return kTRUE;
1376 }
1377
1378 Float_t r, g, b;
1380 r *= 1.12;
1381 g *= 1.13;
1382 b *= 1.12;
1383 Pixel_t back = TColor::RGB2Pixel(r, g, b);
1384 gVirtualX->SetWindowBackground(fId, back);
1385 DoRedraw();
1386 return kTRUE;
1387 }
1388
1389 return kFALSE;
1390}
1391
1392////////////////////////////////////////////////////////////////////////////////
1393/// Handle drag leave event.
1394
1396{
1397 if (fClient && fClient->IsEditable() &&
1398 (fId != fClient->GetRoot()->GetId())) {
1399
1401
1402 gVirtualX->SetWindowBackground(fId, fBackground);
1403 DoRedraw();
1404 return kTRUE;
1405 }
1406
1407 return kFALSE;
1408}
1409
1410////////////////////////////////////////////////////////////////////////////////
1411/// Handle drag motion event.
1412
1414{
1415 return kFALSE;
1416}
1417
1418////////////////////////////////////////////////////////////////////////////////
1419/// Handle drop event.
1420
1422 TGLayoutHints *lo)
1423{
1424 if (fClient && fClient->IsEditable() && frame && (x >= 0) && (y >= 0) &&
1425 (x + frame->GetWidth() <= fWidth) && (y + frame->GetHeight() <= fHeight)) {
1426
1428
1429 frame->ReparentWindow(this, x, y);
1430 AddFrame(frame, lo);
1431 frame->MapWindow();
1433 return kTRUE;
1434 }
1435
1436 return kFALSE;
1437}
1438
1439
1440////////////////////////////////////////////////////////////////////////////////
1441/// Create a top level main frame. A main frame interacts
1442/// with the window manager.
1443
1445 UInt_t options) : TGCompositeFrame(p, w, h, options | kMainFrame)
1446{
1447 // WMDeleteNotify causes the system to send a kClientMessage to the
1448 // window with fFormat=32 and fUser[0]=gWM_DELETE_WINDOW when window
1449 // closed via WM
1450
1451 gVirtualX->WMDeleteNotify(fId);
1452
1453 fBindList = new TList;
1454
1455 fMWMValue = 0;
1456 fMWMFuncs = 0;
1457 fMWMInput = 0;
1458 fWMX = -1;
1459 fWMY = -1;
1460 fWMWidth = (UInt_t) -1;
1461 fWMHeight = (UInt_t) -1;
1462 fWMMinWidth = (UInt_t) -1;
1463 fWMMinHeight = (UInt_t) -1;
1464 fWMMaxWidth = (UInt_t) -1;
1465 fWMMaxHeight = (UInt_t) -1;
1466 fWMWidthInc = (UInt_t) -1;
1467 fWMHeightInc = (UInt_t) -1;
1469
1470 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_s),
1471 kKeyControlMask, kTRUE);//grab CTRL+s
1472 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_s),
1473 kKeyControlMask | kKeyMod2Mask, kTRUE);//grab CTRL+s also if NumLock is active
1474 if (p == fClient->GetDefaultRoot()) {
1478 gVirtualX->SetMWMHints(fId, fMWMValue, fMWMFuncs, fMWMInput);
1479 }
1480 // if parent is editing/embeddable add this frame to the parent
1481 if (fClient->IsEditable() && (p == fClient->GetRoot())) {
1482 TGCompositeFrame *frame;
1483 if (p && p->InheritsFrom(TGCompositeFrame::Class())) {
1484 frame = (TGCompositeFrame*)p;
1486
1487 // used during paste operation
1490 }
1491 }
1492 }
1493 //AddInput(kButtonPressMask); // to allow Drag and Drop
1494 // Create Drag&Drop Manager and define a few DND types
1495 fDNDTypeList = new Atom_t[3];
1496 fDNDTypeList[0] = gVirtualX->InternAtom("application/root", kFALSE);
1497 fDNDTypeList[1] = gVirtualX->InternAtom("text/uri-list", kFALSE);
1498 fDNDTypeList[2] = 0;
1499 if (!gDNDManager)
1500 new TGDNDManager(this, fDNDTypeList);
1501 SetWindowName();
1502}
1503
1504////////////////////////////////////////////////////////////////////////////////
1505/// TGMainFrame destructor.
1506
1508{
1509 delete [] fDNDTypeList;
1510 if (fBindList) {
1511 fBindList->Delete();
1512 delete fBindList;
1513 }
1514 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_s),
1516 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_s),
1518}
1519
1520////////////////////////////////////////////////////////////////////////////////
1521/// Opens dialog window allowing user to save the frame contents
1522/// as a ROOT macro or as an image.
1523/// Returns kTRUE if something was saved.
1524///
1525/// This is bound to Ctrl-S by default.
1526
1528{
1529 static TString dir(".");
1530 static Bool_t overwr = kFALSE;
1531
1532 Bool_t repeat_save;
1533 do {
1534 repeat_save = kFALSE;
1535
1536 TGFileInfo fi;
1538 fi.SetIniDir(dir);
1539 fi.fOverwrite = overwr;
1540 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
1541 if (!fi.fFilename) return kFALSE;
1542 dir = fi.fIniDir;
1543 overwr = fi.fOverwrite;
1544 const Bool_t res = SaveFrameAsCodeOrImage(fi.fFilename);
1545 if (!res) {
1546 Int_t retval;
1547 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1548 TString::Format("file (%s) cannot be saved with this extension",
1549 fi.fFilename),
1551 repeat_save = (retval == kMBRetry);
1552 }
1553 } while (repeat_save);
1554
1555 return kTRUE;
1556}
1557
1558////////////////////////////////////////////////////////////////////////////////
1559/// Saves the frame contents as a ROOT macro or as an image,
1560/// depending on the extension of the fileName argument.
1561/// If preexisting, the file is overwritten.
1562/// Returns kTRUE if something was saved.
1563
1565{
1566 static TString dir(".");
1567
1568 const TString fname = gSystem->UnixPathName(fileName);
1569 if (fname.EndsWith(".C")) {
1571 main->SaveSource(fname.Data(), "");
1572 } else {
1574 if (fname.EndsWith("gif")) {
1575 gtype = TImage::kGif;
1576 } else if (fname.EndsWith(".png")) {
1577 gtype = TImage::kPng;
1578 } else if (fname.EndsWith(".jpg")) {
1579 gtype = TImage::kJpeg;
1580 } else if (fname.EndsWith(".tiff")) {
1581 gtype = TImage::kTiff;
1582 } else if (fname.EndsWith(".xpm")) {
1583 gtype = TImage::kXpm;
1584 }
1585 if (gtype != TImage::kUnknown) {
1586 Int_t saver = gErrorIgnoreLevel;
1588 TImage *img = TImage::Create();
1589 RaiseWindow();
1590 img->FromWindow(GetId());
1591 img->WriteImage(fname, gtype);
1592 gErrorIgnoreLevel = saver;
1593 delete img;
1594 } else {
1595 Error("SaveFrameAsCodeOrImage", "File cannot be saved with this extension");
1596 return kFALSE;
1597 }
1598 }
1599
1600 return kTRUE;
1601}
1602
1603////////////////////////////////////////////////////////////////////////////////
1604/// Handle keyboard events.
1605
1607{
1608 if (fBindList) {
1609
1610 TIter next(fBindList);
1611 TGMapKey *m;
1612 TGFrame *w = 0;
1613
1614 while ((m = (TGMapKey *) next())) {
1615 if (m->fKeyCode == event->fCode) {
1616 w = (TGFrame *) m->fWindow;
1617 if (w->HandleKey(event)) return kTRUE;
1618 }
1619 }
1620 }
1621
1622 if ((event->fType == kGKeyPress) && (event->fState & kKeyControlMask)) {
1623 UInt_t keysym;
1624 char str[2];
1625 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1626
1627 if ((keysym & ~0x20) == kKey_S) { // case insensitive ctrl-s
1628 return SaveFrameAsCodeOrImage();
1629 }
1630 }
1631 return kFALSE;
1632}
1633
1634////////////////////////////////////////////////////////////////////////////////
1635/// Bind key to a window.
1636
1637Bool_t TGMainFrame::BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const
1638{
1639 TList *list = fBindList;
1640 Handle_t id = fId;
1641
1642 if (fClient->IsEditable()) {
1644 list = main->GetBindList();
1645 id = main->GetId();
1646 }
1647
1648 if (list) {
1649 TGMapKey *m = new TGMapKey(keycode, (TGWindow *)w);
1650 list->Add(m);
1651 gVirtualX->GrabKey(id, keycode, modifier, kTRUE);
1652 return kTRUE;
1653 }
1654 return kFALSE;
1655}
1656
1657////////////////////////////////////////////////////////////////////////////////
1658/// Remove key binding.
1659
1660void TGMainFrame::RemoveBind(const TGWindow *, Int_t keycode, Int_t modifier) const
1661{
1662 if (fBindList) {
1663 TIter next(fBindList);
1664 TGMapKey *m;
1665 while ((m = (TGMapKey *) next())) {
1666 if (m->fKeyCode == (UInt_t) keycode) {
1667 fBindList->Remove(m);
1668 delete m;
1669 gVirtualX->GrabKey(fId, keycode, modifier, kFALSE);
1670 return;
1671 }
1672 }
1673 }
1674}
1675
1676////////////////////////////////////////////////////////////////////////////////
1677/// Handle mouse button events.
1678
1680{
1681 if (event->fType == kButtonRelease) {
1683 }
1685}
1686
1687
1688////////////////////////////////////////////////////////////////////////////////
1689/// Handle mouse motion events.
1690
1692{
1694 gDNDManager->Drag(event->fXRoot, event->fYRoot,
1696 }
1698}
1699
1700////////////////////////////////////////////////////////////////////////////////
1701/// Handle primary selection event.
1702
1704{
1705 if ((Atom_t)event->fUser[1] == TGDNDManager::GetDNDSelection()) {
1706 if (gDNDManager)
1708 }
1710}
1711
1712////////////////////////////////////////////////////////////////////////////////
1713/// Handle selection request event.
1714
1716{
1717 if ((Atom_t)event->fUser[1] == TGDNDManager::GetDNDSelection()) {
1718 if (gDNDManager)
1720 }
1722}
1723
1724////////////////////////////////////////////////////////////////////////////////
1725/// Handle client messages sent to this frame.
1726
1728{
1730
1731 if ((event->fFormat == 32) && ((Atom_t)event->fUser[0] == gWM_DELETE_WINDOW) &&
1732 (event->fHandle != gROOT_MESSAGE)) {
1733 Emit("CloseWindow()");
1735 CloseWindow();
1736 }
1737 return kTRUE;
1738}
1739
1740////////////////////////////////////////////////////////////////////////////////
1741/// Send close message to self. This method should be called from
1742/// a button to close this window.
1743
1745{
1746 Event_t event;
1747
1748 event.fType = kClientMessage;
1749 event.fFormat = 32;
1750 event.fHandle = gWM_DELETE_WINDOW;
1751
1752 event.fWindow = GetId();
1753 event.fUser[0] = (Long_t) gWM_DELETE_WINDOW;
1754 event.fUser[1] = 0;
1755 event.fUser[2] = 0;
1756 event.fUser[3] = 0;
1757 event.fUser[4] = 0;
1758
1759 gVirtualX->SendEvent(GetId(), &event);
1760}
1761
1762////////////////////////////////////////////////////////////////////////////////
1763/// Close and delete main frame. We get here in response to ALT+F4 or
1764/// a window manager close command. To terminate the application when this
1765/// happens override this method and call gApplication->Terminate(0) or
1766/// make a connection to this signal (if after the slot this method
1767/// should not be called call DontCallClose() in the slot).
1768/// By default the window will be deleted.
1769
1771{
1772 DeleteWindow();
1773}
1774
1775////////////////////////////////////////////////////////////////////////////////
1776/// Typically call this method in the slot connected to the CloseWindow()
1777/// signal to prevent the calling of the default or any derived CloseWindow()
1778/// methods to prevent premature or double deletion of this window.
1779
1781{
1783}
1784
1785////////////////////////////////////////////////////////////////////////////////
1786/// Set window name. This is typically done via the window manager.
1787
1789{
1790 if (!name) {
1792 } else {
1793 fWindowName = name;
1794 gVirtualX->SetWindowName(fId, (char *)name);
1795 }
1796}
1797
1798////////////////////////////////////////////////////////////////////////////////
1799/// Set window icon name. This is typically done via the window manager.
1800
1802{
1803 fIconName = name;
1804 gVirtualX->SetIconName(fId, (char *)name);
1805}
1806
1807////////////////////////////////////////////////////////////////////////////////
1808/// Set window icon pixmap by name. This is typically done via the window
1809/// manager. Icon can be in any image format supported by TImage, e.g.
1810/// GIF, XPM, PNG, JPG .. or even PS, PDF (see EImageFileTypes in TImage.h
1811/// for the full list of supported formats).
1812///
1813/// For example,
1814/// main_frame->SetIconPixmap("/home/root/icons/bld_rgb.png");
1815
1816const TGPicture *TGMainFrame::SetIconPixmap(const char *iconName)
1817{
1818 fIconPixmap = iconName;
1819 const TGPicture *iconPic = fClient->GetPicture(iconName);
1820 if (iconPic) {
1821 Pixmap_t pic = iconPic->GetPicture();
1822 gVirtualX->SetIconPixmap(fId, pic);
1823 return iconPic;
1824 } else
1825 return 0;
1826}
1827
1828////////////////////////////////////////////////////////////////////////////////
1829/// Set window icon by xpm array. That allows to have icons
1830/// builtin to the source code.
1831///
1832/// For example,
1833/// #include "/home/root/icons/bld_rgb.xpm"
1834/// //bld_rgb.xpm contains char *bld_rgb[] array
1835/// main_frame->SetIconPixmap(bld_rgb);
1836
1837void TGMainFrame::SetIconPixmap(char **xpm_array)
1838{
1839 TImage *img = TImage::Create();
1840 if (!img) return;
1841 img->SetImageBuffer(xpm_array, TImage::kXpm);
1842 Pixmap_t pic = img->GetPixmap();
1843 if (pic) {
1844 gVirtualX->SetIconPixmap(fId, pic);
1845 } else {
1846 Warning("SetIconPixmap", "Failed to set window icon from xpm array.");
1847 }
1848 delete img;
1849}
1850
1851////////////////////////////////////////////////////////////////////////////////
1852/// Set the windows class and resource name. Used to get the right
1853/// resources from the resource database. However, ROOT applications
1854/// will typically use the .rootrc file for this.
1855
1856void TGMainFrame::SetClassHints(const char *className, const char *resourceName)
1857{
1858 fClassName = className;
1859 fResourceName = resourceName;
1860 gVirtualX->SetClassHints(fId, (char *)className, (char *)resourceName);
1861}
1862
1863////////////////////////////////////////////////////////////////////////////////
1864/// Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
1865
1867{
1868 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1869
1870 fMWMValue = value;
1871 fMWMFuncs = funcs;
1872 fMWMInput = input;
1873 gVirtualX->SetMWMHints(fId, value, funcs, input);
1874}
1875
1876////////////////////////////////////////////////////////////////////////////////
1877/// Give the window manager a window position hint.
1878
1880{
1881 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1882
1883 fWMX = x;
1884 fWMY = y;
1885 gVirtualX->SetWMPosition(fId, x, y);
1886}
1887
1888////////////////////////////////////////////////////////////////////////////////
1889/// Give the window manager a window size hint.
1890
1892{
1893 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1894
1895 fWMWidth = w;
1896 fWMHeight = h;
1897 gVirtualX->SetWMSize(fId, w, h);
1898}
1899
1900////////////////////////////////////////////////////////////////////////////////
1901/// Give the window manager minimum and maximum size hints. Also
1902/// specify via winc and hinc the resize increments.
1903
1905 UInt_t wmax, UInt_t hmax,
1906 UInt_t winc, UInt_t hinc)
1907{
1908 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1909
1910 fMinWidth = fWMMinWidth = wmin;
1911 fMinHeight = fWMMinHeight = hmin;
1912 fMaxWidth = fWMMaxWidth = wmax;
1913 fMaxHeight = fWMMaxHeight = hmax;
1914 fWMWidthInc = winc;
1915 fWMHeightInc = hinc;
1916 gVirtualX->SetWMSizeHints(fId, wmin, hmin, wmax, hmax, winc, hinc);
1917}
1918
1919////////////////////////////////////////////////////////////////////////////////
1920/// Set the initial state of the window. Either kNormalState or kIconicState.
1921
1923{
1924 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1925
1926 fWMInitState = state;
1927 gVirtualX->SetWMState(fId, state);
1928}
1929
1930
1931////////////////////////////////////////////////////////////////////////////////
1932/// Create a transient window. A transient window is typically used for
1933/// dialog boxes.
1934
1936 UInt_t w, UInt_t h, UInt_t options)
1937 : TGMainFrame(p, w, h, options | kTransientFrame)
1938{
1939 fMain = main;
1940 if (!fMain && gClient)
1941 fMain = gClient->GetRoot();
1942
1943 if (fMain) {
1944 gVirtualX->SetWMTransientHint(fId, fMain->GetId());
1945 }
1946}
1947
1948////////////////////////////////////////////////////////////////////////////////
1949/// Position transient frame centered relative to the parent frame.
1950/// If fMain is 0 (i.e. TGTransientFrame is acting just like a
1951/// TGMainFrame) and croot is true, the window will be centered on
1952/// the root window, otherwise no action is taken and the default
1953/// wm placement will be used.
1954
1956{
1957 Int_t x=0, y=0, ax, ay;
1958 Window_t wdummy;
1959
1962
1963 if (fMain) {
1964
1965 switch (pos) {
1966 case kCenter:
1967 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - fWidth) >> 1;
1968 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - fHeight) >> 1;
1969 break;
1970 case kRight:
1971 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - (fWidth >> 1));
1972 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - fHeight) >> 1;
1973 break;
1974 case kLeft:
1975 x = (Int_t)(-1 * (Int_t)(fWidth >> 1));
1976 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - fHeight) >> 1;
1977 break;
1978 case kTop:
1979 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - fWidth) >> 1;
1980 y = (Int_t)(-1 * (Int_t)(fHeight >> 1));
1981 break;
1982 case kBottom:
1983 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - fWidth) >> 1;
1984 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - (fHeight >> 1));
1985 break;
1986 case kTopLeft:
1987 x = (Int_t)(-1 * (Int_t)(fWidth >> 1));
1988 y = (Int_t)(-1 * (Int_t)(fHeight >> 1));
1989 break;
1990 case kTopRight:
1991 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - (fWidth >> 1));
1992 y = (Int_t)(-1 * (Int_t)(fHeight >> 1));
1993 break;
1994 case kBottomLeft:
1995 x = (Int_t)(-1 * (Int_t)(fWidth >> 1));
1996 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - (fHeight >> 1));
1997 break;
1998 case kBottomRight:
1999 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - (fWidth >> 1));
2000 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - (fHeight >> 1));
2001 break;
2002 }
2003
2004 gVirtualX->TranslateCoordinates(fMain->GetId(), GetParent()->GetId(),
2005 x, y, ax, ay, wdummy);
2006 if (!gVirtualX->InheritsFrom("TGWin32")) {
2007 if (ax < 10)
2008 ax = 10;
2009 else if (ax + fWidth + 10 > dw)
2010 ax = dw - fWidth - 10;
2011
2012 if (ay < 20)
2013 ay = 20;
2014 else if (ay + fHeight + 50 > dh)
2015 ay = dh - fHeight - 50;
2016 }
2017
2018 } else if (croot) {
2019
2020 switch (pos) {
2021 case kCenter:
2022 x = (dw - fWidth) >> 1;
2023 y = (dh - fHeight) >> 1;
2024 break;
2025 case kRight:
2026 x = dw - (fWidth >> 1);
2027 y = (dh - fHeight) >> 1;
2028 break;
2029 case kLeft:
2030 x = -1 * (Int_t)(fWidth >> 1);
2031 y = (dh - fHeight) >> 1;
2032 break;
2033 case kTop:
2034 x = (dw - fWidth) >> 1;
2035 y = -1 * (Int_t)(fHeight >> 1);
2036 break;
2037 case kBottom:
2038 x = (dw - fWidth) >> 1;
2039 y = dh - (fHeight >> 1);
2040 break;
2041 case kTopLeft:
2042 x = -1 * (Int_t)(fWidth >> 1);
2043 y = -1 * (Int_t)(fHeight >> 1);
2044 break;
2045 case kTopRight:
2046 x = dw - (fWidth >> 1);
2047 y = -1 * (Int_t)(fHeight >> 1);
2048 break;
2049 case kBottomLeft:
2050 x = -1 * (Int_t)(fWidth >> 1);
2051 y = dh - (fHeight >> 1);
2052 break;
2053 case kBottomRight:
2054 x = dw - (fWidth >> 1);
2055 y = dh - (fHeight >> 1);
2056 break;
2057 }
2058
2059 ax = x;
2060 ay = y;
2061
2062 } else {
2063
2064 return;
2065
2066 }
2067
2068 Move(ax, ay);
2069 SetWMPosition(ax, ay);
2070}
2071
2072////////////////////////////////////////////////////////////////////////////////
2073/// Create a group frame. The title will be adopted and deleted by the
2074/// group frame.
2075
2077 UInt_t options, GContext_t norm,
2078 FontStruct_t font, Pixel_t back) :
2079 TGCompositeFrame(p, 1, 1, options, back)
2080{
2081 fText = title;
2082 fFontStruct = font;
2083 fNormGC = norm;
2084 fTitlePos = kLeft;
2086
2087 int max_ascent, max_descent;
2088 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
2089 fBorderWidth = max_ascent + max_descent + 1;
2090}
2091
2092////////////////////////////////////////////////////////////////////////////////
2093/// Create a group frame.
2094
2095TGGroupFrame::TGGroupFrame(const TGWindow *p, const char *title,
2096 UInt_t options, GContext_t norm,
2097 FontStruct_t font, Pixel_t back) :
2098 TGCompositeFrame(p, 1, 1, options, back)
2099{
2100 fText = new TGString(!p && !title ? GetName() : title);
2101 fFontStruct = font;
2102 fNormGC = norm;
2103 fTitlePos = kLeft;
2105
2106 int max_ascent, max_descent;
2107 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
2108 fBorderWidth = max_ascent + max_descent + 1;
2109
2110 SetWindowName();
2111}
2112
2113////////////////////////////////////////////////////////////////////////////////
2114/// Delete a group frame.
2115
2117{
2118 if (fHasOwnFont) {
2119 TGGCPool *pool = fClient->GetGCPool();
2120 TGGC *gc = pool->FindGC(fNormGC);
2121 pool->FreeGC(gc);
2122 }
2123 delete fText;
2124}
2125
2126////////////////////////////////////////////////////////////////////////////////
2127/// Returns default size.
2128
2130{
2131 UInt_t tw = gVirtualX->TextWidth(fFontStruct, fText->GetString(),
2132 fText->GetLength()) + 24;
2133
2135
2136 return tw>dim.fWidth ? TGDimension(tw, dim.fHeight) : dim;
2137}
2138
2139////////////////////////////////////////////////////////////////////////////////
2140/// Redraw the group frame. Need special DoRedraw() since we need to
2141/// redraw with fBorderWidth=0.
2142
2144{
2145 gVirtualX->ClearArea(fId, 0, 0, fWidth, fHeight);
2146
2147 DrawBorder();
2148}
2149
2150
2151////////////////////////////////////////////////////////////////////////////////
2152/// Changes text color.
2153/// If local is true color is changed locally, otherwise - globally.
2154
2156{
2158 TGGC *gc = pool->FindGC(fNormGC);
2159
2160 if (gc && local) {
2161 gc = pool->GetGC((GCValues_t*)gc->GetAttributes(), kTRUE); // copy
2163 }
2164 if (gc) {
2165 gc->SetForeground(color);
2166 fNormGC = gc->GetGC();
2167 }
2168 fClient->NeedRedraw(this);
2169}
2170
2171////////////////////////////////////////////////////////////////////////////////
2172/// Changes text font.
2173/// If local is true font is changed locally - otherwise globally.
2174
2176{
2177 FontH_t v = gVirtualX->GetFontHandle(font);
2178 if (!v) return;
2179
2180 fFontStruct = font;
2181
2183 TGGC *gc = pool->FindGC(fNormGC);
2184
2185 if (gc && local) {
2186 gc = pool->GetGC((GCValues_t*)gc->GetAttributes(), kTRUE); // copy
2188 }
2189 if (gc) {
2190 gc->SetFont(v);
2191 fNormGC = gc->GetGC();
2192 }
2193 fClient->NeedRedraw(this);
2194}
2195
2196////////////////////////////////////////////////////////////////////////////////
2197/// Changes text font specified by name.
2198/// If local is true font is changed locally - otherwise globally.
2199
2200void TGGroupFrame::SetTextFont(const char *fontName, Bool_t local)
2201{
2202 TGFont *font = fClient->GetFont(fontName);
2203
2204 if (font) {
2205 SetTextFont(font->GetFontStruct(), local);
2206 }
2207}
2208
2209////////////////////////////////////////////////////////////////////////////////
2210/// Returns kTRUE if text attributes are unique,
2211/// returns kFALSE if text attributes are shared (global).
2212
2214{
2215 return fHasOwnFont;
2216}
2217
2218////////////////////////////////////////////////////////////////////////////////
2219/// Draw border of around the group frame.
2220///
2221/// if frame is kRaisedFrame - a frame border is of "wall style",
2222/// otherwise of "groove style".
2223
2225{
2226 Int_t x, y, l, t, r, b, gl, gr, sep, max_ascent, max_descent;
2227
2228 UInt_t tw = gVirtualX->TextWidth(fFontStruct, fText->GetString(), fText->GetLength());
2229 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
2230
2231 l = 0;
2232 t = (max_ascent + max_descent + 2) >> 1;
2233 r = fWidth - 1;
2234 // next three lines are for backward compatibility in case of horizontal layout
2235 // coverity[returned_null]
2236 // coverity[dereference]
2238 if ((lm->InheritsFrom(TGHorizontalLayout::Class())) ||
2239 (lm->InheritsFrom(TGMatrixLayout::Class())))
2240 b = fHeight - 1;
2241 else
2242 b = fHeight - t;
2243
2244 sep = 3;
2245 UInt_t rr = 5 + (sep << 1) + tw;
2246
2247 switch (fTitlePos) {
2248 case kRight:
2249 gl = fWidth>rr ? Int_t(fWidth - rr) : 5 + sep;
2250 break;
2251 case kCenter:
2252 gl = fWidth>tw ? Int_t((fWidth - tw)>>1) - sep : 5 + sep;
2253 break;
2254 case kLeft:
2255 default:
2256 gl = 5 + sep;
2257 }
2258 gr = gl + tw + (sep << 1);
2259
2260 switch (fOptions & (kSunkenFrame | kRaisedFrame)) {
2261 case kRaisedFrame:
2262 gVirtualX->DrawLine(fId, GetHilightGC()(), l, t, gl, t);
2263 gVirtualX->DrawLine(fId, GetShadowGC()(), l+1, t+1, gl, t+1);
2264
2265 gVirtualX->DrawLine(fId, GetHilightGC()(), gr, t, r-1, t);
2266 gVirtualX->DrawLine(fId, GetShadowGC()(), gr, t+1, r-2, t+1);
2267
2268 gVirtualX->DrawLine(fId, GetHilightGC()(), r-1, t, r-1, b-1);
2269 gVirtualX->DrawLine(fId, GetShadowGC()(), r, t, r, b);
2270
2271 gVirtualX->DrawLine(fId, GetHilightGC()(), r-1, b-1, l, b-1);
2272 gVirtualX->DrawLine(fId, GetShadowGC()(), r, b, l, b);
2273
2274 gVirtualX->DrawLine(fId, GetHilightGC()(), l, b-1, l, t);
2275 gVirtualX->DrawLine(fId, GetShadowGC()(), l+1, b-2, l+1, t+1);
2276 break;
2277 case kSunkenFrame:
2278 default:
2279 gVirtualX->DrawLine(fId, GetShadowGC()(), l, t, gl, t);
2280 gVirtualX->DrawLine(fId, GetHilightGC()(), l+1, t+1, gl, t+1);
2281
2282 gVirtualX->DrawLine(fId, GetShadowGC()(), gr, t, r-1, t);
2283 gVirtualX->DrawLine(fId, GetHilightGC()(), gr, t+1, r-2, t+1);
2284
2285 gVirtualX->DrawLine(fId, GetShadowGC()(), r-1, t, r-1, b-1);
2286 gVirtualX->DrawLine(fId, GetHilightGC()(), r, t, r, b);
2287
2288 gVirtualX->DrawLine(fId, GetShadowGC()(), r-1, b-1, l, b-1);
2289 gVirtualX->DrawLine(fId, GetHilightGC()(), r, b, l, b);
2290
2291 gVirtualX->DrawLine(fId, GetShadowGC()(), l, b-1, l, t);
2292 gVirtualX->DrawLine(fId, GetHilightGC()(), l+1, b-2, l+1, t+1);
2293 break;
2294 }
2295
2296 x = gl + sep;
2297 y = 1;
2298
2299 fText->Draw(fId, fNormGC, x, y + max_ascent);
2300}
2301
2302////////////////////////////////////////////////////////////////////////////////
2303/// Set or change title of the group frame. Title TGString is adopted
2304/// by the TGGroupFrame.
2305
2307{
2308 if (!title) {
2309 Warning("SetTitle", "title cannot be 0, try \"\"");
2310 title = new TGString("");
2311 }
2312
2313 delete fText;
2314
2315 fText = title;
2316 fClient->NeedRedraw(this);
2317}
2318
2319////////////////////////////////////////////////////////////////////////////////
2320/// Set or change title of the group frame.
2321
2322void TGGroupFrame::SetTitle(const char *title)
2323{
2324 if (!title) {
2325 Error("SetTitle", "title cannot be 0, try \"\"");
2326 return;
2327 }
2328
2329 SetTitle(new TGString(title));
2330}
2331
2332////////////////////////////////////////////////////////////////////////////////
2333/// Return default font structure in use.
2334
2336{
2337 if (!fgDefaultFont && gClient)
2338 fgDefaultFont = gClient->GetResourcePool()->GetDefaultFont();
2339 return fgDefaultFont->GetFontStruct();
2340}
2341
2342////////////////////////////////////////////////////////////////////////////////
2343/// Return default graphics context in use.
2344
2346{
2347 if (!fgDefaultGC && gClient)
2348 fgDefaultGC = gClient->GetResourcePool()->GetFrameGC();
2349 return *fgDefaultGC;
2350}
2351
2352////////////////////////////////////////////////////////////////////////////////
2353/// Header Frame constructor.
2354
2356 UInt_t options, Pixel_t back) :
2357 TGHorizontalFrame(p, w, h, options | kVerticalFrame, back)
2358{
2360 fSplitCursor = gVirtualX->CreateCursor(kArrowHor);
2361 fOverSplitter = false;
2362 fOverButton = -1;
2363 fLastButton = -1;
2364 fNColumns = 1;
2365 fColHeader = 0;
2366 fSplitHeader = 0;
2367
2368 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
2370 kNone, kNone);
2372}
2373
2374////////////////////////////////////////////////////////////////////////////////
2375/// Set columns information in the header frame.
2376
2378 TGVFileSplitter **splitHeader)
2379{
2380 fNColumns = nColumns;
2381 fColHeader = colHeader;
2382 fSplitHeader = splitHeader;
2383}
2384
2385////////////////////////////////////////////////////////////////////////////////
2386/// Handle mouse button event in header frame.
2387
2389{
2390 if ( event->fY > 0 &&
2391 event->fY <= (Int_t) this->GetHeight() ) {
2392 for (Int_t i = 1; i < fNColumns; ++i ) {
2393 if ( event->fX < fColHeader[i]->GetX() &&
2394 event->fX >= fColHeader[i-1]->GetX() ) {
2395 if ( fOverSplitter ) {
2396 if ( event->fX <= fColHeader[i-1]->GetX() + 5 )
2398 else
2400 } else {
2401 if ( event->fType == kButtonPress ) {
2402 fLastButton = i - 1;
2403 } else {
2404 fLastButton = -1;
2405 }
2406 event->fX -= fColHeader[i-1]->GetX();
2408 }
2409 break;
2410 }
2411 }
2412 }
2413
2414 return kTRUE;
2415}
2416
2417////////////////////////////////////////////////////////////////////////////////
2418/// Handle double click mouse event in header frame.
2419
2421{
2422 if ( event->fY > 0 &&
2423 event->fY <= (Int_t) this->GetHeight() ) {
2424 for (Int_t i = 1; i < fNColumns; ++i ) {
2425 if ( event->fX < fColHeader[i]->GetX() &&
2426 event->fX >= fColHeader[i-1]->GetX() ) {
2427 if ( fOverSplitter ) {
2428 if ( event->fX <= fColHeader[i-1]->GetX() + 5 )
2430 else
2432 } else {
2433 event->fX -= fColHeader[i-1]->GetX();
2435 }
2436 break;
2437 }
2438 }
2439 }
2440
2441 return kTRUE;
2442}
2443
2444////////////////////////////////////////////////////////////////////////////////
2445/// Handle mouse motion events in header frame.
2446
2448{
2449 if ( event->fY > 0 &&
2450 event->fY <= (Int_t) this->GetHeight() ) {
2451 Bool_t inMiddle = false;
2452
2453 for (Int_t i = 1; i < fNColumns; ++i ) {
2454 if ( event->fX > fColHeader[i]->GetX() - 5 &&
2455 event->fX < fColHeader[i]->GetX() + 5 ) {
2456 inMiddle = true;
2457 }
2458 if ( event->fX < fColHeader[i]->GetX() &&
2459 event->fX >= fColHeader[i-1]->GetX() ) {
2460 fOverButton = i - 1;
2461 }
2462 }
2463 fOverSplitter = inMiddle;
2464 if ( fOverSplitter ) {
2465 gVirtualX->SetCursor(fId, fSplitCursor);
2466 }
2467 else {
2468 gVirtualX->SetCursor(fId, kNone);
2469 }
2470 }
2471 return kTRUE;
2472}
2473
2474////////////////////////////////////////////////////////////////////////////////
2475/// Save a user color in a C++ macro file - used in SavePrimitive().
2476
2477void TGFrame::SaveUserColor(std::ostream &out, Option_t *option)
2478{
2479 char quote = '"';
2480
2481 if (gROOT->ClassSaved(TGFrame::Class())) {
2482 out << std::endl;
2483 } else {
2484 // declare a color variable to reflect required user changes
2485 out << std::endl;
2486 out << " ULong_t ucolor; // will reflect user color changes" << std::endl;
2487 }
2488 ULong_t ucolor;
2489 if (option && !strcmp(option, "slider"))
2490 ucolor = GetDefaultFrameBackground();
2491 else
2492 ucolor = GetBackground();
2493 if ((ucolor != fgUserColor) || (ucolor == GetWhitePixel())) {
2494 const char *ucolorname = TColor::PixelAsHexString(ucolor);
2495 out << " gClient->GetColorByName(" << quote << ucolorname << quote
2496 << ",ucolor);" << std::endl;
2497 fgUserColor = ucolor;
2498 }
2499}
2500
2501////////////////////////////////////////////////////////////////////////////////
2502/// Returns a frame option string - used in SavePrimitive().
2503
2505{
2506 TString options;
2507
2508 if (!GetOptions()) {
2509 options = "kChildFrame";
2510 } else {
2511 if (fOptions & kMainFrame) {
2512 if (options.Length() == 0) options = "kMainFrame";
2513 else options += " | kMainFrame";
2514 }
2515 if (fOptions & kVerticalFrame) {
2516 if (options.Length() == 0) options = "kVerticalFrame";
2517 else options += " | kVerticalFrame";
2518 }
2519 if (fOptions & kHorizontalFrame) {
2520 if (options.Length() == 0) options = "kHorizontalFrame";
2521 else options += " | kHorizontalFrame";
2522 }
2523 if (fOptions & kSunkenFrame) {
2524 if (options.Length() == 0) options = "kSunkenFrame";
2525 else options += " | kSunkenFrame";
2526 }
2527 if (fOptions & kRaisedFrame) {
2528 if (options.Length() == 0) options = "kRaisedFrame";
2529 else options += " | kRaisedFrame";
2530 }
2531 if (fOptions & kDoubleBorder) {
2532 if (options.Length() == 0) options = "kDoubleBorder";
2533 else options += " | kDoubleBorder";
2534 }
2535 if (fOptions & kFitWidth) {
2536 if (options.Length() == 0) options = "kFitWidth";
2537 else options += " | kFitWidth";
2538 }
2539 if (fOptions & kFixedWidth) {
2540 if (options.Length() == 0) options = "kFixedWidth";
2541 else options += " | kFixedWidth";
2542 }
2543 if (fOptions & kFitHeight) {
2544 if (options.Length() == 0) options = "kFitHeight";
2545 else options += " | kFitHeight";
2546 }
2547 if (fOptions & kFixedHeight) {
2548 if (options.Length() == 0) options = "kFixedHeight";
2549 else options += " | kFixedHeight";
2550 }
2551 if (fOptions & kOwnBackground) {
2552 if (options.Length() == 0) options = "kOwnBackground";
2553 else options += " | kOwnBackground";
2554 }
2555 if (fOptions & kTransientFrame) {
2556 if (options.Length() == 0) options = "kTransientFrame";
2557 else options += " | kTransientFrame";
2558 }
2559 if (fOptions & kTempFrame) {
2560 if (options.Length() == 0) options = "kTempFrame";
2561 else options += " | kTempFrame";
2562 }
2563 }
2564 return options;
2565}
2566
2567////////////////////////////////////////////////////////////////////////////////
2568/// Returns MWM decoration hints as a string - used in SavePrimitive().
2569
2571{
2572 TString hints;
2573
2574 if (fMWMValue) {
2575 if (fMWMValue & kMWMDecorAll) {
2576 if (hints.Length() == 0) hints = "kMWMDecorAll";
2577 else hints += " | kMWMDecorAll";
2578 }
2579 if (fMWMValue & kMWMDecorBorder) {
2580 if (hints.Length() == 0) hints = "kMWMDecorBorder";
2581 else hints += " | kMWMDecorBorder";
2582 }
2584 if (hints.Length() == 0) hints = "kMWMDecorResizeH";
2585 else hints += " | kMWMDecorResizeH";
2586 }
2587 if (fMWMValue & kMWMDecorTitle) {
2588 if (hints.Length() == 0) hints = "kMWMDecorTitle";
2589 else hints += " | kMWMDecorTitle";
2590 }
2591 if (fMWMValue & kMWMDecorMenu) {
2592 if (hints.Length() == 0) hints = "kMWMDecorMenu";
2593 else hints += " | kMWMDecorMenu";
2594 }
2596 if (hints.Length() == 0) hints = "kMWMDecorMinimize";
2597 else hints += " | kMWMDecorMinimize";
2598 }
2600 if (hints.Length() == 0) hints = "kMWMDecorMaximize";
2601 else hints += " | kMWMDecorMaximize";
2602 }
2603 }
2604 return hints;
2605}
2606
2607////////////////////////////////////////////////////////////////////////////////
2608/// Returns MWM function hints as a string - used in SavePrimitive().
2609
2611{
2612 TString hints;
2613
2614 if (fMWMFuncs) {
2615
2616 if (fMWMFuncs & kMWMFuncAll) {
2617 if (hints.Length() == 0) hints = "kMWMFuncAll";
2618 else hints += " | kMWMFuncAll";
2619 }
2620 if (fMWMFuncs & kMWMFuncResize) {
2621 if (hints.Length() == 0) hints = "kMWMFuncResize";
2622 else hints += " | kMWMFuncResize";
2623 }
2624 if (fMWMFuncs & kMWMFuncMove) {
2625 if (hints.Length() == 0) hints = "kMWMFuncMove";
2626 else hints += " | kMWMFuncMove";
2627 }
2629 if (hints.Length() == 0) hints = "kMWMFuncMinimize";
2630 else hints += " | kMWMFuncMinimize";
2631 }
2633 if (hints.Length() == 0) hints = "kMWMFuncMaximize";
2634 else hints += " | kMWMFuncMaximize";
2635 }
2636 if (fMWMFuncs & kMWMFuncClose) {
2637 if (hints.Length() == 0) hints = "kMWMFuncClose";
2638 else hints += " | kMWMFuncClose";
2639 }
2640 }
2641 return hints;
2642}
2643
2644////////////////////////////////////////////////////////////////////////////////
2645/// Returns MWM input mode hints as a string - used in SavePrimitive().
2646
2648{
2649 TString hints;
2650
2651 if (fMWMInput == 0) hints = "kMWMInputModeless";
2652
2653 if (fMWMInput == 1) hints = "kMWMInputPrimaryApplicationModal";
2654
2655 if (fMWMInput == 2) hints = "kMWMInputSystemModal";
2656
2657 if (fMWMInput == 3) hints = "kMWMInputFullApplicationModal";
2658
2659 return hints;
2660}
2661
2662////////////////////////////////////////////////////////////////////////////////
2663/// Auxiliary protected method used to save subframes.
2664
2665void TGCompositeFrame::SavePrimitiveSubframes(std::ostream &out, Option_t *option /*= ""*/)
2666{
2667 if (fLayoutBroken)
2668 out << " " << GetName() << "->SetLayoutBroken(kTRUE);" << std::endl;
2669
2670 if (!fList) return;
2671
2672 char quote = '"';
2673
2674 TGFrameElement *el;
2675 static TGHSplitter *hsplit = 0;
2676 static TGVSplitter *vsplit = 0;
2677 TList *signalslist;
2678 TList *connlist;
2679 TQConnection *conn;
2680 TString signal_name, slot_name;
2681
2682 TIter next(fList);
2683
2684 while ((el = (TGFrameElement *) next())) {
2685
2686 // Don't save hidden (unmapped) frames having a parent different
2687 // than this frame. Solves a problem with shared frames
2688 // (e.g. shared menus in the new Browser)
2689 if ((!(el->fState & kIsVisible)) && (el->fFrame->GetParent() != this))
2690 continue;
2691
2692 // Remember if the frame to be saved is a TG(H,V)Splitter
2693 // See comments below and in TG[H/V]Splitter::SavePrimitive()
2694 if (el->fFrame->InheritsFrom("TGVSplitter")) {
2695 vsplit = (TGVSplitter *)el->fFrame;
2696 if (vsplit->GetLeft())
2697 vsplit = 0;
2698 }
2699 else if (el->fFrame->InheritsFrom("TGHSplitter")) {
2700 hsplit = (TGHSplitter *)el->fFrame;
2701 if (hsplit->GetAbove())
2702 hsplit = 0;
2703 }
2704 el->fFrame->SavePrimitive(out, option);
2705 out << " " << GetName() << "->AddFrame(" << el->fFrame->GetName();
2706 el->fLayout->SavePrimitive(out, option);
2707 out << ");"<< std::endl;
2708 if (IsLayoutBroken()) {
2709 out << " " << el->fFrame->GetName() << "->MoveResize(";
2710 out << el->fFrame->GetX() << "," << el->fFrame->GetY() << ",";
2711 out << el->fFrame->GetWidth() << "," << el->fFrame->GetHeight();
2712 out << ");" << std::endl;
2713 }
2714 // TG(H,V)Splitter->SetFrame(theframe) can only be saved _AFTER_
2715 // having saved "theframe", when "theframe" is either at right
2716 // or below the splitter (that means after the splitter in the
2717 // list of frames), otherwise "theframe" would be undefined
2718 // (aka used before to be created)...
2719 if (vsplit && el->fFrame == vsplit->GetFrame()) {
2720 out << " " << vsplit->GetName() << "->SetFrame(" << vsplit->GetFrame()->GetName();
2721 if (vsplit->GetLeft()) out << ",kTRUE);" << std::endl;
2722 else out << ",kFALSE);"<< std::endl;
2723 vsplit = 0;
2724 }
2725 if (hsplit && el->fFrame == hsplit->GetFrame()) {
2726 out << " " << hsplit->GetName() << "->SetFrame(" << hsplit->GetFrame()->GetName();
2727 if (hsplit->GetAbove()) out << ",kTRUE);" << std::endl;
2728 else out << ",kFALSE);"<< std::endl;
2729 hsplit = 0;
2730 }
2731
2732 if (!(el->fState & kIsVisible)) {
2734 }
2735
2736 // saving signals/slots
2737 signalslist = (TList*)el->fFrame->GetListOfSignals();
2738 if (!signalslist) continue;
2739 connlist = (TList*)signalslist->Last();
2740 if (connlist) {
2741 conn = (TQConnection*)connlist->Last();
2742 if (conn) {
2743 signal_name = connlist->GetName();
2744 slot_name = conn->GetName();
2745 Int_t eq = slot_name.First('=');
2746 Int_t rb = slot_name.First(')');
2747 if (eq != -1)
2748 slot_name.Remove(eq, rb-eq);
2749 out << " " << el->fFrame->GetName() << "->Connect(" << quote << signal_name
2750 << quote << ", 0, 0, " << quote << slot_name << quote << ");" << std::endl;
2751
2752 TList *lsl = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfSlots");
2753 if (lsl) {
2754 TObjString *slotel = (TObjString *)lsl->FindObject(slot_name);
2755 if (!slotel)
2756 lsl->Add(new TObjString(slot_name));
2757 }
2758 }
2759 }
2760 }
2761 out << std::endl;
2762}
2763
2764////////////////////////////////////////////////////////////////////////////////
2765/// Save a composite frame widget as a C++ statement(s) on output stream out.
2766
2767void TGCompositeFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
2768{
2770
2771 if (!strcmp(GetName(),"")) {
2772 SetName(Form("fCompositeframe%d",fgCounter));
2773 fgCounter++;
2774 }
2775
2776 out << std::endl << " // composite frame" << std::endl;
2777 out << " TGCompositeFrame *";
2778 out << GetName() << " = new TGCompositeFrame(" << fParent->GetName()
2779 << "," << GetWidth() << "," << GetHeight();
2780
2782 if (!GetOptions()) {
2783 out << ");" << std::endl;
2784 } else {
2785 out << "," << GetOptionString() <<");" << std::endl;
2786 }
2787 } else {
2788 out << "," << GetOptionString() << ",ucolor);" << std::endl;
2789 }
2790 if (option && strstr(option, "keep_names"))
2791 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
2792
2793 // setting layout manager if it differs from the composite frame type
2794 // coverity[returned_null]
2795 // coverity[dereference]
2797 if ((GetOptions() & kHorizontalFrame) &&
2798 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
2799 ;
2800 } else if ((GetOptions() & kVerticalFrame) &&
2801 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
2802 ;
2803 } else {
2804 out << " " << GetName() <<"->SetLayoutManager(";
2805 lm->SavePrimitive(out, option);
2806 out << ");"<< std::endl;
2807 }
2808
2809 SavePrimitiveSubframes(out, option);
2810}
2811
2812////////////////////////////////////////////////////////////////////////////////
2813/// Save the GUI main frame widget in a C++ macro file.
2814
2815void TGMainFrame::SaveSource(const char *filename, Option_t *option)
2816{
2817 // iteration over all active classes to exclude the base ones
2818 TString opt = option;
2819 TBits *bc = new TBits();
2820 TClass *c1, *c2, *c3;
2821 UInt_t k = 0; // will mark k-bit of TBits if the class is a base class
2822
2823 TIter nextc1(gROOT->GetListOfClasses());
2824 //gROOT->GetListOfClasses()->ls(); // valid. test
2825 while((c1 = (TClass *)nextc1())) {
2826
2827 // resets bit TClass::kClassSaved for all classes
2828 c1->ResetBit(TClass::kClassSaved);
2829
2830 TIter nextc2(gROOT->GetListOfClasses());
2831 while ((c2 = (TClass *)nextc2())) {
2832 if (c1==c2) continue;
2833 else {
2834 c3 = c2->GetBaseClass(c1);
2835 if (c3 != 0) {
2836 bc->SetBitNumber(k, kTRUE);
2837 break;
2838 }
2839 }
2840 }
2841 k++;
2842 }
2843
2844 TList *ilist = new TList(); // will contain include file names without '.h'
2845 ilist->SetName("ListOfIncludes");
2846 gROOT->GetListOfSpecials()->Add(ilist);
2847 k=0;
2848
2849 // completes list of include file names
2850 TIter nextdo(gROOT->GetListOfClasses());
2851 while ((c2 = (TClass *)nextdo())) {
2852 // for used GUI header files
2853 if (bc->TestBitNumber(k) == 0 && c2->InheritsFrom(TGObject::Class()) == 1) {
2854 // for any used ROOT header files activate the line below, comment the line above
2855 //if (bc->TestBitNumber(k) == 0) {
2856 const char *iname;
2857 iname = c2->GetDeclFileName();
2858 if (iname[0] && strstr(iname,".h")) {
2859 const char *lastsl = strrchr(iname,'/');
2860 if (lastsl) iname = lastsl + 1;
2861 char *tname = new char[strlen(iname)+1];
2862 Int_t i=0;
2863 while (*iname != '.') {
2864 tname[i] = *iname;
2865 i++; iname++;
2866 }
2867 tname[i] = 0; //tname = include file name without '.h'
2868
2869 TObjString *iel = (TObjString *)ilist->FindObject(tname);
2870 if (!iel) {
2871 ilist->Add(new TObjString(tname));
2872 }
2873 // Weird, but when saving a canvas, the following two classes
2874 // may be missing if the toolbar has not been displayed...
2875 if (strstr(tname, "TRootCanvas")) {
2876 if (!ilist->FindObject("TGDockableFrame"))
2877 ilist->Add(new TObjString("TGDockableFrame"));
2878 if (!ilist->FindObject("TG3DLine"))
2879 ilist->Add(new TObjString("TG3DLine"));
2880 }
2881 delete [] tname;
2882 }
2883 k++; continue;
2884 }
2885 k++;
2886 }
2887
2888 char quote = '"';
2889 std::ofstream out;
2890
2891 TString ff = filename && strlen(filename) ? filename : "Rootappl.C";
2892
2893 // Computes the main method name.
2894 const char *fname = gSystem->BaseName(ff.Data());
2895 Int_t lenfname = strlen(fname);
2896 char *sname = new char[lenfname+1];
2897
2898 Int_t i = 0;
2899 while ((*fname != '.') && (i < lenfname)) {
2900 sname[i] = *fname;
2901 i++; fname++;
2902 }
2903 if (i == lenfname)
2904 ff += ".C";
2905 sname[i] = 0;
2906
2907 out.open(ff.Data(), std::ios::out);
2908 if (!out.good()) {
2909 Error("SaveSource", "cannot open file: %s", ff.Data());
2910 delete [] sname;
2911 return;
2912 }
2913
2914 // writes include files in C++ macro
2915 TObjString *inc;
2916 ilist = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfIncludes");
2917
2918 if (!ilist) {
2919 delete [] sname;
2920 return;
2921 }
2922
2923 // write macro header, date/time stamp as string, and the used Root version
2924 TDatime t;
2925 out <<"// Mainframe macro generated from application: "<< gApplication->Argv(0) << std::endl;
2926 out <<"// By ROOT version "<< gROOT->GetVersion() <<" on "<<t.AsSQLString()<< std::endl;
2927 out << std::endl;
2928
2929 TIter nexti(ilist);
2930 while((inc = (TObjString *)nexti())) {
2931 out << "#ifndef ROOT_" << inc->GetString() << std::endl;
2932 out << "#include " << quote << inc->GetString() << ".h" << quote << std::endl;
2933 out << "#endif" << std::endl;
2934 if (strstr(inc->GetString(),"TRootEmbeddedCanvas")) {
2935 out << "#ifndef ROOT_TCanvas" << std::endl;
2936 out << "#include " << quote << "TCanvas.h" << quote << std::endl;
2937 out << "#endif" << std::endl;
2938 }
2939 }
2940 out << std::endl << "#include " << quote << "Riostream.h" << quote << std::endl;
2941 // deletes created ListOfIncludes
2942 gROOT->GetListOfSpecials()->Remove(ilist);
2943 ilist->Delete();
2944 delete ilist;
2945 delete bc;
2946
2947 // writes the macro entry point equal to the fname
2948 out << std::endl;
2949 out << "void " << sname << "()" << std::endl;
2950 out <<"{"<< std::endl;
2951 delete [] sname;
2952
2954
2955 // saving slots
2956 TList *lSlots = new TList;
2957 lSlots->SetName("ListOfSlots");
2958 gROOT->GetListOfSpecials()->Add(lSlots);
2959
2960 TGMainFrame::SavePrimitive(out, option);
2961
2962 if (strlen(fClassName) || strlen(fResourceName)) {
2963 out << " " << GetName() << "->SetClassHints(" << quote << fClassName
2964 << quote << "," << quote << fResourceName << quote << ");" << std::endl;
2965 }
2966
2968 if (fMWMValue || fMWMFuncs || fMWMInput) {
2969 out << " " << GetName() << "->SetMWMHints(";
2970 out << GetMWMvalueString() << "," << std::endl;
2971 out << " ";
2972 out << GetMWMfuncString() << "," << std::endl;
2973 out << " ";
2974 out << GetMWMinpString() << ");"<< std::endl;
2975 }
2976
2977/// GetWMPosition(fWMX, fWMY);
2978/// if ((fWMX != -1) || (fWMY != -1)) {
2979/// out <<" "<<GetName()<<"->SetWMPosition("<<fWMX<<","<<fWMY<<");"<<std::endl;
2980/// } // does not work - fixed via Move() below...
2981
2983 if (fWMWidth != UInt_t(-1) || fWMHeight != UInt_t(-1)) {
2984 out <<" "<<GetName()<<"->SetWMSize("<<fWMWidth<<","<<fWMHeight<<");"<<std::endl;
2985 }
2986
2988 if (fWMMinWidth != UInt_t(-1) || fWMMinHeight != UInt_t(-1) ||
2989 fWMMaxWidth != UInt_t(-1) || fWMMaxHeight != UInt_t(-1) ||
2990 fWMWidthInc != UInt_t(-1) || fWMHeightInc != UInt_t(-1)) {
2991 out <<" "<<GetName()<<"->SetWMSizeHints("<<fWMMinWidth<<","<<fWMMinHeight
2992 <<","<<fWMMaxWidth<<","<<fWMMaxHeight
2993 <<","<<fWMWidthInc<<","<<fWMHeightInc <<");"<<std::endl;
2994 }
2995
2996 out << " " <<GetName()<< "->MapSubwindows();" << std::endl;
2997
2999 TGFrame *fhidden;
3000 while ((fhidden = (TGFrame*)nexth())) {
3001 out << " " <<fhidden->GetName()<< "->UnmapWindow();" << std::endl;
3002 }
3003
3004 out << std::endl;
3006
3007 Bool_t usexy = kFALSE;
3008 // coverity[returned_null]
3009 // coverity[dereference]
3011 if (lm->InheritsFrom("TGXYLayout"))
3012 usexy = kTRUE;
3013
3014 if (!usexy)
3015 out << " " <<GetName()<< "->Resize("<< GetName()<< "->GetDefaultSize());" << std::endl;
3016 else
3017 out << " " <<GetName()<< "->Resize("<< GetWidth()<<","<<GetHeight()<<");"<<std::endl;
3018
3019 out << " " <<GetName()<< "->MapWindow();" <<std::endl;
3020
3022 if ((fWMX != -1) || (fWMY != -1)) {
3023 out <<" "<<GetName()<<"->Move("<<fWMX<<","<<fWMY<<");"<<std::endl;
3024 }
3025
3026 // needed in case the frame was resized
3027 // otherwise the frame became bigger showing all hidden widgets (layout algorithm)
3028 if (!usexy) out << " " <<GetName()<< "->Resize("<< GetWidth()<<","<<GetHeight()<<");"<<std::endl;
3029 out << "} " << std::endl;
3030
3031 // writing slots
3032 TList *sl = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfSlots");
3033 if (sl) {
3034 TIter nextsl(sl);
3035 TObjString *slobj;
3036 Int_t pnumber = 1;
3037
3038 while ((slobj = (TObjString*) nextsl())) {
3039 TString s = slobj->GetString();
3040 TString p = "";
3041 Int_t lb, rb, eq;
3042 lb = s.First('(');
3043 rb = s.First(')');
3044 eq = s.First('=');
3045 out << std::endl;
3046
3047 if (rb - lb > 1 && eq == -1) {
3048 p = TString::Format(" par%d", pnumber);
3049 s.Insert(rb, p);
3050 pnumber++;
3051 out << "void " << s << std::endl;
3052 out << "{" << std::endl;
3053 s = slobj->GetString();
3054 s[rb] = ' ';
3055 out << " std::cout << " << quote << "Slot " << s << quote
3056 << " <<" << p << " << " << quote << ")" << quote
3057 << " << std::endl; " << std::endl;
3058 } else {
3059 if (eq != -1) {
3060 s.Remove(eq, rb-eq);
3061 out << "void " << s << std::endl;
3062 out << "{" << std::endl;
3063 out << " std::cout << " << quote << "Slot " << s
3064 << quote << " << std::endl; " << std::endl;
3065 } else {
3066 out << "void " << slobj->GetString() << std::endl;
3067 out << "{" << std::endl;
3068 out << " std::cout << " << quote << "Slot " << slobj->GetString()
3069 << quote << " << std::endl; " << std::endl;
3070 }
3071 }
3072 out << "}" << std::endl;
3073 }
3074 gROOT->GetListOfSpecials()->Remove(sl);
3075 sl->Delete();
3076 delete sl;
3077 }
3078 out.close();
3079
3080 if (!opt.Contains("quiet"))
3081 printf(" C++ macro file %s has been generated\n", gSystem->BaseName(ff.Data()));
3082
3083 // reset bit TClass::kClassSaved for all classes
3084 nextc1.Reset();
3085 while((c1=(TClass*)nextc1())) {
3086 c1->ResetBit(TClass::kClassSaved);
3087 }
3088}
3089
3090////////////////////////////////////////////////////////////////////////////////
3091/// Save a main frame widget as a C++ statement(s) on output stream out.
3092
3093void TGMainFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3094{
3095 if (fParent != gClient->GetDefaultRoot()) { // frame is embedded
3096 fOptions &= ~kMainFrame;
3099 return;
3100 }
3101
3102 char quote = '"';
3103
3104 out << std::endl << " // main frame" << std::endl;
3105 out << " TGMainFrame *";
3106 out << GetName() << " = new TGMainFrame(gClient->GetRoot(),10,10," // layout alg.
3107 << GetOptionString() << ");" <<std::endl;
3108 if (option && strstr(option, "keep_names"))
3109 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3110
3111 // setting layout manager if it differs from the main frame type
3112 // coverity[returned_null]
3113 // coverity[dereference]
3115 if ((GetOptions() & kHorizontalFrame) &&
3116 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
3117 ;
3118 } else if ((GetOptions() & kVerticalFrame) &&
3119 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
3120 ;
3121 } else {
3122 out << " " << GetName() <<"->SetLayoutManager(";
3123 lm->SavePrimitive(out, option);
3124 out << ");"<< std::endl;
3125 }
3126
3127 SavePrimitiveSubframes(out, option);
3128
3129 if (strlen(fWindowName)) {
3130 out << " " << GetName() << "->SetWindowName(" << quote << GetWindowName()
3131 << quote << ");" << std::endl;
3132 }
3133 if (strlen(fIconName)) {
3134 out <<" "<<GetName()<< "->SetIconName("<<quote<<GetIconName()<<quote<<");"<<std::endl;
3135 }
3136 if (strlen(fIconPixmap)) {
3137 out << " " << GetName() << "->SetIconPixmap(" << quote << GetIconPixmap()
3138 << quote << ");" << std::endl;
3139 }
3140}
3141
3142////////////////////////////////////////////////////////////////////////////////
3143/// Save a horizontal frame widget as a C++ statement(s) on output stream out.
3144
3145void TGHorizontalFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3146{
3148
3149 out << std::endl << " // horizontal frame" << std::endl;
3150 out << " TGHorizontalFrame *";
3151 out << GetName() << " = new TGHorizontalFrame(" << fParent->GetName()
3152 << "," << GetWidth() << "," << GetHeight();
3153
3155 if (!GetOptions()) {
3156 out << ");" << std::endl;
3157 } else {
3158 out << "," << GetOptionString() <<");" << std::endl;
3159 }
3160 } else {
3161 out << "," << GetOptionString() << ",ucolor);" << std::endl;
3162 }
3163 if (option && strstr(option, "keep_names"))
3164 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3165
3166 // setting layout manager if it differs from the main frame type
3167 // coverity[returned_null]
3168 // coverity[dereference]
3170 if ((GetOptions() & kHorizontalFrame) &&
3171 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
3172 ;
3173 } else if ((GetOptions() & kVerticalFrame) &&
3174 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
3175 ;
3176 } else {
3177 out << " " << GetName() <<"->SetLayoutManager(";
3178 lm->SavePrimitive(out, option);
3179 out << ");"<< std::endl;
3180 }
3181
3182 SavePrimitiveSubframes(out, option);
3183}
3184
3185////////////////////////////////////////////////////////////////////////////////
3186/// Save a vertical frame widget as a C++ statement(s) on output stream out.
3187
3188void TGVerticalFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3189{
3191
3192 out << std::endl << " // vertical frame" << std::endl;
3193 out << " TGVerticalFrame *";
3194 out << GetName() << " = new TGVerticalFrame(" << fParent->GetName()
3195 << "," << GetWidth() << "," << GetHeight();
3196
3198 if (!GetOptions()) {
3199 out <<");" << std::endl;
3200 } else {
3201 out << "," << GetOptionString() <<");" << std::endl;
3202 }
3203 } else {
3204 out << "," << GetOptionString() << ",ucolor);" << std::endl;
3205 }
3206 if (option && strstr(option, "keep_names"))
3207 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3208
3209 // setting layout manager if it differs from the main frame type
3210 // coverity[returned_null]
3211 // coverity[dereference]
3213 if ((GetOptions() & kHorizontalFrame) &&
3214 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
3215 ;
3216 } else if ((GetOptions() & kVerticalFrame) &&
3217 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
3218 ;
3219 } else {
3220 out << " " << GetName() <<"->SetLayoutManager(";
3221 lm->SavePrimitive(out, option);
3222 out << ");"<< std::endl;
3223 }
3224
3225 SavePrimitiveSubframes(out, option);
3226}
3227
3228////////////////////////////////////////////////////////////////////////////////
3229/// Save a frame widget as a C++ statement(s) on output stream out.
3230
3231void TGFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3232{
3234
3235 out << " TGFrame *";
3236 out << GetName() << " = new TGFrame("<< fParent->GetName()
3237 << "," << GetWidth() << "," << GetHeight();
3238
3240 if (!GetOptions()) {
3241 out <<");" << std::endl;
3242 } else {
3243 out << "," << GetOptionString() <<");" << std::endl;
3244 }
3245 } else {
3246 out << "," << GetOptionString() << ",ucolor);" << std::endl;
3247 }
3248 if (option && strstr(option, "keep_names"))
3249 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3250}
3251
3252////////////////////////////////////////////////////////////////////////////////
3253/// Save a group frame widget as a C++ statement(s) on output stream out.
3254
3255void TGGroupFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3256{
3257 char quote = '"';
3258
3259 // font + GC
3260 option = GetName()+5; // unique digit id of the name
3261 TString parGC, parFont;
3262 // coverity[returned_null]
3263 // coverity[dereference]
3264 parFont.Form("%s::GetDefaultFontStruct()",IsA()->GetName());
3265 // coverity[returned_null]
3266 // coverity[dereference]
3267 parGC.Form("%s::GetDefaultGC()()",IsA()->GetName());
3268
3269 if ((GetDefaultFontStruct() != fFontStruct) || (GetDefaultGC()() != fNormGC)) {
3270 TGFont *ufont = gClient->GetResourcePool()->GetFontPool()->FindFont(fFontStruct);
3271 if (ufont) {
3272 ufont->SavePrimitive(out, option);
3273 parFont.Form("ufont->GetFontStruct()");
3274 }
3275
3276 TGGC *userGC = gClient->GetResourcePool()->GetGCPool()->FindGC(fNormGC);
3277 if (userGC) {
3278 userGC->SavePrimitive(out, option);
3279 parGC.Form("uGC->GetGC()");
3280 }
3281 }
3282
3284
3285 out << std::endl << " // " << quote << GetTitle() << quote << " group frame" << std::endl;
3286 out << " TGGroupFrame *";
3287 out << GetName() <<" = new TGGroupFrame("<<fParent->GetName()
3288 << "," << quote << GetTitle() << quote;
3289
3292 if (fNormGC == GetDefaultGC()()) {
3293 if (GetOptions() & kVerticalFrame) {
3294 out <<");" << std::endl;
3295 } else {
3296 out << "," << GetOptionString() <<");" << std::endl;
3297 }
3298 } else {
3299 out << "," << GetOptionString() << "," << parGC.Data() <<");" << std::endl;
3300 }
3301 } else {
3302 out << "," << GetOptionString() << "," << parGC.Data() << "," << parFont.Data() << ");" << std::endl;
3303 }
3304 } else {
3305 out << "," << GetOptionString() << "," << parGC.Data() << "," << parFont.Data() << ",ucolor);" << std::endl;
3306 }
3307 if (option && strstr(option, "keep_names"))
3308 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3309
3310 if (GetTitlePos() != -1)
3311 out << " " << GetName() <<"->SetTitlePos(";
3312 if (GetTitlePos() == 0)
3313 out << "TGGroupFrame::kCenter);" << std::endl;
3314 if (GetTitlePos() == 1)
3315 out << "TGGroupFrame::kRight);" << std::endl;
3316
3317 SavePrimitiveSubframes(out, option);
3318
3319 // setting layout manager
3320 out << " " << GetName() <<"->SetLayoutManager(";
3321 // coverity[returned_null]
3322 // coverity[dereference]
3323 GetLayoutManager()->SavePrimitive(out, option);
3324 out << ");"<< std::endl;
3325
3326 out << " " << GetName() <<"->Resize(" << GetWidth() << ","
3327 << GetHeight() << ");" << std::endl;
3328}
3329
3330
3331////////////////////////////////////////////////////////////////////////////////
3332/// Save the GUI transient frame widget in a C++ macro file.
3333
3334void TGTransientFrame::SaveSource(const char *filename, Option_t *option)
3335{
3336 // iterate over all active classes to exclude the base ones
3337
3338 TString opt = option;
3339 TBits *bc = new TBits();
3340 TClass *c1, *c2, *c3;
3341 UInt_t k = 0; // will mark k-bit of TBits if the class is a base class
3342
3343 TIter nextc1(gROOT->GetListOfClasses());
3344 while((c1 = (TClass *)nextc1())) {
3345
3346 // resets bit TClass::kClassSaved for all classes
3347 c1->ResetBit(TClass::kClassSaved);
3348
3349 TIter nextc2(gROOT->GetListOfClasses());
3350 while ((c2 = (TClass *)nextc2())) {
3351 if (c1==c2) continue;
3352 else {
3353 c3 = c2->GetBaseClass(c1);
3354 if (c3 != 0) {
3355 bc->SetBitNumber(k, kTRUE);
3356 break;
3357 }
3358 }
3359 }
3360 k++;
3361 }
3362
3363 TList *ilist = new TList(); // will contain include file names without '.h'
3364 ilist->SetName("ListOfIncludes");
3365 gROOT->GetListOfSpecials()->Add(ilist);
3366 k=0;
3367
3368 // completes list of include file names
3369 TIter nextdo(gROOT->GetListOfClasses());
3370 while ((c2 = (TClass *)nextdo())) {
3371 // to have only used GUI header files
3372 if (bc->TestBitNumber(k) == 0 && c2->InheritsFrom(TGObject::Class()) == 1) {
3373 // for any used ROOT header files activate the line below, comment the line above
3374 //if (bc->TestBitNumber(k) == 0) {
3375 const char *iname;
3376 iname = c2->GetDeclFileName();
3377 if (iname[0] && strstr(iname,".h")) {
3378 const char *lastsl = strrchr(iname,'/');
3379 if (lastsl) iname = lastsl + 1;
3380 char *tname = new char[strlen(iname)+1];
3381 Int_t i=0;
3382 while (*iname != '.') {
3383 tname[i] = *iname;
3384 i++; iname++;
3385 }
3386 tname[i] = 0; //tname = include file name without '.h'
3387
3388 TObjString *iel = (TObjString *)ilist->FindObject(tname);
3389 if (!iel) {
3390 ilist->Add(new TObjString(tname));
3391 }
3392 delete [] tname;
3393 }
3394 k++; continue;
3395 }
3396 k++;
3397 }
3398
3399 char quote = '"';
3400 std::ofstream out;
3401
3402 TString ff = filename && strlen(filename) ? filename : "Rootdlog.C";
3403
3404 // Computes the main method name.
3405 const char *fname = gSystem->BaseName(ff.Data());
3406 Int_t lenfname = strlen(fname);
3407 char *sname = new char[lenfname+1];
3408
3409 Int_t i = 0;
3410 while ((*fname != '.') && (i < lenfname)) {
3411 sname[i] = *fname;
3412 i++; fname++;
3413 }
3414 if (i == lenfname)
3415 ff += ".C";
3416 sname[i] = 0;
3417
3418 out.open(ff.Data(), std::ios::out);
3419 if (!out.good()) {
3420 Error("SaveSource", "cannot open file: %s", ff.Data());
3421 delete [] sname;
3422 return;
3423 }
3424
3425 // writes include files in C++ macro
3426 TObjString *inc;
3427 ilist = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfIncludes");
3428
3429 if (!ilist) {
3430 delete [] sname;
3431 return;
3432 }
3433
3434 // write macro header, date/time stamp as string, and the used Root version
3435 TDatime t;
3436 out <<"// Dialog macro generated from application: "<< gApplication->Argv(0) << std::endl;
3437 out <<"// By ROOT version "<< gROOT->GetVersion() <<" on "<<t.AsSQLString()<< std::endl;
3438 out << std::endl;
3439
3440 out << "#if !defined( __CINT__) || defined (__MAKECINT__)" << std::endl << std::endl;
3441
3442 TIter nexti(ilist);
3443 while((inc = (TObjString *)nexti())) {
3444 out <<"#ifndef ROOT_"<< inc->GetString() << std::endl;
3445 out <<"#include "<< quote << inc->GetString() <<".h"<< quote << std::endl;
3446 out <<"#endif" << std::endl;
3447 if (strstr(inc->GetString(),"TRootEmbeddedCanvas")) {
3448 out <<"#ifndef ROOT_TCanvas"<< std::endl;
3449 out <<"#include "<< quote <<"TCanvas.h"<< quote << std::endl;
3450 out <<"#endif" << std::endl;
3451 }
3452 }
3453 out << std::endl << "#include " << quote << "Riostream.h" << quote << std::endl;
3454 out << std::endl << "#endif" << std::endl;
3455 // deletes created ListOfIncludes
3456 gROOT->GetListOfSpecials()->Remove(ilist);
3457 ilist->Delete();
3458 delete ilist;
3459 delete bc;
3460
3461 // writes the macro entry point equal to the fname
3462 out << std::endl;
3463 out << "void " << sname << "()" << std::endl;
3464 delete [] sname;
3465
3466 // Save GUI widgets as a C++ macro in a file
3467 out <<"{"<< std::endl;
3468
3470
3471 // saving slots
3472 TList *lSlots = new TList;
3473 lSlots->SetName("ListOfSlots");
3474 gROOT->GetListOfSpecials()->Add(lSlots);
3475
3477
3478 if (strlen(fClassName) || strlen(fResourceName)) {
3479 out<<" "<<GetName()<< "->SetClassHints("<<quote<<fClassName<<quote
3480 <<"," <<quote<<fResourceName<<quote
3481 <<");"<<std::endl;
3482 }
3483
3485 if (fMWMValue || fMWMFuncs || fMWMInput) {
3486 out << " " << GetName() << "->SetMWMHints(";
3487 out << GetMWMvalueString() << "," << std::endl;
3488 out << " ";
3489 out << GetMWMfuncString() << "," << std::endl;
3490 out << " ";
3491 out << GetMWMinpString() << ");"<< std::endl;
3492 }
3493
3495 if ((fWMX != -1) || (fWMY != -1)) {
3496 out <<" "<<GetName()<<"->SetWMPosition("<<fWMX<<","<<fWMY<<");"<<std::endl;
3497 }
3498
3500 if (fWMWidth != UInt_t(-1) || fWMHeight != UInt_t(-1)) {
3501 out <<" "<<GetName()<<"->SetWMSize("<<fWMWidth<<","<<fWMHeight<<");"<<std::endl;
3502 }
3503
3505 if (fWMMinWidth != UInt_t(-1) || fWMMinHeight != UInt_t(-1) ||
3506 fWMMaxWidth != UInt_t(-1) || fWMMaxHeight != UInt_t(-1) ||
3507 fWMWidthInc != UInt_t(-1) || fWMHeightInc != UInt_t(-1)) {
3508
3509 out <<" "<<GetName()<<"->SetWMSizeHints("<<fWMMinWidth<<","<<fWMMinHeight
3510 <<","<<fWMMaxWidth<<","<<fWMMaxHeight <<","<<fWMWidthInc<<","<<fWMHeightInc
3511 <<");"<<std::endl;
3512 }
3513
3515 if ((fWMX != -1) || (fWMY != -1)) {
3516 out <<" "<<GetName()<<"->Move("<<fWMX<<","<<fWMY<<");"<<std::endl;
3517 }
3518
3519 out << " " <<GetName()<< "->MapSubwindows();" << std::endl;
3520
3522 TGFrame *fhidden;
3523 while ((fhidden = (TGFrame*)nexth())) {
3524 out << " " <<fhidden->GetName()<< "->UnmapWindow();" << std::endl;
3525 }
3526 out << std::endl;
3528
3529 Bool_t usexy = kFALSE;
3530 // coverity[returned_null]
3531 // coverity[dereference]
3533 if (lm->InheritsFrom("TGXYLayout"))
3534 usexy = kTRUE;
3535
3536 if (!usexy)
3537 out << " " <<GetName()<< "->Resize("<< GetName()<< "->GetDefaultSize());" << std::endl;
3538 else
3539 out << " " <<GetName()<< "->Resize("<< GetWidth()<<","<<GetHeight()<<");"<<std::endl;
3540
3541 out << " " <<GetName()<< "->MapWindow();" <<std::endl;
3542 if (!usexy) out << " " <<GetName()<< "->Resize();" << std::endl;
3543 out << "} " << std::endl;
3544
3545 // writing slots
3546 TList *sl = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfSlots");
3547 if (sl) {
3548 TIter nextsl(sl);
3549 TObjString *slobj;
3550 Int_t pnumber = 1;
3551
3552 while ((slobj = (TObjString*) nextsl())) {
3553 TString s = slobj->GetString();
3554 TString p = "";
3555 Int_t lb, rb, eq;
3556 lb = s.First('(');
3557 rb = s.First(')');
3558 eq = s.First('=');
3559 out << std::endl;
3560
3561 if (rb - lb > 1 && eq == -1) {
3562 p = TString::Format(" par%d", pnumber);
3563 s.Insert(rb, p);
3564 pnumber++;
3565 out << "void " << s << std::endl;
3566 out << "{" << std::endl;
3567 s = slobj->GetString();
3568 s[rb] = ' ';
3569 out << " std::cout << " << quote << "Slot " << s << quote
3570 << " <<" << p << " << " << quote << ")" << quote
3571 << " << std::endl; " << std::endl;
3572 } else {
3573 if (eq != -1) {
3574 s.Remove(eq, rb-eq);
3575 out << "void " << s << std::endl;
3576 out << "{" << std::endl;
3577 out << " std::cout << " << quote << "Slot " << s
3578 << quote << " << std::endl; " << std::endl;
3579 } else {
3580 out << "void " << slobj->GetString() << std::endl;
3581 out << "{" << std::endl;
3582 out << " std::cout << " << quote << "Slot " << slobj->GetString()
3583 << quote << " << std::endl; " << std::endl;
3584 }
3585 }
3586 out << "}" << std::endl;
3587 }
3588 gROOT->GetListOfSpecials()->Remove(sl);
3589 sl->Delete();
3590 delete sl;
3591 }
3592
3593 out.close();
3594
3595 if (!opt.Contains("quiet"))
3596 printf(" C++ macro file %s has been generated\n", gSystem->BaseName(ff.Data()));
3597
3598 // reset bit TClass::kClassSaved for all classes
3599 nextc1.Reset();
3600 while((c1=(TClass*)nextc1())) {
3601 c1->ResetBit(TClass::kClassSaved);
3602 }
3603}
3604
3605////////////////////////////////////////////////////////////////////////////////
3606/// Save a transient frame widget as a C++ statement(s) on output stream out.
3607
3608void TGTransientFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3609{
3610 char quote = '"';
3611
3612 out << std::endl << " // transient frame" << std::endl;
3613 out << " TGTransientFrame *";
3614 out << GetName()<<" = new TGTransientFrame(gClient->GetRoot(),0"
3615 << "," << GetWidth() << "," << GetHeight() << "," << GetOptionString() <<");" << std::endl;
3616
3617 if (option && strstr(option, "keep_names"))
3618 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3619
3620 // setting layout manager if it differs from transient frame type
3621 // coverity[returned_null]
3622 // coverity[dereference]
3624 if ((GetOptions() & kHorizontalFrame) &&
3625 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
3626 ;
3627 } else if ((GetOptions() & kVerticalFrame) &&
3628 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
3629 ;
3630 } else {
3631 out << " " << GetName() <<"->SetLayoutManager(";
3632 lm->SavePrimitive(out, option);
3633 out << ");"<< std::endl;
3634 }
3635
3636 SavePrimitiveSubframes(out, option);
3637
3638 if (strlen(fWindowName)) {
3639 out << " " << GetName() << "->SetWindowName(" << quote << GetWindowName()
3640 << quote << ");" << std::endl;
3641 }
3642 if (strlen(fIconName)) {
3643 out <<" "<<GetName()<< "->SetIconName("<<quote<<GetIconName()<<quote<<");"<<std::endl;
3644 }
3645 if (strlen(fIconPixmap)) {
3646 out << " " << GetName() << "->SetIconPixmap(" << quote << GetIconPixmap()
3647 << quote << ");" << std::endl;
3648 }
3649}
@ kSelectionClear
Definition GuiTypes.h:63
@ kColormapNotify
Definition GuiTypes.h:64
@ kConfigureNotify
Definition GuiTypes.h:62
@ kGKeyPress
Definition GuiTypes.h:60
@ kExpose
Definition GuiTypes.h:62
@ kButtonRelease
Definition GuiTypes.h:60
@ kSelectionNotify
Definition GuiTypes.h:63
@ kButtonPress
Definition GuiTypes.h:60
@ kButtonDoubleClick
Definition GuiTypes.h:64
@ kFocusOut
Definition GuiTypes.h:61
@ kMotionNotify
Definition GuiTypes.h:61
@ kFocusIn
Definition GuiTypes.h:61
@ kClientMessage
Definition GuiTypes.h:63
@ kEnterNotify
Definition GuiTypes.h:61
@ kSelectionRequest
Definition GuiTypes.h:63
@ kKeyRelease
Definition GuiTypes.h:60
@ kLeaveNotify
Definition GuiTypes.h:61
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Definition GuiTypes.h:35
const Mask_t kExposureMask
Definition GuiTypes.h:165
const Mask_t kWAEventMask
Definition GuiTypes.h:151
const Mask_t kWABackPixel
Definition GuiTypes.h:140
const Mask_t kAnyModifier
Definition GuiTypes.h:210
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
ULong_t Time_t
Event time.
Definition GuiTypes.h:42
EInitialState
Initial window mapping state.
Definition GuiTypes.h:345
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kFitHeight
Definition GuiTypes.h:388
@ kRaisedFrame
Definition GuiTypes.h:384
@ kTempFrame
Definition GuiTypes.h:393
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
@ kDoubleBorder
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:387
@ kFitWidth
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
@ kOwnBackground
Definition GuiTypes.h:391
@ kTransientFrame
Definition GuiTypes.h:392
@ kMainFrame
Definition GuiTypes.h:380
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kKeyControlMask
Definition GuiTypes.h:197
const Mask_t kKeyMod2Mask
typically mod on numeric keys
Definition GuiTypes.h:199
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
@ kArrowHor
Definition GuiTypes.h:374
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kAnyButton
Definition GuiTypes.h:214
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
ULongptr_t Handle_t
Generic resource handle.
Definition GuiTypes.h:26
@ kKey_S
Definition KeySymbols.h:144
@ kKey_s
Definition KeySymbols.h:176
ROOT::R::TRInterface & r
Definition Object.C:4
int main()
Definition Prototype.cxx:12
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Definition RtypesCore.h:45
const UInt_t kMaxUInt
Definition RtypesCore.h:111
long Longptr_t
Definition RtypesCore.h:82
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:101
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
R__EXTERN TApplication * gApplication
constexpr Int_t kFatal
Definition TError.h:49
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:187
R__EXTERN Int_t gErrorIgnoreLevel
Definition TError.h:127
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:231
#define gClient
Definition TGClient.h:157
R__EXTERN TGDNDManager * gDNDManager
@ kFDSave
TList * gListOfHiddenFrames
Definition TGFrame.cxx:145
static const char * gSaveMacroTypes[]
Definition TGFrame.cxx:134
@ kMWMDecorResizeH
Definition TGFrame.h:65
@ kMWMFuncAll
Definition TGFrame.h:49
@ kMWMFuncMove
Definition TGFrame.h:51
@ kMWMDecorBorder
Definition TGFrame.h:64
@ kMWMFuncResize
Definition TGFrame.h:50
@ kMWMDecorMaximize
Definition TGFrame.h:69
@ kMWMDecorTitle
Definition TGFrame.h:66
@ kMWMDecorMinimize
Definition TGFrame.h:68
@ kMWMDecorMenu
Definition TGFrame.h:67
@ kMWMDecorAll
Definition TGFrame.h:63
@ kMWMFuncMaximize
Definition TGFrame.h:53
@ kMWMInputModeless
Definition TGFrame.h:57
@ kMWMFuncClose
Definition TGFrame.h:54
@ kMWMFuncMinimize
Definition TGFrame.h:52
@ kNoCleanup
Definition TGFrame.h:40
@ kDeepCleanup
Definition TGFrame.h:42
@ kIsArranged
Definition TGFrame.h:35
@ kIsVisible
Definition TGFrame.h:33
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsExpandX
Definition TGLayout.h:30
@ kMBRetry
Definition TGMsgBox.h:35
@ kMBCancel
Definition TGMsgBox.h:37
@ kMBIconExclamation
Definition TGMsgBox.h:24
XFontStruct * id
Definition TGX11.cxx:109
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
R__EXTERN TGuiBuilder * gGuiBuilder
Definition TGuiBuilder.h:66
#define gROOT
Definition TROOT.h:404
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
R__EXTERN TVirtualDragManager * gDragManager
#define gVirtualX
Definition TVirtualX.h:338
R__EXTERN Atom_t gROOT_MESSAGE
Definition TVirtualX.h:40
R__EXTERN Atom_t gWM_DELETE_WINDOW
Definition TVirtualX.h:38
char ** Argv() const
Container of bits.
Definition TBits.h:26
Bool_t TestBitNumber(UInt_t bitnumber) const
Definition TBits.h:222
void SetBitNumber(UInt_t bitnumber, Bool_t value=kTRUE)
Definition TBits.h:206
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
@ kClassSaved
Definition TClass.h:94
virtual const char * GetName() const
Return name of this collection.
void SetName(const char *name)
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
Definition TColor.cxx:2107
static void Pixel2RGB(ULong_t pixel, Int_t &r, Int_t &g, Int_t &b)
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::Ge...
Definition TColor.cxx:2145
static const char * PixelAsHexString(ULong_t pixel)
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::Ge...
Definition TColor.cxx:2162
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
Definition TDatime.cxx:152
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition TGButton.cxx:330
Window client.
Definition TGClient.h:37
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:234
Bool_t IsEditable() const
Definition TGClient.h:89
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:348
const TGResourcePool * GetResourcePool() const
Definition TGClient.h:124
UInt_t GetDisplayHeight() const
Get display height.
Definition TGClient.cxx:275
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:289
TGGCPool * GetGCPool() const
Definition TGClient.h:131
void SetRoot(TGWindow *root=nullptr)
Sets the current root (i.e.
Definition TGClient.cxx:244
Bool_t IsEditDisabled() const
Returns kTRUE if edit/guibuilding is forbidden.
Definition TGClient.cxx:935
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
UInt_t GetDisplayWidth() const
Get display width.
Definition TGClient.cxx:262
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual TGFrameElement * FindFrameElement(TGFrame *f) const
Find frame-element holding frame f.
Definition TGFrame.cxx:1094
virtual Bool_t HandleDragEnter(TGFrame *)
Handle drag enter event.
Definition TGFrame.cxx:1365
TGLayoutManager * fLayoutManager
layout manager
Definition TGFrame.h:291
virtual void SetLayoutBroken(Bool_t on=kTRUE)
Set broken layout. No Layout method is called.
Definition TGFrame.cxx:1012
virtual void ChangeSubframesBackground(Pixel_t back)
Change background color for this frame and all subframes.
Definition TGFrame.cxx:1288
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:1000
virtual Bool_t HandleDragMotion(TGFrame *)
Handle drag motion event.
Definition TGFrame.cxx:1413
virtual Bool_t HandleDragDrop(TGFrame *frame, Int_t x, Int_t y, TGLayoutHints *lo)
Handle drop event.
Definition TGFrame.cxx:1421
virtual Bool_t HandleButton(Event_t *)
Definition TGFrame.h:324
Int_t GetState(TGFrame *f) const
Get state of sub frame.
Definition TGFrame.cxx:1218
virtual TGFrame * GetFrameFromPoint(Int_t x, Int_t y)
Get frame located at specified point.
Definition TGFrame.cxx:1308
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual TGLayoutManager * GetLayoutManager() const
Definition TGFrame.h:338
virtual Bool_t HandleSelection(Event_t *)
Definition TGFrame.h:330
virtual void SetEditable(Bool_t on=kTRUE)
Switch ON/OFF edit mode.
Definition TGFrame.cxx:948
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:967
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual Bool_t IsLayoutBroken() const
Definition TGFrame.h:357
Int_t fMustCleanup
cleanup mode (see EFrameCleanup)
Definition TGFrame.h:294
virtual void SavePrimitiveSubframes(std::ostream &out, Option_t *option="")
Auxiliary protected method used to save subframes.
Definition TGFrame.cxx:2665
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1043
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
TGCompositeFrame(const TGCompositeFrame &)=delete
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual Bool_t TranslateCoordinates(TGFrame *child, Int_t x, Int_t y, Int_t &fx, Int_t &fy)
Translate coordinates to child frame.
Definition TGFrame.cxx:1332
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
Bool_t fLayoutBroken
no layout manager is used
Definition TGFrame.h:293
Bool_t fMapSubwindows
kTRUE - map subwindows
Definition TGFrame.h:295
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1204
TList * fList
container of frame elements
Definition TGFrame.h:292
virtual ~TGCompositeFrame()
Delete a composite frame.
Definition TGFrame.cxx:904
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a composite frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:2767
Bool_t IsArranged(TGFrame *f) const
Get state of sub frame.
Definition TGFrame.cxx:1244
virtual Bool_t HandleMotion(Event_t *)
Definition TGFrame.h:327
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1149
virtual Bool_t IsEditable() const
Return kTRUE if frame is being edited.
Definition TGFrame.cxx:927
static TGLayoutHints * fgDefaultHints
Definition TGFrame.h:297
virtual void Print(Option_t *option="") const
Print all frames in this composite frame.
Definition TGFrame.cxx:1266
virtual void RemoveAll()
Remove all frames from composite frame.
Definition TGFrame.cxx:1131
virtual Bool_t HandleDragLeave(TGFrame *)
Handle drag leave event.
Definition TGFrame.cxx:1395
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1190
Bool_t IsVisible(TGFrame *f) const
Get state of sub frame.
Definition TGFrame.cxx:1231
Bool_t HandleSelectionRequest(Event_t *event)
Handle selection request event.
Bool_t HandleClientMessage(Event_t *event)
Handle DND related client messages.
Bool_t HandleSelection(Event_t *event)
Handle selection event.
Bool_t IsDragging() const
void SetMainFrame(TGFrame *main)
static Atom_t GetDNDSelection()
Bool_t Drag(Int_t x_root, Int_t y_root, Atom_t action, Time_t timestamp)
Process drag event.
Bool_t Drop()
Drop.
TGFrame * GetMainFrame() const
static Atom_t GetDNDActionCopy()
UInt_t fHeight
Definition TGDimension.h:21
UInt_t fWidth
Definition TGDimension.h:20
This class creates a file selection dialog.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fOverwrite
if true overwrite the file with existing name on save
void SetIniDir(const char *inidir)
Set directory name.
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
FontStruct_t GetFontStruct() const
Definition TGFont.h:184
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save the used font as a C++ statement(s) on output stream out.
Definition TGFont.cxx:1884
TGLayoutHints * fLayout
Definition TGLayout.h:114
TGFrame * fFrame
Definition TGLayout.h:112
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:321
virtual Bool_t HandleSelectionClear(Event_t *)
Definition TGFrame.h:170
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.cxx:584
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition TGFrame.cxx:696
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
static const TGGC * fgWhiteGC
Definition TGFrame.h:106
virtual Int_t GetDragType() const
Returns drag source type.
Definition TGFrame.cxx:824
virtual void StartGuiBuilding(Bool_t on=kTRUE)
Go into GUI building mode.
Definition TGFrame.cxx:841
virtual void DoRedraw()
Redraw the frame.
Definition TGFrame.cxx:430
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:735
static Pixel_t GetBlackPixel()
Get black pixel value.
Definition TGFrame.cxx:722
UInt_t fOptions
frame options
Definition TGFrame.h:94
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition TGFrame.cxx:443
Int_t fX
frame x position
Definition TGFrame.h:85
virtual Bool_t HandleDoubleClick(Event_t *)
Definition TGFrame.h:162
UInt_t fMinHeight
minimal frame height
Definition TGFrame.h:90
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
Definition TGFrame.cxx:348
virtual void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0)
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGFrame.h:202
static Bool_t fgInit
Definition TGFrame.h:100
virtual Bool_t HandleKey(Event_t *)
Definition TGFrame.h:165
TGFrame(const TGFrame &)=delete
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
UInt_t fHeight
frame height
Definition TGFrame.h:88
static Int_t fgDby
Definition TGFrame.h:112
virtual Bool_t HandleColormapChange(Event_t *)
Definition TGFrame.h:171
virtual void SetDropType(Int_t type)
SetDropType.
Definition TGFrame.cxx:816
virtual void SetDragType(Int_t type)
SetDragType.
Definition TGFrame.cxx:809
virtual void DrawBorder()
Draw frame border.
Definition TGFrame.cxx:421
virtual void Print(Option_t *option="") const
Print window id.
Definition TGFrame.cxx:793
static const TGGC * fgBckgndGC
Definition TGFrame.h:109
virtual Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t)
Definition TGFrame.h:183
virtual void Draw3dRectangle(UInt_t type, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw 3D rectangle on the frame border.
Definition TGFrame.cxx:357
Int_t fBorderWidth
frame border width
Definition TGFrame.h:93
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3231
static const TGGC * fgShadowGC
Definition TGFrame.h:108
static Pixel_t fgDefaultSelectedBackground
Definition TGFrame.h:102
UInt_t fMinWidth
minimal frame width
Definition TGFrame.h:89
virtual ~TGFrame()
Destructor.
Definition TGFrame.cxx:266
@ kDeleteWindowCalled
Definition TGFrame.h:83
virtual Pixel_t GetForeground() const
Return frame foreground color.
Definition TGFrame.cxx:303
TGFrameElement * GetFrameElement() const
Definition TGFrame.h:235
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:755
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
static UInt_t fgLastButton
Definition TGFrame.h:111
TGFrameElement * fFE
pointer to frame element
Definition TGFrame.h:98
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
virtual Int_t GetDropType() const
Returns drop target type.
Definition TGFrame.cxx:833
Int_t fDNDState
EDNDFlags.
Definition TGFrame.h:97
static Time_t GetLastClick()
Get time of last mouse click.
Definition TGFrame.cxx:785
static const TGGC * fgBlackGC
Definition TGFrame.h:105
Int_t GetX() const
Definition TGFrame.h:231
static Int_t fgDbx
Definition TGFrame.h:112
static UInt_t fgUserColor
Definition TGFrame.h:114
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
virtual TGFrame * GetFrameFromPoint(Int_t x, Int_t y)
Definition TGFrame.h:240
virtual UInt_t GetOptions() const
Definition TGFrame.h:197
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2504
static Time_t fgLastClick
Definition TGFrame.h:110
Int_t fY
frame y position
Definition TGFrame.h:86
virtual Bool_t HandleFocusChange(Event_t *)
Definition TGFrame.h:166
virtual Bool_t IsComposite() const
Definition TGFrame.h:212
virtual void ChangeBackground(Pixel_t back)
Change frame background color.
Definition TGFrame.cxx:293
UInt_t fMaxWidth
maximal frame width
Definition TGFrame.h:91
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:645
virtual void ProcessedConfigure(Event_t *event)
Definition TGFrame.h:177
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:765
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition TGFrame.cxx:593
virtual Bool_t HandleSelectionRequest(Event_t *)
Definition TGFrame.h:169
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:605
virtual Bool_t HandleSelection(Event_t *)
Definition TGFrame.h:168
UInt_t fWidth
frame width
Definition TGFrame.h:87
virtual Bool_t HandleButton(Event_t *)
Definition TGFrame.h:161
virtual Bool_t HandleMotion(Event_t *)
Definition TGFrame.h:164
void SetFrameElement(TGFrameElement *fe)
Definition TGFrame.h:236
UInt_t GetHeight() const
Definition TGFrame.h:225
virtual void SetCleanup(Int_t=kLocalCleanup)
Definition TGFrame.h:217
virtual Bool_t IsEditable() const
Definition TGFrame.h:213
virtual Bool_t HandleClientMessage(Event_t *event)
Handle a client message.
Definition TGFrame.cxx:669
Int_t GetY() const
Definition TGFrame.h:232
virtual void Layout()
Definition TGFrame.h:199
virtual Pixel_t GetBackground() const
Definition TGFrame.h:192
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:629
UInt_t fEventMask
currently active event mask
Definition TGFrame.h:96
UInt_t fMaxHeight
maximal frame height
Definition TGFrame.h:92
virtual Bool_t HandleCrossing(Event_t *)
Definition TGFrame.h:163
virtual void ProcessedEvent(Event_t *event)
Definition TGFrame.h:179
static Window_t fgDbw
Definition TGFrame.h:113
virtual Bool_t HandleEvent(Event_t *event)
Handle all frame events.
Definition TGFrame.cxx:457
Bool_t Contains(Int_t x, Int_t y) const
Definition TGFrame.h:238
virtual void MapWindow()
map window
Definition TGFrame.h:204
static const TGGC & GetWhiteGC()
Get white graphics context.
Definition TGFrame.cxx:745
static Pixel_t fgWhitePixel
Definition TGFrame.h:103
UInt_t GetWidth() const
Definition TGFrame.h:224
virtual void MapSubwindows()
map sub windows
Definition TGFrame.h:200
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2477
Pixel_t fBackground
frame background color
Definition TGFrame.h:95
static Pixel_t fgBlackPixel
Definition TGFrame.h:104
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:775
static const TGGC * fgHilightGC
Definition TGFrame.h:107
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:206
static Pixel_t fgDefaultFrameBackground
Definition TGFrame.h:101
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get the best matching graphics context depending on values.
Definition TGGC.cxx:987
void FreeGC(const TGGC *gc)
Delete graphics context if it is not used anymore.
Definition TGGC.cxx:918
TGGC * FindGC(const TGGC *gc)
Find graphics context. Returns 0 in case gc is not found.
Definition TGGC.cxx:951
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
GContext_t GetGC() const
Definition TGGC.h:41
void SavePrimitive(std::ostream &out, Option_t *option="")
Save graphics context info as a C++ statement(s) on output stream out.
Definition TGGC.cxx:627
void SetFont(FontH_t v)
Set font.
Definition TGGC.cxx:411
void SetForeground(Pixel_t v)
Set foreground color.
Definition TGGC.cxx:278
const GCValues_t * GetAttributes() const
Definition TGGC.h:69
A composite frame with a border and a title.
Definition TGFrame.h:523
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a group frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3255
TGString * fText
title text
Definition TGFrame.h:526
Bool_t fHasOwnFont
kTRUE - font defined locally, kFALSE - globally
Definition TGFrame.h:530
static const TGGC & GetDefaultGC()
Return default graphics context in use.
Definition TGFrame.cxx:2345
virtual ~TGGroupFrame()
Delete a group frame.
Definition TGFrame.cxx:2116
static const TGGC * fgDefaultGC
Definition TGFrame.h:535
TGGroupFrame(const TGGroupFrame &)=delete
virtual void DoRedraw()
Redraw the group frame.
Definition TGFrame.cxx:2143
Int_t fTitlePos
OPTION={GetMethod="GetTitlePos";SetMethod="SetTitlePos";Items=(-1="Left",0="Center",...
Definition TGFrame.h:529
static const TGFont * fgDefaultFont
Definition TGFrame.h:534
virtual const char * GetTitle() const
Returns title of object.
Definition TGFrame.h:572
virtual TGDimension GetDefaultSize() const
Returns default size.
Definition TGFrame.cxx:2129
virtual void DrawBorder()
Draw border of around the group frame.
Definition TGFrame.cxx:2224
FontStruct_t fFontStruct
title fontstruct
Definition TGFrame.h:527
virtual void SetTextFont(const char *fontName, Bool_t local=kTRUE)
Changes text font specified by name.
Definition TGFrame.cxx:2200
GContext_t fNormGC
title graphics context
Definition TGFrame.h:528
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition TGFrame.cxx:2335
Bool_t HasOwnFont() const
Returns kTRUE if text attributes are unique, returns kFALSE if text attributes are shared (global).
Definition TGFrame.cxx:2213
virtual void SetTextColor(Pixel_t color, Bool_t local=kTRUE)
Changes text color.
Definition TGFrame.cxx:2155
Int_t GetTitlePos() const
Definition TGFrame.h:564
virtual void SetTitle(TGString *title)
Set or change title of the group frame.
Definition TGFrame.cxx:2306
const TGFrame * GetFrame() const
Definition TGSplitter.h:114
Bool_t GetAbove() const
Definition TGSplitter.h:115
Horizontal Frame used to contain header buttons and splitters in a list view.
Definition TGFrame.h:581
Int_t fLastButton
Indicates the last button clicked if any.
Definition TGFrame.h:593
void SetColumnsInfo(Int_t nColumns, TGTextButton **colHeader, TGVFileSplitter **splitHeader)
Set columns information in the header frame.
Definition TGFrame.cxx:2377
TGVFileSplitter ** fSplitHeader
column splitters
Definition TGFrame.h:589
Bool_t fOverSplitter
Indicates if the cursor is over a splitter.
Definition TGFrame.h:591
TGHeaderFrame(const TGHeaderFrame &)=delete
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in header frame.
Definition TGFrame.cxx:2388
TGTextButton ** fColHeader
column headers for in detailed mode
Definition TGFrame.h:588
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events in header frame.
Definition TGFrame.cxx:2447
Cursor_t fSplitCursor
split cursor;
Definition TGFrame.h:590
Int_t fNColumns
number of columns
Definition TGFrame.h:587
Int_t fOverButton
Indicates over which button the mouse is.
Definition TGFrame.h:592
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click mouse event in header frame.
Definition TGFrame.cxx:2420
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:386
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a horizontal frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3145
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save layout hints as a C++ statement(s) on output stream out.
Definition TGLayout.cxx:975
TGFrameElement * fFE
Definition TGLayout.h:56
Frame layout manager.
Definition TGLayout.h:135
virtual void Layout()=0
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:398
void GetWMSizeHints(UInt_t &wmin, UInt_t &hmin, UInt_t &wmax, UInt_t &hmax, UInt_t &winc, UInt_t &hinc) const
Definition TGFrame.h:486
TGMainFrame(const TGMainFrame &)=delete
UInt_t fWMWidthInc
WM width increments.
Definition TGFrame.h:432
virtual Bool_t HandleSelectionRequest(Event_t *event)
Handle selection request event.
Definition TGFrame.cxx:1715
UInt_t fWMHeightInc
WM height increments.
Definition TGFrame.h:433
virtual Bool_t SaveFrameAsCodeOrImage()
Opens dialog window allowing user to save the frame contents as a ROOT macro or as an image.
Definition TGFrame.cxx:1527
virtual void SaveSource(const char *filename="Rootappl.C", Option_t *option="")
Save the GUI main frame widget in a C++ macro file.
Definition TGFrame.cxx:2815
virtual Bool_t HandleClientMessage(Event_t *event)
Handle client messages sent to this frame.
Definition TGFrame.cxx:1727
TString GetMWMfuncString() const
used in SaveSource()
Definition TGFrame.cxx:2610
const char * GetIconName() const
Returns mime type name of object.
Definition TGFrame.h:478
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition TGFrame.cxx:1780
UInt_t fWMWidth
WM width.
Definition TGFrame.h:426
UInt_t fWMMinHeight
WM min height.
Definition TGFrame.h:429
void GetWMPosition(Int_t &x, Int_t &y) const
Definition TGFrame.h:484
Int_t fWMY
WM y position.
Definition TGFrame.h:425
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events.
Definition TGFrame.cxx:1679
UInt_t fWMMinWidth
WM min width.
Definition TGFrame.h:428
TString fResourceName
WM resource name.
Definition TGFrame.h:420
UInt_t fMWMValue
MWM decoration hints.
Definition TGFrame.h:421
void GetWMSize(UInt_t &w, UInt_t &h) const
Definition TGFrame.h:485
Atom_t * fDNDTypeList
handles DND types
Definition TGFrame.h:414
virtual void SendCloseMessage()
Send close message to self.
Definition TGFrame.cxx:1744
void GetMWMHints(UInt_t &value, UInt_t &funcs, UInt_t &input) const
Definition TGFrame.h:482
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1856
Int_t fWMX
WM x position.
Definition TGFrame.h:424
virtual void CloseWindow()
Close and delete main frame.
Definition TGFrame.cxx:1770
TString fIconPixmap
icon pixmap name
Definition TGFrame.h:418
UInt_t fWMMaxWidth
WM max width.
Definition TGFrame.h:430
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a main frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3093
TString fWindowName
window name
Definition TGFrame.h:416
virtual Bool_t HandleSelection(Event_t *event)
Handle primary selection event.
Definition TGFrame.cxx:1703
@ kDontCallClose
Definition TGFrame.h:401
UInt_t fWMHeight
WM height.
Definition TGFrame.h:427
TList * fBindList
list with key bindings
Definition TGFrame.h:415
virtual ~TGMainFrame()
TGMainFrame destructor.
Definition TGFrame.cxx:1507
UInt_t fWMMaxHeight
WM max height.
Definition TGFrame.h:431
void SetWMState(EInitialState state)
Set the initial state of the window. Either kNormalState or kIconicState.
Definition TGFrame.cxx:1922
virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const
Bind key to a window.
Definition TGFrame.cxx:1637
UInt_t fMWMFuncs
MWM functions.
Definition TGFrame.h:422
EInitialState fWMInitState
WM initial state.
Definition TGFrame.h:434
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
TString GetMWMinpString() const
used in SaveSource()
Definition TGFrame.cxx:2647
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
Definition TGFrame.cxx:1606
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1891
TString fClassName
WM class name.
Definition TGFrame.h:419
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition TGFrame.cxx:1879
TString fIconName
icon name
Definition TGFrame.h:417
TString GetMWMvalueString() const
used in SaveSource()
Definition TGFrame.cxx:2570
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition TGFrame.cxx:1866
const char * GetWindowName() const
Definition TGFrame.h:477
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Definition TGFrame.cxx:1904
const char * GetIconPixmap() const
Definition TGFrame.h:479
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events.
Definition TGFrame.cxx:1691
virtual void RemoveBind(const TGWindow *w, Int_t keycode, Int_t modifier) const
Remove key binding.
Definition TGFrame.cxx:1660
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition TGFrame.cxx:1816
UInt_t fMWMInput
MWM input modes.
Definition TGFrame.h:423
TGClient * fClient
Connection to display server.
Definition TGObject.h:27
Handle_t GetId() const
Definition TGObject.h:37
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:26
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
Pixmap_t GetPicture() const
Definition TGPicture.h:54
TGGCPool * GetGCPool() const
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:56
Yield an action as soon as it is clicked.
Definition TGButton.h:142
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:499
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a transient frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3608
TGTransientFrame(const TGTransientFrame &)=delete
virtual void SaveSource(const char *filename="Rootdlog.C", Option_t *option="")
Save the GUI transient frame widget in a C++ macro file.
Definition TGFrame.cxx:3334
const TGWindow * fMain
Definition TGFrame.h:502
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
Definition TGFrame.cxx:1955
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in vertical splitter.
virtual Bool_t HandleDoubleClick(Event_t *)
Handle double click mouse event in splitter.
const TGFrame * GetFrame() const
Definition TGSplitter.h:77
Bool_t GetLeft() const
Definition TGSplitter.h:78
A composite frame that layout their children in vertical way.
Definition TGFrame.h:375
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a vertical frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3188
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual void SetWindowName(const char *name=0)
Set window name.
Definition TGWindow.cxx:129
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:152
virtual void Move(Int_t x, Int_t y)
Move the window.
Definition TGWindow.cxx:271
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
virtual void Print(Option_t *option="") const
Print window id.
Definition TGWindow.cxx:307
static Int_t fgCounter
counter of created windows in SavePrimitive
Definition TGWindow.h:31
virtual UInt_t GetEditDisabled() const
Definition TGWindow.h:105
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition TGWindow.h:106
virtual Bool_t HandleExpose(Event_t *event)
Definition TGWindow.h:94
virtual void SetName(const char *name)
Definition TGWindow.h:114
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kEditDisableLayout
window layout cannot be edited
Definition TGWindow.h:53
@ kEditDisable
disable edit of this window
Definition TGWindow.h:50
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize the window.
Definition TGWindow.cxx:287
virtual Bool_t IsMapSubwindows() const
Definition TGWindow.h:117
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:192
const TGWindow * GetParent() const
Definition TGWindow.h:76
virtual void Resize(UInt_t w, UInt_t h)
Resize the window.
Definition TGWindow.cxx:279
virtual void SetBackgroundColor(Pixel_t color)
set background color
Definition TGWindow.cxx:240
virtual void RaiseWindow()
raise window
Definition TGWindow.cxx:208
virtual void MapSubwindows()
map sub windows
Definition TGWindow.cxx:168
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
An abstract interface to image processing library.
Definition TImage.h:29
EImageFileTypes
Definition TImage.h:36
@ kPng
Definition TImage.h:40
@ kJpeg
Definition TImage.h:41
@ kXpm
Definition TImage.h:37
@ kUnknown
Definition TImage.h:54
@ kTiff
Definition TImage.h:49
@ kGif
Definition TImage.h:48
static TImage * Create()
Create an image.
Definition TImage.cxx:35
virtual Bool_t SetImageBuffer(char **, EImageFileTypes=TImage::kPng)
Definition TImage.h:242
virtual void FromWindow(Drawable_t, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition TImage.h:244
virtual void WriteImage(const char *, EImageFileTypes=TImage::kUnknown)
Definition TImage.h:115
virtual Pixmap_t GetPixmap()
Definition TImage.h:235
void Reset()
A doubly linked list.
Definition TList.h:38
virtual void Add(TObject *obj)
Definition TList.h:81
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition TList.cxx:822
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition TList.cxx:578
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:693
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:470
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition TList.cxx:402
Collectable string class.
Definition TObjString.h:28
const TString & GetString() const
Definition TObjString.h:46
Monitors objects for deletion and reflects the deletion by reverting the internal pointer to zero.
Definition TObjectSpy.h:30
TObject * GetObject() const
Definition TObjectSpy.h:45
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:201
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:200