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