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