Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGFrame.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 03/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11/**************************************************************************
12
13 This source is based on Xclass95, a Win95-looking GUI toolkit.
14 Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15
16 Xclass95 is free software; you can redistribute it and/or
17 modify it under the terms of the GNU Library General Public
18 License as published by the Free Software Foundation; either
19 version 2 of the License, or (at your option) any later version.
20
21**************************************************************************/
22
23
24/** \class TGFrame
25 \ingroup guiwidgets
26
27A subclasses of TGWindow, and is used as base
28class for some simple widgets (buttons, labels, etc.).
29It provides:
30 - position & dimension fields
31 - an 'options' attribute (see constant above)
32 - a generic event handler
33 - a generic layout mechanism
34 - a generic border
35
36
37\class TGCompositeFrame
38\ingroup guiwidgets
39
40The base class for composite widgets
41(menu bars, list boxes, etc.).
42It provides:
43 - a layout manager
44 - a frame container (TList *)
45
46
47\class TGVerticalFrame
48\ingroup guiwidgets
49A composite frame that layout their children in vertical way.
50
51
52\class TGHorizontalFrame
53\ingroup guiwidgets
54A composite frame that layout their children in horizontal way.
55
56
57\class TGMainFrame
58\ingroup guiwidgets
59Defines top level windows that interact with the system Window Manager.
60
61
62\class TGTransientFrame
63\ingroup guiwidgets
64Defines transient windows that typically are used for dialogs windows.
65
66
67\class TGGroupFrame
68\ingroup guiwidgets
69A composite frame with a border and a title.
70It is typically used to group a number of logically related widgets visually together.
71
72\class TGHeaderFrame
73\ingroup guiwidgets
74Horizontal Frame used to contain header buttons and splitters
75in a list view. Used to have resizable column headers.
76
77*/
78
79
80#include "TError.h"
81#include "TGFrame.h"
82#include "TGResourcePool.h"
83#include "TGPicture.h"
84#include "TList.h"
85#include "TApplication.h"
86#include "TTimer.h"
87#include "TClass.h"
88
89#include "TObjString.h"
90#include "TBits.h"
91#include "TColor.h"
92#include "TROOT.h"
93#include "TDatime.h"
94#include "KeySymbols.h"
95#include "TGFileDialog.h"
96#include "TGMsgBox.h"
97#include "TSystem.h"
98#include "TVirtualDragManager.h"
99#include "TGuiBuilder.h"
100#include "TQConnection.h"
101#include "TGButton.h"
102#include "TGSplitter.h"
103#include "TGDNDManager.h"
104#include "TImage.h"
105#include "TObjectSpy.h"
106#include "TVirtualX.h"
107
108#include <iostream>
109#include <fstream>
110
111
117const TGGC *TGFrame::fgBlackGC = nullptr;
118const TGGC *TGFrame::fgWhiteGC = nullptr;
119const TGGC *TGFrame::fgHilightGC = nullptr;
120const TGGC *TGFrame::fgShadowGC = nullptr;
121const TGGC *TGFrame::fgBckgndGC = nullptr;
128
129const TGFont *TGGroupFrame::fgDefaultFont = nullptr;
130const TGGC *TGGroupFrame::fgDefaultGC = nullptr;
131
133
134static const char *gSaveMacroTypes[] = {
135 "ROOT macros", "*.C",
136 "GIF", "*.gif",
137 "PNG", "*.png",
138 "JPEG", "*.jpg",
139 "TIFF", "*.tiff",
140 "XPM", "*.xpm",
141 "All files", "*",
142 0, 0
143};
144
146
155
156
157////////////////////////////////////////////////////////////////////////////////
158/// Create a TGFrame object. Options is an OR of the EFrameTypes.
159
161 UInt_t options, Pixel_t back)
162 : TGWindow(p, 0, 0, w, h, 0, 0, 0, 0, 0, options)
163{
164 if (!fgInit && gClient) {
174 fgInit = kTRUE;
175 }
176
178
179 fDNDState = 0;
180 fBackground = back;
181 fOptions = options;
182 fWidth = w; fHeight = h; fX = fY = fBorderWidth = 0;
183 fMinWidth = 0;
184 fMinHeight = 0;
187 fFE = 0;
188
190 fBorderWidth = (gClient->GetStyle() > 1) ? 1 : (fOptions & kDoubleBorder) ? 2 : 1;
191
193 wattr.fBackgroundPixel = back;
195 if (fOptions & kMainFrame) {
197 gVirtualX->ChangeWindowAttributes(fId, &wattr);
198 //if (fgDefaultBackgroundPicture)
199 // SetBackgroundPixmap(fgDefaultBackgroundPicture->GetPicture());
200 } else {
201 gVirtualX->ChangeWindowAttributes(fId, &wattr);
202 //if (!(fOptions & kOwnBackground))
203 // SetBackgroundPixmap(kParentRelative);
204 }
205 fEventMask = (UInt_t) wattr.fEventMask;
206
207 if ((fOptions & kDoubleBorder) && (gClient->GetStyle() > 1))
209
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Create a frame using an externally created window. For example
215/// to register the root window (called by TGClient), or a window
216/// created via TVirtualX::InitWindow() (id is obtained with
217/// TVirtualX::GetWindowID()).
218
220 : TGWindow(c, id, parent)
221{
222 if (!fgInit && gClient) {
232 fgInit = kTRUE;
233 }
234
235 WindowAttributes_t attributes;
236 // Initialize some values - needed for batch mode!
237 attributes.fX = 0;
238 attributes.fY = 0;
239 attributes.fWidth = 100;
240 attributes.fHeight = 100;
241 attributes.fBorderWidth = 4;
242 attributes.fYourEventMask = 0;
243 gVirtualX->GetWindowAttributes(id, attributes);
244
245 fDNDState = 0;
246 fX = attributes.fX;
247 fY = attributes.fY;
248 fWidth = attributes.fWidth;
249 fHeight = attributes.fHeight;
250 fBorderWidth = attributes.fBorderWidth;
251 fEventMask = (UInt_t) attributes.fYourEventMask;
252 fBackground = 0;
253 fOptions = 0;
254 fMinWidth = 0;
255 fMinHeight = 0;
258 fFE = 0;
259
261}
262
263////////////////////////////////////////////////////////////////////////////////
264/// Destructor.
265
267{
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// Delete window. Use single shot timer to call final delete method.
272/// We use this indirect way since deleting the window in its own
273/// execution "thread" can cause side effects because frame methods
274/// can still be called while the window object has already been deleted.
275
277{
278 if (gDNDManager) {
279 if (gDNDManager->GetMainFrame() == this)
281 }
283 // coverity[returned_null]
284 // coverity[dereference]
285 TTimer::SingleShot(150, IsA()->GetName(), this, "ReallyDelete()");
286 }
288}
289
290////////////////////////////////////////////////////////////////////////////////
291/// Change frame background color.
292
294{
295 fBackground = back;
296 gVirtualX->SetWindowBackground(fId, back);
297 fClient->NeedRedraw(this);
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Return frame foreground color.
302
304{
305 return fgBlackPixel;
306}
307
308////////////////////////////////////////////////////////////////////////////////
309/// Set background color (override from TGWindow base class).
310/// Same effect as ChangeBackground().
311
313{
314 fBackground = back;
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Change frame options. Options is an OR of the EFrameTypes.
320
323 if ((options & (kDoubleBorder | kSunkenFrame | kRaisedFrame)) !=
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{
460 gDragManager->HandleEvent(event)) return kTRUE;
461
462 TObjectSpy deleteCheck(this);
463
464 switch (event->fType) {
465
466 case kExpose:
467 HandleExpose(event);
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:
482 HandleKey(event);
483 break;
484
485 case kFocusIn:
486 case kFocusOut:
487 HandleFocusChange(event);
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)) {
515 HandleButton(event);
516 }
517 } else {
518 HandleButton(event);
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
531 HandleDoubleClick(event);
532 }
533 break;
534
535 case kButtonRelease:
536 HandleButton(event);
537 break;
538
539 case kEnterNotify:
540 case kLeaveNotify:
541 HandleCrossing(event);
542 break;
543
544 case kMotionNotify:
545 while (gVirtualX->CheckEvent(fId, kMotionNotify, *event))
546 ;
547 HandleMotion(event);
548 break;
549
550 case kClientMessage:
551 HandleClientMessage(event);
552 break;
553
554 case kSelectionNotify:
555 HandleSelection(event);
556 break;
557
560 break;
561
562 case kSelectionClear:
564 break;
565
566 case kColormapNotify:
568 break;
569
570 default:
571 //Warning("HandleEvent", "unknown event (%#x) for (%#x)", event->fType, fId);
572 break;
573 }
574
575 if (deleteCheck.GetObject())
576 ProcessedEvent(event); // emit signal
577
578 return kTRUE;
579}
580
581////////////////////////////////////////////////////////////////////////////////
582/// std::cout << fWidth << "x" << fHeight << std::endl;
583
585{
586 return TGDimension(fWidth, fHeight);
587}
588
589
590////////////////////////////////////////////////////////////////////////////////
591/// Move frame.
592
594{
595 if (x != fX || y != fY) {
597 fX = x; fY = y;
598 }
599}
600
601////////////////////////////////////////////////////////////////////////////////
602/// Resize the frame.
603/// If w=0 && h=0 - Resize to default size
604
606{
607 if (w != fWidth || h != fHeight) {
608 TGDimension siz(0,0);
609 siz = GetDefaultSize();
610 fWidth = w ? w : siz.fWidth;
611 fHeight = h ? h : siz.fHeight;
613 Layout();
614 }
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Resize the frame.
619
621{
622 Resize(size.fWidth, size.fHeight);
623}
624
625////////////////////////////////////////////////////////////////////////////////
626/// Move and/or resize the frame.
627/// If w=0 && h=0 - Resize to default size
628
630{
631 // we do it anyway as we don't know if it's only a move or only a resize
632 TGDimension siz(0,0);
633 siz = GetDefaultSize();
634 fWidth = w ? w : siz.fWidth;
635 fHeight = h ? h : siz.fHeight;
636 fX = x; fY = y;
638 Layout();
639}
640
641////////////////////////////////////////////////////////////////////////////////
642/// Send message (i.e. event) to window w. Message is encoded in one long
643/// as message type and up to two long parameters.
644
646{
647 Event_t event;
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
794{
795 TString opt = option;
796 if (opt.Contains("tree")) {
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
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")) {
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),
1471 kKeyControlMask, kTRUE);//grab CTRL+s
1472 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_s),
1473 kKeyControlMask | kKeyMod2Mask, kTRUE);//grab CTRL+s also if NumLock is active
1474 if (p == fClient->GetDefaultRoot()) {
1478 gVirtualX->SetMWMHints(fId, fMWMValue, fMWMFuncs, fMWMInput);
1479 }
1480 // if parent is editing/embeddable add this frame to the parent
1481 if (fClient->IsEditable() && (p == fClient->GetRoot())) {
1482 TGCompositeFrame *frame;
1484 frame = (TGCompositeFrame*)p;
1486
1487 // used during paste operation
1490 }
1491 }
1492 }
1493 //AddInput(kButtonPressMask); // to allow Drag and Drop
1494 // Create Drag&Drop Manager and define a few DND types
1495 fDNDTypeList = new Atom_t[3];
1496 fDNDTypeList[0] = gVirtualX->InternAtom("application/root", kFALSE);
1497 fDNDTypeList[1] = gVirtualX->InternAtom("text/uri-list", kFALSE);
1498 fDNDTypeList[2] = 0;
1499 if (!gDNDManager)
1500 new TGDNDManager(this, fDNDTypeList);
1501 SetWindowName();
1502}
1503
1504////////////////////////////////////////////////////////////////////////////////
1505/// TGMainFrame destructor.
1506
1508{
1509 delete [] fDNDTypeList;
1510 if (fBindList) {
1511 fBindList->Delete();
1512 delete fBindList;
1513 }
1514 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_s),
1516 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_s),
1518}
1519
1520////////////////////////////////////////////////////////////////////////////////
1521/// Opens dialog window allowing user to save the frame contents
1522/// as a ROOT macro or as an image.
1523/// Returns kTRUE if something was saved.
1524///
1525/// This is bound to Ctrl-S by default.
1526
1528{
1529 static TString dir(".");
1530 static Bool_t overwr = kFALSE;
1531
1532 Bool_t repeat_save;
1533 do {
1534 repeat_save = kFALSE;
1535
1536 TGFileInfo fi;
1538 fi.SetIniDir(dir);
1539 fi.fOverwrite = overwr;
1540 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
1541 if (!fi.fFilename) return kFALSE;
1542 dir = fi.fIniDir;
1543 overwr = fi.fOverwrite;
1544 const Bool_t res = SaveFrameAsCodeOrImage(fi.fFilename);
1545 if (!res) {
1546 Int_t retval;
1547 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1548 TString::Format("file (%s) cannot be saved with this extension",
1549 fi.fFilename),
1551 repeat_save = (retval == kMBRetry);
1552 }
1553 } while (repeat_save);
1554
1555 return kTRUE;
1556}
1557
1558////////////////////////////////////////////////////////////////////////////////
1559/// Saves the frame contents as a ROOT macro or as an image,
1560/// depending on the extension of the fileName argument.
1561/// If preexisting, the file is overwritten.
1562/// Returns kTRUE if something was saved.
1563
1565{
1566 static TString dir(".");
1567
1568 const TString fname = gSystem->UnixPathName(fileName);
1569 if (fname.EndsWith(".C")) {
1571 main->SaveSource(fname.Data(), "");
1572 } else {
1574 if (fname.EndsWith("gif")) {
1575 gtype = TImage::kGif;
1576 } else if (fname.EndsWith(".png")) {
1577 gtype = TImage::kPng;
1578 } else if (fname.EndsWith(".jpg")) {
1579 gtype = TImage::kJpeg;
1580 } else if (fname.EndsWith(".tiff")) {
1581 gtype = TImage::kTiff;
1582 } else if (fname.EndsWith(".xpm")) {
1583 gtype = TImage::kXpm;
1584 }
1585 if (gtype != TImage::kUnknown) {
1586 Int_t saver = gErrorIgnoreLevel;
1588 TImage *img = TImage::Create();
1589 RaiseWindow();
1590 img->FromWindow(GetId());
1591 img->WriteImage(fname, gtype);
1592 gErrorIgnoreLevel = saver;
1593 delete img;
1594 } else {
1595 Error("SaveFrameAsCodeOrImage", "File cannot be saved with this extension");
1596 return kFALSE;
1597 }
1598 }
1599
1600 return kTRUE;
1601}
1602
1603////////////////////////////////////////////////////////////////////////////////
1604/// Handle keyboard events.
1605
1607{
1608 if (fBindList) {
1609
1610 TIter next(fBindList);
1611 TGMapKey *m;
1612 TGFrame *w = 0;
1613
1614 while ((m = (TGMapKey *) next())) {
1615 if (m->fKeyCode == event->fCode) {
1616 w = (TGFrame *) m->fWindow;
1617 if (w->HandleKey(event)) return kTRUE;
1618 }
1619 }
1620 }
1621
1622 if ((event->fType == kGKeyPress) && (event->fState & kKeyControlMask)) {
1623 UInt_t keysym;
1624 char str[2];
1625 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1626
1627 if ((keysym & ~0x20) == kKey_S) { // case insensitive ctrl-s
1628 return SaveFrameAsCodeOrImage();
1629 }
1630 }
1631 return kFALSE;
1632}
1633
1634////////////////////////////////////////////////////////////////////////////////
1635/// Bind key to a window.
1636
1638{
1639 TList *list = fBindList;
1640 Handle_t id = fId;
1641
1642 if (fClient->IsEditable()) {
1644 list = main->GetBindList();
1645 id = main->GetId();
1646 }
1647
1648 if (list) {
1649 TGMapKey *m = new TGMapKey(keycode, (TGWindow *)w);
1650 list->Add(m);
1651 gVirtualX->GrabKey(id, keycode, modifier, kTRUE);
1652 return kTRUE;
1653 }
1654 return kFALSE;
1655}
1656
1657////////////////////////////////////////////////////////////////////////////////
1658/// Remove key binding.
1659
1661{
1662 if (fBindList) {
1663 TIter next(fBindList);
1664 TGMapKey *m;
1665 while ((m = (TGMapKey *) next())) {
1666 if (m->fKeyCode == (UInt_t) keycode) {
1667 fBindList->Remove(m);
1668 delete m;
1669 gVirtualX->GrabKey(fId, keycode, modifier, kFALSE);
1670 return;
1671 }
1672 }
1673 }
1674}
1675
1676////////////////////////////////////////////////////////////////////////////////
1677/// Handle mouse button events.
1678
1680{
1681 if (event->fType == kButtonRelease) {
1683 }
1684 return TGCompositeFrame::HandleButton(event);
1685}
1686
1687
1688////////////////////////////////////////////////////////////////////////////////
1689/// Handle mouse motion events.
1690
1692{
1694 gDNDManager->Drag(event->fXRoot, event->fYRoot,
1696 }
1697 return TGCompositeFrame::HandleMotion(event);
1698}
1699
1700////////////////////////////////////////////////////////////////////////////////
1701/// Handle primary selection event.
1702
1704{
1705 if ((Atom_t)event->fUser[1] == TGDNDManager::GetDNDSelection()) {
1706 if (gDNDManager)
1707 return gDNDManager->HandleSelection(event);
1708 }
1710}
1711
1712////////////////////////////////////////////////////////////////////////////////
1713/// Handle selection request event.
1714
1716{
1717 if ((Atom_t)event->fUser[1] == TGDNDManager::GetDNDSelection()) {
1718 if (gDNDManager)
1719 return gDNDManager->HandleSelectionRequest(event);
1720 }
1722}
1723
1724////////////////////////////////////////////////////////////////////////////////
1725/// Handle client messages sent to this frame.
1726
1728{
1730
1731 if ((event->fFormat == 32) && ((Atom_t)event->fUser[0] == gWM_DELETE_WINDOW) &&
1732 (event->fHandle != gROOT_MESSAGE)) {
1733 Emit("CloseWindow()");
1735 CloseWindow();
1736 }
1737 return kTRUE;
1738}
1739
1740////////////////////////////////////////////////////////////////////////////////
1741/// Send close message to self. This method should be called from
1742/// a button to close this window.
1743
1745{
1746 Event_t event;
1747
1748 event.fType = kClientMessage;
1749 event.fFormat = 32;
1750 event.fHandle = gWM_DELETE_WINDOW;
1751
1752 event.fWindow = GetId();
1753 event.fUser[0] = (Long_t) gWM_DELETE_WINDOW;
1754 event.fUser[1] = 0;
1755 event.fUser[2] = 0;
1756 event.fUser[3] = 0;
1757 event.fUser[4] = 0;
1758
1759 gVirtualX->SendEvent(GetId(), &event);
1760}
1761
1762////////////////////////////////////////////////////////////////////////////////
1763/// Close and delete main frame. We get here in response to ALT+F4 or
1764/// a window manager close command. To terminate the application when this
1765/// happens override this method and call gApplication->Terminate(0) or
1766/// make a connection to this signal (if after the slot this method
1767/// should not be called call DontCallClose() in the slot).
1768/// By default the window will be deleted.
1769
1771{
1772 DeleteWindow();
1773}
1774
1775////////////////////////////////////////////////////////////////////////////////
1776/// Typically call this method in the slot connected to the CloseWindow()
1777/// signal to prevent the calling of the default or any derived CloseWindow()
1778/// methods to prevent premature or double deletion of this window.
1779
1781{
1783}
1784
1785////////////////////////////////////////////////////////////////////////////////
1786/// Set window name. This is typically done via the window manager.
1787
1789{
1790 if (!name) {
1792 } else {
1793 fWindowName = name;
1794 gVirtualX->SetWindowName(fId, (char *)name);
1795 }
1796}
1797
1798////////////////////////////////////////////////////////////////////////////////
1799/// Set window icon name. This is typically done via the window manager.
1800
1802{
1803 fIconName = name;
1804 gVirtualX->SetIconName(fId, (char *)name);
1805}
1806
1807////////////////////////////////////////////////////////////////////////////////
1808/// Set window icon pixmap by name. This is typically done via the window
1809/// manager. Icon can be in any image format supported by TImage, e.g.
1810/// GIF, XPM, PNG, JPG .. or even PS, PDF (see EImageFileTypes in TImage.h
1811/// for the full list of supported formats).
1812///
1813/// For example,
1814/// main_frame->SetIconPixmap("/home/root/icons/bld_rgb.png");
1815
1816const TGPicture *TGMainFrame::SetIconPixmap(const char *iconName)
1817{
1818 fIconPixmap = iconName;
1819 const TGPicture *iconPic = fClient->GetPicture(iconName);
1820 if (iconPic) {
1821 Pixmap_t pic = iconPic->GetPicture();
1822 gVirtualX->SetIconPixmap(fId, pic);
1823 return iconPic;
1824 } else
1825 return 0;
1826}
1827
1828////////////////////////////////////////////////////////////////////////////////
1829/// Set window icon by xpm array. That allows to have icons
1830/// builtin to the source code.
1831///
1832/// For example,
1833/// \code{.cpp}
1834/// #include "/home/root/icons/bld_rgb.xpm"
1835/// //bld_rgb.xpm contains char *bld_rgb[] array
1836/// main_frame->SetIconPixmap(bld_rgb);
1837/// \endcode
1838
1839void TGMainFrame::SetIconPixmap(char **xpm_array)
1840{
1841 TImage *img = TImage::Create();
1842 if (!img) return;
1843 img->SetImageBuffer(xpm_array, TImage::kXpm);
1844 Pixmap_t pic = img->GetPixmap();
1845 if (pic) {
1846 gVirtualX->SetIconPixmap(fId, pic);
1847 } else {
1848 Warning("SetIconPixmap", "Failed to set window icon from xpm array.");
1849 }
1850 delete img;
1851}
1852
1853////////////////////////////////////////////////////////////////////////////////
1854/// Set the windows class and resource name. Used to get the right
1855/// resources from the resource database. However, ROOT applications
1856/// will typically use the .rootrc file for this.
1857
1858void TGMainFrame::SetClassHints(const char *className, const char *resourceName)
1859{
1860 fClassName = className;
1861 fResourceName = resourceName;
1862 gVirtualX->SetClassHints(fId, (char *)className, (char *)resourceName);
1863}
1864
1865////////////////////////////////////////////////////////////////////////////////
1866/// Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
1867
1869{
1870 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1871
1872 fMWMValue = value;
1873 fMWMFuncs = funcs;
1874 fMWMInput = input;
1875 gVirtualX->SetMWMHints(fId, value, funcs, input);
1876}
1877
1878////////////////////////////////////////////////////////////////////////////////
1879/// Give the window manager a window position hint.
1880
1882{
1883 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1884
1885 fWMX = x;
1886 fWMY = y;
1887 gVirtualX->SetWMPosition(fId, x, y);
1888}
1889
1890////////////////////////////////////////////////////////////////////////////////
1891/// Give the window manager a window size hint.
1892
1894{
1895 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1896
1897 fWMWidth = w;
1898 fWMHeight = h;
1899 gVirtualX->SetWMSize(fId, w, h);
1900}
1901
1902////////////////////////////////////////////////////////////////////////////////
1903/// Give the window manager minimum and maximum size hints. Also
1904/// specify via winc and hinc the resize increments.
1905
1909{
1910 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1911
1916 fWMWidthInc = winc;
1918 gVirtualX->SetWMSizeHints(fId, wmin, hmin, wmax, hmax, winc, hinc);
1919}
1920
1921////////////////////////////////////////////////////////////////////////////////
1922/// Set the initial state of the window. Either kNormalState or kIconicState.
1923
1925{
1926 if (fClient->IsEditable() && (fParent == fClient->GetRoot())) return;
1927
1928 fWMInitState = state;
1929 gVirtualX->SetWMState(fId, state);
1930}
1931
1932
1933////////////////////////////////////////////////////////////////////////////////
1934/// Create a transient window. A transient window is typically used for
1935/// dialog boxes.
1936
1938 UInt_t w, UInt_t h, UInt_t options)
1939 : TGMainFrame(p, w, h, options | kTransientFrame)
1940{
1941 fMain = main;
1942 if (!fMain && gClient)
1943 fMain = gClient->GetRoot();
1944
1945 if (fMain) {
1946 gVirtualX->SetWMTransientHint(fId, fMain->GetId());
1947 }
1948}
1949
1950////////////////////////////////////////////////////////////////////////////////
1951/// Position transient frame centered relative to the parent frame.
1952/// If fMain is 0 (i.e. TGTransientFrame is acting just like a
1953/// TGMainFrame) and croot is true, the window will be centered on
1954/// the root window, otherwise no action is taken and the default
1955/// wm placement will be used.
1956
1958{
1959 Int_t x=0, y=0, ax, ay;
1960 Window_t wdummy;
1961
1964
1965 if (fMain) {
1966
1967 switch (pos) {
1968 case kCenter:
1969 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - fWidth) >> 1;
1970 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - fHeight) >> 1;
1971 break;
1972 case kRight:
1973 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - (fWidth >> 1));
1974 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - fHeight) >> 1;
1975 break;
1976 case kLeft:
1977 x = (Int_t)(-1 * (Int_t)(fWidth >> 1));
1978 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - fHeight) >> 1;
1979 break;
1980 case kTop:
1981 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - fWidth) >> 1;
1982 y = (Int_t)(-1 * (Int_t)(fHeight >> 1));
1983 break;
1984 case kBottom:
1985 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - fWidth) >> 1;
1986 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - (fHeight >> 1));
1987 break;
1988 case kTopLeft:
1989 x = (Int_t)(-1 * (Int_t)(fWidth >> 1));
1990 y = (Int_t)(-1 * (Int_t)(fHeight >> 1));
1991 break;
1992 case kTopRight:
1993 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - (fWidth >> 1));
1994 y = (Int_t)(-1 * (Int_t)(fHeight >> 1));
1995 break;
1996 case kBottomLeft:
1997 x = (Int_t)(-1 * (Int_t)(fWidth >> 1));
1998 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - (fHeight >> 1));
1999 break;
2000 case kBottomRight:
2001 x = (Int_t)(((TGFrame *) fMain)->GetWidth() - (fWidth >> 1));
2002 y = (Int_t)(((TGFrame *) fMain)->GetHeight() - (fHeight >> 1));
2003 break;
2004 }
2005
2006 gVirtualX->TranslateCoordinates(fMain->GetId(), GetParent()->GetId(),
2007 x, y, ax, ay, wdummy);
2008 if (!gVirtualX->InheritsFrom("TGWin32")) {
2009 if (ax < 10)
2010 ax = 10;
2011 else if (ax + fWidth + 10 > dw)
2012 ax = dw - fWidth - 10;
2013
2014 if (ay < 20)
2015 ay = 20;
2016 else if (ay + fHeight + 50 > dh)
2017 ay = dh - fHeight - 50;
2018 }
2019
2020 } else if (croot) {
2021
2022 switch (pos) {
2023 case kCenter:
2024 x = (dw - fWidth) >> 1;
2025 y = (dh - fHeight) >> 1;
2026 break;
2027 case kRight:
2028 x = dw - (fWidth >> 1);
2029 y = (dh - fHeight) >> 1;
2030 break;
2031 case kLeft:
2032 x = -1 * (Int_t)(fWidth >> 1);
2033 y = (dh - fHeight) >> 1;
2034 break;
2035 case kTop:
2036 x = (dw - fWidth) >> 1;
2037 y = -1 * (Int_t)(fHeight >> 1);
2038 break;
2039 case kBottom:
2040 x = (dw - fWidth) >> 1;
2041 y = dh - (fHeight >> 1);
2042 break;
2043 case kTopLeft:
2044 x = -1 * (Int_t)(fWidth >> 1);
2045 y = -1 * (Int_t)(fHeight >> 1);
2046 break;
2047 case kTopRight:
2048 x = dw - (fWidth >> 1);
2049 y = -1 * (Int_t)(fHeight >> 1);
2050 break;
2051 case kBottomLeft:
2052 x = -1 * (Int_t)(fWidth >> 1);
2053 y = dh - (fHeight >> 1);
2054 break;
2055 case kBottomRight:
2056 x = dw - (fWidth >> 1);
2057 y = dh - (fHeight >> 1);
2058 break;
2059 }
2060
2061 ax = x;
2062 ay = y;
2063
2064 } else {
2065
2066 return;
2067
2068 }
2069
2070 Move(ax, ay);
2071 SetWMPosition(ax, ay);
2072}
2073
2074////////////////////////////////////////////////////////////////////////////////
2075/// Create a group frame. The title will be adopted and deleted by the
2076/// group frame.
2077
2079 UInt_t options, GContext_t norm,
2080 FontStruct_t font, Pixel_t back) :
2081 TGCompositeFrame(p, 1, 1, options, back)
2082{
2083 fText = title;
2084 fFontStruct = font;
2085 fNormGC = norm;
2086 fTitlePos = kLeft;
2088
2089 int max_ascent, max_descent;
2090 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
2091 fBorderWidth = max_ascent + max_descent + 1;
2092}
2093
2094////////////////////////////////////////////////////////////////////////////////
2095/// Create a group frame.
2096
2097TGGroupFrame::TGGroupFrame(const TGWindow *p, const char *title,
2098 UInt_t options, GContext_t norm,
2099 FontStruct_t font, Pixel_t back) :
2100 TGCompositeFrame(p, 1, 1, options, back)
2101{
2102 fText = new TGString(!p && !title ? GetName() : title);
2103 fFontStruct = font;
2104 fNormGC = norm;
2105 fTitlePos = kLeft;
2107
2108 int max_ascent, max_descent;
2109 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
2110 fBorderWidth = max_ascent + max_descent + 1;
2111
2112 SetWindowName();
2113}
2114
2115////////////////////////////////////////////////////////////////////////////////
2116/// Delete a group frame.
2117
2119{
2120 if (fHasOwnFont) {
2121 TGGCPool *pool = fClient->GetGCPool();
2122 TGGC *gc = pool->FindGC(fNormGC);
2123 pool->FreeGC(gc);
2124 }
2125 delete fText;
2126}
2127
2128////////////////////////////////////////////////////////////////////////////////
2129/// Returns default size.
2130
2132{
2133 UInt_t tw = gVirtualX->TextWidth(fFontStruct, fText->GetString(),
2134 fText->GetLength()) + 24;
2135
2137
2138 return tw>dim.fWidth ? TGDimension(tw, dim.fHeight) : dim;
2139}
2140
2141////////////////////////////////////////////////////////////////////////////////
2142/// Redraw the group frame. Need special DoRedraw() since we need to
2143/// redraw with fBorderWidth=0.
2144
2146{
2147 gVirtualX->ClearArea(fId, 0, 0, fWidth, fHeight);
2148
2149 DrawBorder();
2150}
2151
2152
2153////////////////////////////////////////////////////////////////////////////////
2154/// Changes text color.
2155/// If local is true color is changed locally, otherwise - globally.
2156
2158{
2160 TGGC *gc = pool->FindGC(fNormGC);
2161
2162 if (gc && local) {
2163 gc = pool->GetGC((GCValues_t*)gc->GetAttributes(), kTRUE); // copy
2165 }
2166 if (gc) {
2167 gc->SetForeground(color);
2168 fNormGC = gc->GetGC();
2169 }
2170 fClient->NeedRedraw(this);
2171}
2172
2173////////////////////////////////////////////////////////////////////////////////
2174/// Changes text font.
2175/// If local is true font is changed locally - otherwise globally.
2176
2178{
2179 FontH_t v = gVirtualX->GetFontHandle(font);
2180 if (!v) return;
2181
2182 fFontStruct = font;
2183
2185 TGGC *gc = pool->FindGC(fNormGC);
2186
2187 if (gc && local) {
2188 gc = pool->GetGC((GCValues_t*)gc->GetAttributes(), kTRUE); // copy
2190 }
2191 if (gc) {
2192 gc->SetFont(v);
2193 fNormGC = gc->GetGC();
2194 }
2195 fClient->NeedRedraw(this);
2196}
2197
2198////////////////////////////////////////////////////////////////////////////////
2199/// Changes text font specified by name.
2200/// If local is true font is changed locally - otherwise globally.
2201
2202void TGGroupFrame::SetTextFont(const char *fontName, Bool_t local)
2203{
2204 TGFont *font = fClient->GetFont(fontName);
2205
2206 if (font) {
2207 SetTextFont(font->GetFontStruct(), local);
2208 }
2209}
2210
2211////////////////////////////////////////////////////////////////////////////////
2212/// Returns kTRUE if text attributes are unique,
2213/// returns kFALSE if text attributes are shared (global).
2214
2216{
2217 return fHasOwnFont;
2218}
2219
2220////////////////////////////////////////////////////////////////////////////////
2221/// Draw border of around the group frame.
2222///
2223/// if frame is kRaisedFrame - a frame border is of "wall style",
2224/// otherwise of "groove style".
2225
2227{
2228 Int_t x, y, l, t, r, b, gl, gr, sep, max_ascent, max_descent;
2229
2230 UInt_t tw = gVirtualX->TextWidth(fFontStruct, fText->GetString(), fText->GetLength());
2231 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
2232
2233 l = 0;
2234 t = (max_ascent + max_descent + 2) >> 1;
2235 r = fWidth - 1;
2236 // next three lines are for backward compatibility in case of horizontal layout
2237 // coverity[returned_null]
2238 // coverity[dereference]
2242 b = fHeight - 1;
2243 else
2244 b = fHeight - t;
2245
2246 sep = 3;
2247 UInt_t rr = 5 + (sep << 1) + tw;
2248
2249 switch (fTitlePos) {
2250 case kRight:
2251 gl = fWidth>rr ? Int_t(fWidth - rr) : 5 + sep;
2252 break;
2253 case kCenter:
2254 gl = fWidth>tw ? Int_t((fWidth - tw)>>1) - sep : 5 + sep;
2255 break;
2256 case kLeft:
2257 default:
2258 gl = 5 + sep;
2259 }
2260 gr = gl + tw + (sep << 1);
2261
2262 switch (fOptions & (kSunkenFrame | kRaisedFrame)) {
2263 case kRaisedFrame:
2264 gVirtualX->DrawLine(fId, GetHilightGC()(), l, t, gl, t);
2265 gVirtualX->DrawLine(fId, GetShadowGC()(), l+1, t+1, gl, t+1);
2266
2267 gVirtualX->DrawLine(fId, GetHilightGC()(), gr, t, r-1, t);
2268 gVirtualX->DrawLine(fId, GetShadowGC()(), gr, t+1, r-2, t+1);
2269
2270 gVirtualX->DrawLine(fId, GetHilightGC()(), r-1, t, r-1, b-1);
2271 gVirtualX->DrawLine(fId, GetShadowGC()(), r, t, r, b);
2272
2273 gVirtualX->DrawLine(fId, GetHilightGC()(), r-1, b-1, l, b-1);
2274 gVirtualX->DrawLine(fId, GetShadowGC()(), r, b, l, b);
2275
2276 gVirtualX->DrawLine(fId, GetHilightGC()(), l, b-1, l, t);
2277 gVirtualX->DrawLine(fId, GetShadowGC()(), l+1, b-2, l+1, t+1);
2278 break;
2279 case kSunkenFrame:
2280 default:
2281 gVirtualX->DrawLine(fId, GetShadowGC()(), l, t, gl, t);
2282 gVirtualX->DrawLine(fId, GetHilightGC()(), l+1, t+1, gl, t+1);
2283
2284 gVirtualX->DrawLine(fId, GetShadowGC()(), gr, t, r-1, t);
2285 gVirtualX->DrawLine(fId, GetHilightGC()(), gr, t+1, r-2, t+1);
2286
2287 gVirtualX->DrawLine(fId, GetShadowGC()(), r-1, t, r-1, b-1);
2288 gVirtualX->DrawLine(fId, GetHilightGC()(), r, t, r, b);
2289
2290 gVirtualX->DrawLine(fId, GetShadowGC()(), r-1, b-1, l, b-1);
2291 gVirtualX->DrawLine(fId, GetHilightGC()(), r, b, l, b);
2292
2293 gVirtualX->DrawLine(fId, GetShadowGC()(), l, b-1, l, t);
2294 gVirtualX->DrawLine(fId, GetHilightGC()(), l+1, b-2, l+1, t+1);
2295 break;
2296 }
2297
2298 x = gl + sep;
2299 y = 1;
2300
2301 fText->Draw(fId, fNormGC, x, y + max_ascent);
2302}
2303
2304////////////////////////////////////////////////////////////////////////////////
2305/// Set or change title of the group frame. Title TGString is adopted
2306/// by the TGGroupFrame.
2307
2309{
2310 if (!title) {
2311 Warning("SetTitle", "title cannot be 0, try \"\"");
2312 title = new TGString("");
2313 }
2314
2315 delete fText;
2316
2317 fText = title;
2318 fClient->NeedRedraw(this);
2319}
2320
2321////////////////////////////////////////////////////////////////////////////////
2322/// Set or change title of the group frame.
2323
2324void TGGroupFrame::SetTitle(const char *title)
2325{
2326 if (!title) {
2327 Error("SetTitle", "title cannot be 0, try \"\"");
2328 return;
2329 }
2330
2331 SetTitle(new TGString(title));
2332}
2333
2334////////////////////////////////////////////////////////////////////////////////
2335/// Return default font structure in use.
2336
2338{
2339 if (!fgDefaultFont && gClient)
2340 fgDefaultFont = gClient->GetResourcePool()->GetDefaultFont();
2341 return fgDefaultFont->GetFontStruct();
2342}
2343
2344////////////////////////////////////////////////////////////////////////////////
2345/// Return default graphics context in use.
2346
2348{
2349 if (!fgDefaultGC && gClient)
2350 fgDefaultGC = gClient->GetResourcePool()->GetFrameGC();
2351 return *fgDefaultGC;
2352}
2353
2354////////////////////////////////////////////////////////////////////////////////
2355/// Header Frame constructor.
2356
2358 UInt_t options, Pixel_t back) :
2359 TGHorizontalFrame(p, w, h, options | kVerticalFrame, back)
2360{
2362 fSplitCursor = gVirtualX->CreateCursor(kArrowHor);
2363 fOverSplitter = false;
2364 fOverButton = -1;
2365 fLastButton = -1;
2366 fNColumns = 1;
2367 fColHeader = 0;
2368 fSplitHeader = 0;
2369
2370 gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
2372 kNone, kNone);
2374}
2375
2376////////////////////////////////////////////////////////////////////////////////
2377/// Set columns information in the header frame.
2378
2380 TGVFileSplitter **splitHeader)
2381{
2382 fNColumns = nColumns;
2383 fColHeader = colHeader;
2384 fSplitHeader = splitHeader;
2385}
2386
2387////////////////////////////////////////////////////////////////////////////////
2388/// Handle mouse button event in header frame.
2389
2391{
2392 if ( event->fY > 0 &&
2393 event->fY <= (Int_t) this->GetHeight() ) {
2394 for (Int_t i = 1; i < fNColumns; ++i ) {
2395 if ( event->fX < fColHeader[i]->GetX() &&
2396 event->fX >= fColHeader[i-1]->GetX() ) {
2397 if ( fOverSplitter ) {
2398 if ( event->fX <= fColHeader[i-1]->GetX() + 5 )
2399 fSplitHeader[i-2]->HandleButton(event);
2400 else
2401 fSplitHeader[i-1]->HandleButton(event);
2402 } else {
2403 if ( event->fType == kButtonPress ) {
2404 fLastButton = i - 1;
2405 } else {
2406 fLastButton = -1;
2407 }
2408 event->fX -= fColHeader[i-1]->GetX();
2409 fColHeader[i-1]->HandleButton(event);
2410 }
2411 break;
2412 }
2413 }
2414 }
2415
2416 return kTRUE;
2417}
2418
2419////////////////////////////////////////////////////////////////////////////////
2420/// Handle double click mouse event in header frame.
2421
2423{
2424 if ( event->fY > 0 &&
2425 event->fY <= (Int_t) this->GetHeight() ) {
2426 for (Int_t i = 1; i < fNColumns; ++i ) {
2427 if ( event->fX < fColHeader[i]->GetX() &&
2428 event->fX >= fColHeader[i-1]->GetX() ) {
2429 if ( fOverSplitter ) {
2430 if ( event->fX <= fColHeader[i-1]->GetX() + 5 )
2431 fSplitHeader[i-2]->HandleDoubleClick(event);
2432 else
2433 fSplitHeader[i-1]->HandleDoubleClick(event);
2434 } else {
2435 event->fX -= fColHeader[i-1]->GetX();
2436 fColHeader[i-1]->HandleDoubleClick(event);
2437 }
2438 break;
2439 }
2440 }
2441 }
2442
2443 return kTRUE;
2444}
2445
2446////////////////////////////////////////////////////////////////////////////////
2447/// Handle mouse motion events in header frame.
2448
2450{
2451 if ( event->fY > 0 &&
2452 event->fY <= (Int_t) this->GetHeight() ) {
2453 Bool_t inMiddle = false;
2454
2455 for (Int_t i = 1; i < fNColumns; ++i ) {
2456 if ( event->fX > fColHeader[i]->GetX() - 5 &&
2457 event->fX < fColHeader[i]->GetX() + 5 ) {
2458 inMiddle = true;
2459 }
2460 if ( event->fX < fColHeader[i]->GetX() &&
2461 event->fX >= fColHeader[i-1]->GetX() ) {
2462 fOverButton = i - 1;
2463 }
2464 }
2465 fOverSplitter = inMiddle;
2466 if ( fOverSplitter ) {
2467 gVirtualX->SetCursor(fId, fSplitCursor);
2468 }
2469 else {
2470 gVirtualX->SetCursor(fId, kNone);
2471 }
2472 }
2473 return kTRUE;
2474}
2475
2476////////////////////////////////////////////////////////////////////////////////
2477/// Save a user color in a C++ macro file - used in SavePrimitive().
2478
2479void TGFrame::SaveUserColor(std::ostream &out, Option_t *option)
2480{
2481 char quote = '"';
2482
2483 if (gROOT->ClassSaved(TGFrame::Class())) {
2484 out << std::endl;
2485 } else {
2486 // declare a color variable to reflect required user changes
2487 out << std::endl;
2488 out << " ULong_t ucolor; // will reflect user color changes" << std::endl;
2489 }
2490 ULong_t ucolor;
2491 if (option && !strcmp(option, "slider"))
2492 ucolor = GetDefaultFrameBackground();
2493 else
2494 ucolor = GetBackground();
2495 if ((ucolor != fgUserColor) || (ucolor == GetWhitePixel())) {
2496 const char *ucolorname = TColor::PixelAsHexString(ucolor);
2497 out << " gClient->GetColorByName(" << quote << ucolorname << quote
2498 << ",ucolor);" << std::endl;
2499 fgUserColor = ucolor;
2500 }
2501}
2502
2503////////////////////////////////////////////////////////////////////////////////
2504/// Returns a frame option string - used in SavePrimitive().
2505
2507{
2508 TString options;
2509
2510 if (!GetOptions()) {
2511 options = "kChildFrame";
2512 } else {
2513 if (fOptions & kMainFrame) {
2514 if (options.Length() == 0) options = "kMainFrame";
2515 else options += " | kMainFrame";
2516 }
2517 if (fOptions & kVerticalFrame) {
2518 if (options.Length() == 0) options = "kVerticalFrame";
2519 else options += " | kVerticalFrame";
2520 }
2521 if (fOptions & kHorizontalFrame) {
2522 if (options.Length() == 0) options = "kHorizontalFrame";
2523 else options += " | kHorizontalFrame";
2524 }
2525 if (fOptions & kSunkenFrame) {
2526 if (options.Length() == 0) options = "kSunkenFrame";
2527 else options += " | kSunkenFrame";
2528 }
2529 if (fOptions & kRaisedFrame) {
2530 if (options.Length() == 0) options = "kRaisedFrame";
2531 else options += " | kRaisedFrame";
2532 }
2533 if (fOptions & kDoubleBorder) {
2534 if (options.Length() == 0) options = "kDoubleBorder";
2535 else options += " | kDoubleBorder";
2536 }
2537 if (fOptions & kFitWidth) {
2538 if (options.Length() == 0) options = "kFitWidth";
2539 else options += " | kFitWidth";
2540 }
2541 if (fOptions & kFixedWidth) {
2542 if (options.Length() == 0) options = "kFixedWidth";
2543 else options += " | kFixedWidth";
2544 }
2545 if (fOptions & kFitHeight) {
2546 if (options.Length() == 0) options = "kFitHeight";
2547 else options += " | kFitHeight";
2548 }
2549 if (fOptions & kFixedHeight) {
2550 if (options.Length() == 0) options = "kFixedHeight";
2551 else options += " | kFixedHeight";
2552 }
2553 if (fOptions & kOwnBackground) {
2554 if (options.Length() == 0) options = "kOwnBackground";
2555 else options += " | kOwnBackground";
2556 }
2557 if (fOptions & kTransientFrame) {
2558 if (options.Length() == 0) options = "kTransientFrame";
2559 else options += " | kTransientFrame";
2560 }
2561 if (fOptions & kTempFrame) {
2562 if (options.Length() == 0) options = "kTempFrame";
2563 else options += " | kTempFrame";
2564 }
2565 }
2566 return options;
2567}
2568
2569////////////////////////////////////////////////////////////////////////////////
2570/// Returns MWM decoration hints as a string - used in SavePrimitive().
2571
2573{
2574 TString hints;
2575
2576 if (fMWMValue) {
2577 if (fMWMValue & kMWMDecorAll) {
2578 if (hints.Length() == 0) hints = "kMWMDecorAll";
2579 else hints += " | kMWMDecorAll";
2580 }
2581 if (fMWMValue & kMWMDecorBorder) {
2582 if (hints.Length() == 0) hints = "kMWMDecorBorder";
2583 else hints += " | kMWMDecorBorder";
2584 }
2586 if (hints.Length() == 0) hints = "kMWMDecorResizeH";
2587 else hints += " | kMWMDecorResizeH";
2588 }
2589 if (fMWMValue & kMWMDecorTitle) {
2590 if (hints.Length() == 0) hints = "kMWMDecorTitle";
2591 else hints += " | kMWMDecorTitle";
2592 }
2593 if (fMWMValue & kMWMDecorMenu) {
2594 if (hints.Length() == 0) hints = "kMWMDecorMenu";
2595 else hints += " | kMWMDecorMenu";
2596 }
2598 if (hints.Length() == 0) hints = "kMWMDecorMinimize";
2599 else hints += " | kMWMDecorMinimize";
2600 }
2602 if (hints.Length() == 0) hints = "kMWMDecorMaximize";
2603 else hints += " | kMWMDecorMaximize";
2604 }
2605 }
2606 return hints;
2607}
2608
2609////////////////////////////////////////////////////////////////////////////////
2610/// Returns MWM function hints as a string - used in SavePrimitive().
2611
2613{
2614 TString hints;
2615
2616 if (fMWMFuncs) {
2617
2618 if (fMWMFuncs & kMWMFuncAll) {
2619 if (hints.Length() == 0) hints = "kMWMFuncAll";
2620 else hints += " | kMWMFuncAll";
2621 }
2622 if (fMWMFuncs & kMWMFuncResize) {
2623 if (hints.Length() == 0) hints = "kMWMFuncResize";
2624 else hints += " | kMWMFuncResize";
2625 }
2626 if (fMWMFuncs & kMWMFuncMove) {
2627 if (hints.Length() == 0) hints = "kMWMFuncMove";
2628 else hints += " | kMWMFuncMove";
2629 }
2631 if (hints.Length() == 0) hints = "kMWMFuncMinimize";
2632 else hints += " | kMWMFuncMinimize";
2633 }
2635 if (hints.Length() == 0) hints = "kMWMFuncMaximize";
2636 else hints += " | kMWMFuncMaximize";
2637 }
2638 if (fMWMFuncs & kMWMFuncClose) {
2639 if (hints.Length() == 0) hints = "kMWMFuncClose";
2640 else hints += " | kMWMFuncClose";
2641 }
2642 }
2643 return hints;
2644}
2645
2646////////////////////////////////////////////////////////////////////////////////
2647/// Returns MWM input mode hints as a string - used in SavePrimitive().
2648
2650{
2651 TString hints;
2652
2653 if (fMWMInput == 0) hints = "kMWMInputModeless";
2654
2655 if (fMWMInput == 1) hints = "kMWMInputPrimaryApplicationModal";
2656
2657 if (fMWMInput == 2) hints = "kMWMInputSystemModal";
2658
2659 if (fMWMInput == 3) hints = "kMWMInputFullApplicationModal";
2660
2661 return hints;
2662}
2663
2664////////////////////////////////////////////////////////////////////////////////
2665/// Auxiliary protected method used to save subframes.
2666
2668{
2669 if (fLayoutBroken)
2670 out << " " << GetName() << "->SetLayoutBroken(kTRUE);" << std::endl;
2671
2672 if (!fList) return;
2673
2674 char quote = '"';
2675
2676 TGFrameElement *el;
2677 static TGHSplitter *hsplit = 0;
2678 static TGVSplitter *vsplit = 0;
2679 TList *signalslist;
2680 TList *connlist;
2681 TQConnection *conn;
2682 TString signal_name, slot_name;
2683
2684 TIter next(fList);
2685
2686 while ((el = (TGFrameElement *) next())) {
2687
2688 // Don't save hidden (unmapped) frames having a parent different
2689 // than this frame. Solves a problem with shared frames
2690 // (e.g. shared menus in the new Browser)
2691 if ((!(el->fState & kIsVisible)) && (el->fFrame->GetParent() != this))
2692 continue;
2693
2694 // Remember if the frame to be saved is a TG(H,V)Splitter
2695 // See comments below and in TG[H/V]Splitter::SavePrimitive()
2696 if (el->fFrame->InheritsFrom("TGVSplitter")) {
2697 vsplit = (TGVSplitter *)el->fFrame;
2698 if (vsplit->GetLeft())
2699 vsplit = 0;
2700 }
2701 else if (el->fFrame->InheritsFrom("TGHSplitter")) {
2702 hsplit = (TGHSplitter *)el->fFrame;
2703 if (hsplit->GetAbove())
2704 hsplit = 0;
2705 }
2706 el->fFrame->SavePrimitive(out, option);
2707 out << " " << GetName() << "->AddFrame(" << el->fFrame->GetName();
2708 el->fLayout->SavePrimitive(out, option);
2709 out << ");"<< std::endl;
2710 if (IsLayoutBroken()) {
2711 out << " " << el->fFrame->GetName() << "->MoveResize(";
2712 out << el->fFrame->GetX() << "," << el->fFrame->GetY() << ",";
2713 out << el->fFrame->GetWidth() << "," << el->fFrame->GetHeight();
2714 out << ");" << std::endl;
2715 }
2716 // TG(H,V)Splitter->SetFrame(theframe) can only be saved _AFTER_
2717 // having saved "theframe", when "theframe" is either at right
2718 // or below the splitter (that means after the splitter in the
2719 // list of frames), otherwise "theframe" would be undefined
2720 // (aka used before to be created)...
2721 if (vsplit && el->fFrame == vsplit->GetFrame()) {
2722 out << " " << vsplit->GetName() << "->SetFrame(" << vsplit->GetFrame()->GetName();
2723 if (vsplit->GetLeft()) out << ",kTRUE);" << std::endl;
2724 else out << ",kFALSE);"<< std::endl;
2725 vsplit = 0;
2726 }
2727 if (hsplit && el->fFrame == hsplit->GetFrame()) {
2728 out << " " << hsplit->GetName() << "->SetFrame(" << hsplit->GetFrame()->GetName();
2729 if (hsplit->GetAbove()) out << ",kTRUE);" << std::endl;
2730 else out << ",kFALSE);"<< std::endl;
2731 hsplit = 0;
2732 }
2733
2734 if (!(el->fState & kIsVisible)) {
2736 }
2737
2738 // saving signals/slots
2739 signalslist = (TList*)el->fFrame->GetListOfSignals();
2740 if (!signalslist) continue;
2741 connlist = (TList*)signalslist->Last();
2742 if (connlist) {
2743 conn = (TQConnection*)connlist->Last();
2744 if (conn) {
2745 signal_name = connlist->GetName();
2746 slot_name = conn->GetName();
2747 Int_t eq = slot_name.First('=');
2748 Int_t rb = slot_name.First(')');
2749 if (eq != -1)
2750 slot_name.Remove(eq, rb-eq);
2751 out << " " << el->fFrame->GetName() << "->Connect(" << quote << signal_name
2752 << quote << ", 0, 0, " << quote << slot_name << quote << ");" << std::endl;
2753
2754 TList *lsl = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfSlots");
2755 if (lsl) {
2756 TObjString *slotel = (TObjString *)lsl->FindObject(slot_name);
2757 if (!slotel)
2758 lsl->Add(new TObjString(slot_name));
2759 }
2760 }
2761 }
2762 }
2763 out << std::endl;
2764}
2765
2766////////////////////////////////////////////////////////////////////////////////
2767/// Save a composite frame widget as a C++ statement(s) on output stream out.
2768
2769void TGCompositeFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
2770{
2772
2773 if (!strcmp(GetName(),"")) {
2774 SetName(Form("fCompositeframe%d",fgCounter));
2775 fgCounter++;
2776 }
2777
2778 out << std::endl << " // composite frame" << std::endl;
2779 out << " TGCompositeFrame *";
2780 out << GetName() << " = new TGCompositeFrame(" << fParent->GetName()
2781 << "," << GetWidth() << "," << GetHeight();
2782
2784 if (!GetOptions()) {
2785 out << ");" << std::endl;
2786 } else {
2787 out << "," << GetOptionString() <<");" << std::endl;
2788 }
2789 } else {
2790 out << "," << GetOptionString() << ",ucolor);" << std::endl;
2791 }
2792 if (option && strstr(option, "keep_names"))
2793 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
2794
2795 // setting layout manager if it differs from the composite frame type
2796 // coverity[returned_null]
2797 // coverity[dereference]
2799 if ((GetOptions() & kHorizontalFrame) &&
2801 ;
2802 } else if ((GetOptions() & kVerticalFrame) &&
2804 ;
2805 } else {
2806 out << " " << GetName() <<"->SetLayoutManager(";
2807 lm->SavePrimitive(out, option);
2808 out << ");"<< std::endl;
2809 }
2810
2812}
2813
2814////////////////////////////////////////////////////////////////////////////////
2815/// Save the GUI main frame widget in a C++ macro file.
2816
2818{
2819 // iteration over all active classes to exclude the base ones
2820 TString opt = option;
2821 TBits *bc = new TBits();
2822 TClass *c1, *c2, *c3;
2823 UInt_t k = 0; // will mark k-bit of TBits if the class is a base class
2824
2825 // Reset the ClassSaved status of all classes
2826 gROOT->ResetClassSaved();
2827
2828 TIter nextc1(gROOT->GetListOfClasses());
2829 //gROOT->GetListOfClasses()->ls(); // valid. test
2830 while((c1 = (TClass *)nextc1())) {
2831
2832 TIter nextc2(gROOT->GetListOfClasses());
2833 while ((c2 = (TClass *)nextc2())) {
2834 if (c1==c2) continue;
2835 else {
2836 c3 = c2->GetBaseClass(c1);
2837 if (c3 != 0) {
2838 bc->SetBitNumber(k, kTRUE);
2839 break;
2840 }
2841 }
2842 }
2843 k++;
2844 }
2845
2846 TList *ilist = new TList(); // will contain include file names without '.h'
2847 ilist->SetName("ListOfIncludes");
2848 gROOT->GetListOfSpecials()->Add(ilist);
2849 k=0;
2850
2851 // completes list of include file names
2852 TIter nextdo(gROOT->GetListOfClasses());
2853 while ((c2 = (TClass *)nextdo())) {
2854 // for used GUI header files
2855 if (bc->TestBitNumber(k) == 0 && c2->InheritsFrom(TGObject::Class()) == 1) {
2856 // for any used ROOT header files activate the line below, comment the line above
2857 //if (bc->TestBitNumber(k) == 0) {
2858 const char *iname;
2859 iname = c2->GetDeclFileName();
2860 if (iname[0] && strstr(iname,".h")) {
2861 const char *lastsl = strrchr(iname,'/');
2862 if (lastsl) iname = lastsl + 1;
2863 char *tname = new char[strlen(iname)+1];
2864 Int_t i=0;
2865 while (*iname != '.') {
2866 tname[i] = *iname;
2867 i++; iname++;
2868 }
2869 tname[i] = 0; //tname = include file name without '.h'
2870
2871 TObjString *iel = (TObjString *)ilist->FindObject(tname);
2872 if (!iel) {
2873 ilist->Add(new TObjString(tname));
2874 }
2875 // Weird, but when saving a canvas, the following two classes
2876 // may be missing if the toolbar has not been displayed...
2877 if (strstr(tname, "TRootCanvas")) {
2878 if (!ilist->FindObject("TGDockableFrame"))
2879 ilist->Add(new TObjString("TGDockableFrame"));
2880 if (!ilist->FindObject("TG3DLine"))
2881 ilist->Add(new TObjString("TG3DLine"));
2882 }
2883 delete [] tname;
2884 }
2885 k++; continue;
2886 }
2887 k++;
2888 }
2889
2890 char quote = '"';
2891 std::ofstream out;
2892
2893 TString ff = filename && strlen(filename) ? filename : "Rootappl.C";
2894
2895 // Computes the main method name.
2896 const char *fname = gSystem->BaseName(ff.Data());
2897 Int_t lenfname = strlen(fname);
2898 char *sname = new char[lenfname+1];
2899
2900 Int_t i = 0;
2901 while ((*fname != '.') && (i < lenfname)) {
2902 sname[i] = *fname;
2903 i++; fname++;
2904 }
2905 if (i == lenfname)
2906 ff += ".C";
2907 sname[i] = 0;
2908
2909 out.open(ff.Data(), std::ios::out);
2910 if (!out.good()) {
2911 Error("SaveSource", "cannot open file: %s", ff.Data());
2912 delete [] sname;
2913 return;
2914 }
2915
2916 // writes include files in C++ macro
2917 TObjString *inc;
2918 ilist = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfIncludes");
2919
2920 if (!ilist) {
2921 delete [] sname;
2922 return;
2923 }
2924
2925 // write macro header, date/time stamp as string, and the used Root version
2926 TDatime t;
2927 out <<"// Mainframe macro generated from application: "<< gApplication->Argv(0) << std::endl;
2928 out <<"// By ROOT version "<< gROOT->GetVersion() <<" on "<<t.AsSQLString()<< std::endl;
2929 out << std::endl;
2930
2931 TIter nexti(ilist);
2932 while((inc = (TObjString *)nexti())) {
2933 out << "#ifndef ROOT_" << inc->GetString() << std::endl;
2934 out << "#include " << quote << inc->GetString() << ".h" << quote << std::endl;
2935 out << "#endif" << std::endl;
2936 if (strstr(inc->GetString(),"TRootEmbeddedCanvas")) {
2937 out << "#ifndef ROOT_TCanvas" << std::endl;
2938 out << "#include " << quote << "TCanvas.h" << quote << std::endl;
2939 out << "#endif" << std::endl;
2940 }
2941 }
2942 out << std::endl << "#include " << quote << "Riostream.h" << quote << std::endl;
2943 // deletes created ListOfIncludes
2944 gROOT->GetListOfSpecials()->Remove(ilist);
2945 ilist->Delete();
2946 delete ilist;
2947 delete bc;
2948
2949 // writes the macro entry point equal to the fname
2950 out << std::endl;
2951 out << "void " << sname << "()" << std::endl;
2952 out <<"{"<< std::endl;
2953 delete [] sname;
2954
2956
2957 // saving slots
2958 TList *lSlots = new TList;
2959 lSlots->SetName("ListOfSlots");
2960 gROOT->GetListOfSpecials()->Add(lSlots);
2961
2963
2965 out << " " << GetName() << "->SetClassHints(" << quote << fClassName
2966 << quote << "," << quote << fResourceName << quote << ");" << std::endl;
2967 }
2968
2970 if (fMWMValue || fMWMFuncs || fMWMInput) {
2971 out << " " << GetName() << "->SetMWMHints(";
2972 out << GetMWMvalueString() << "," << std::endl;
2973 out << " ";
2974 out << GetMWMfuncString() << "," << std::endl;
2975 out << " ";
2976 out << GetMWMinpString() << ");"<< std::endl;
2977 }
2978
2979/// GetWMPosition(fWMX, fWMY);
2980/// if ((fWMX != -1) || (fWMY != -1)) {
2981/// out <<" "<<GetName()<<"->SetWMPosition("<<fWMX<<","<<fWMY<<");"<<std::endl;
2982/// } // does not work - fixed via Move() below...
2983
2985 if (fWMWidth != UInt_t(-1) || fWMHeight != UInt_t(-1)) {
2986 out <<" "<<GetName()<<"->SetWMSize("<<fWMWidth<<","<<fWMHeight<<");"<<std::endl;
2987 }
2988
2990 if (fWMMinWidth != UInt_t(-1) || fWMMinHeight != UInt_t(-1) ||
2991 fWMMaxWidth != UInt_t(-1) || fWMMaxHeight != UInt_t(-1) ||
2992 fWMWidthInc != UInt_t(-1) || fWMHeightInc != UInt_t(-1)) {
2993 out <<" "<<GetName()<<"->SetWMSizeHints("<<fWMMinWidth<<","<<fWMMinHeight
2994 <<","<<fWMMaxWidth<<","<<fWMMaxHeight
2995 <<","<<fWMWidthInc<<","<<fWMHeightInc <<");"<<std::endl;
2996 }
2997
2998 out << " " <<GetName()<< "->MapSubwindows();" << std::endl;
2999
3001 TGFrame *fhidden;
3002 while ((fhidden = (TGFrame*)nexth())) {
3003 out << " " <<fhidden->GetName()<< "->UnmapWindow();" << std::endl;
3004 }
3005
3006 out << std::endl;
3008
3009 Bool_t usexy = kFALSE;
3010 // coverity[returned_null]
3011 // coverity[dereference]
3013 if (lm->InheritsFrom("TGXYLayout"))
3014 usexy = kTRUE;
3015
3016 if (!usexy)
3017 out << " " <<GetName()<< "->Resize("<< GetName()<< "->GetDefaultSize());" << std::endl;
3018 else
3019 out << " " <<GetName()<< "->Resize("<< GetWidth()<<","<<GetHeight()<<");"<<std::endl;
3020
3021 out << " " <<GetName()<< "->MapWindow();" <<std::endl;
3022
3024 if ((fWMX != -1) || (fWMY != -1)) {
3025 out <<" "<<GetName()<<"->Move("<<fWMX<<","<<fWMY<<");"<<std::endl;
3026 }
3027
3028 // needed in case the frame was resized
3029 // otherwise the frame became bigger showing all hidden widgets (layout algorithm)
3030 if (!usexy) out << " " <<GetName()<< "->Resize("<< GetWidth()<<","<<GetHeight()<<");"<<std::endl;
3031 out << "} " << std::endl;
3032
3033 // writing slots
3034 TList *sl = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfSlots");
3035 if (sl) {
3036 TIter nextsl(sl);
3037 TObjString *slobj;
3038 Int_t pnumber = 1;
3039
3040 while ((slobj = (TObjString*) nextsl())) {
3041 TString s = slobj->GetString();
3042 TString p = "";
3043 Int_t lb, rb, eq;
3044 lb = s.First('(');
3045 rb = s.First(')');
3046 eq = s.First('=');
3047 out << std::endl;
3048
3049 if (rb - lb > 1 && eq == -1) {
3050 p = TString::Format(" par%d", pnumber);
3051 s.Insert(rb, p);
3052 pnumber++;
3053 out << "void " << s << std::endl;
3054 out << "{" << std::endl;
3055 s = slobj->GetString();
3056 s[rb] = ' ';
3057 out << " std::cout << " << quote << "Slot " << s << quote
3058 << " <<" << p << " << " << quote << ")" << quote
3059 << " << std::endl; " << std::endl;
3060 } else {
3061 if (eq != -1) {
3062 s.Remove(eq, rb-eq);
3063 out << "void " << s << std::endl;
3064 out << "{" << std::endl;
3065 out << " std::cout << " << quote << "Slot " << s
3066 << quote << " << std::endl; " << std::endl;
3067 } else {
3068 out << "void " << slobj->GetString() << std::endl;
3069 out << "{" << std::endl;
3070 out << " std::cout << " << quote << "Slot " << slobj->GetString()
3071 << quote << " << std::endl; " << std::endl;
3072 }
3073 }
3074 out << "}" << std::endl;
3075 }
3076 gROOT->GetListOfSpecials()->Remove(sl);
3077 sl->Delete();
3078 delete sl;
3079 }
3080 out.close();
3081
3082 if (!opt.Contains("quiet"))
3083 printf(" C++ macro file %s has been generated\n", gSystem->BaseName(ff.Data()));
3084
3085 // Reset the ClassSaved status of all classes
3086 gROOT->ResetClassSaved();
3087}
3088
3089////////////////////////////////////////////////////////////////////////////////
3090/// Save a main frame widget as a C++ statement(s) on output stream out.
3091
3092void TGMainFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3093{
3094 if (fParent != gClient->GetDefaultRoot()) { // frame is embedded
3095 fOptions &= ~kMainFrame;
3098 return;
3099 }
3100
3101 char quote = '"';
3102
3103 out << std::endl << " // main frame" << std::endl;
3104 out << " TGMainFrame *";
3105 out << GetName() << " = new TGMainFrame(gClient->GetRoot(),10,10," // layout alg.
3106 << GetOptionString() << ");" <<std::endl;
3107 if (option && strstr(option, "keep_names"))
3108 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3109
3110 // setting layout manager if it differs from the main frame type
3111 // coverity[returned_null]
3112 // coverity[dereference]
3114 if ((GetOptions() & kHorizontalFrame) &&
3116 ;
3117 } else if ((GetOptions() & kVerticalFrame) &&
3119 ;
3120 } else {
3121 out << " " << GetName() <<"->SetLayoutManager(";
3122 lm->SavePrimitive(out, option);
3123 out << ");"<< std::endl;
3124 }
3125
3127
3128 if (fWindowName.Length()) {
3129 out << " " << GetName() << "->SetWindowName(" << quote << GetWindowName()
3130 << quote << ");" << std::endl;
3131 }
3132 if (fIconName.Length()) {
3133 out <<" "<<GetName()<< "->SetIconName("<<quote<<GetIconName()<<quote<<");"<<std::endl;
3134 }
3135 if (fIconPixmap.Length()) {
3136 out << " " << GetName() << "->SetIconPixmap(" << quote << GetIconPixmap()
3137 << quote << ");" << std::endl;
3138 }
3139}
3140
3141////////////////////////////////////////////////////////////////////////////////
3142/// Save a horizontal frame widget as a C++ statement(s) on output stream out.
3143
3144void TGHorizontalFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3145{
3147
3148 out << std::endl << " // horizontal frame" << std::endl;
3149 out << " TGHorizontalFrame *";
3150 out << GetName() << " = new TGHorizontalFrame(" << fParent->GetName()
3151 << "," << GetWidth() << "," << GetHeight();
3152
3154 if (!GetOptions()) {
3155 out << ");" << std::endl;
3156 } else {
3157 out << "," << GetOptionString() <<");" << std::endl;
3158 }
3159 } else {
3160 out << "," << GetOptionString() << ",ucolor);" << std::endl;
3161 }
3162 if (option && strstr(option, "keep_names"))
3163 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3164
3165 // setting layout manager if it differs from the main frame type
3166 // coverity[returned_null]
3167 // coverity[dereference]
3169 if ((GetOptions() & kHorizontalFrame) &&
3171 ;
3172 } else if ((GetOptions() & kVerticalFrame) &&
3174 ;
3175 } else {
3176 out << " " << GetName() <<"->SetLayoutManager(";
3177 lm->SavePrimitive(out, option);
3178 out << ");"<< std::endl;
3179 }
3180
3182}
3183
3184////////////////////////////////////////////////////////////////////////////////
3185/// Save a vertical frame widget as a C++ statement(s) on output stream out.
3186
3187void TGVerticalFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3188{
3190
3191 out << std::endl << " // vertical frame" << std::endl;
3192 out << " TGVerticalFrame *";
3193 out << GetName() << " = new TGVerticalFrame(" << fParent->GetName()
3194 << "," << GetWidth() << "," << GetHeight();
3195
3197 if (!GetOptions()) {
3198 out <<");" << std::endl;
3199 } else {
3200 out << "," << GetOptionString() <<");" << std::endl;
3201 }
3202 } else {
3203 out << "," << GetOptionString() << ",ucolor);" << std::endl;
3204 }
3205 if (option && strstr(option, "keep_names"))
3206 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3207
3208 // setting layout manager if it differs from the main frame type
3209 // coverity[returned_null]
3210 // coverity[dereference]
3212 if ((GetOptions() & kHorizontalFrame) &&
3214 ;
3215 } else if ((GetOptions() & kVerticalFrame) &&
3217 ;
3218 } else {
3219 out << " " << GetName() <<"->SetLayoutManager(";
3220 lm->SavePrimitive(out, option);
3221 out << ");"<< std::endl;
3222 }
3223
3225}
3226
3227////////////////////////////////////////////////////////////////////////////////
3228/// Save a frame widget as a C++ statement(s) on output stream out.
3229
3230void TGFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3231{
3233
3234 out << " TGFrame *";
3235 out << GetName() << " = new TGFrame("<< fParent->GetName()
3236 << "," << GetWidth() << "," << GetHeight();
3237
3239 if (!GetOptions()) {
3240 out <<");" << std::endl;
3241 } else {
3242 out << "," << GetOptionString() <<");" << std::endl;
3243 }
3244 } else {
3245 out << "," << GetOptionString() << ",ucolor);" << std::endl;
3246 }
3247 if (option && strstr(option, "keep_names"))
3248 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3249}
3250
3251////////////////////////////////////////////////////////////////////////////////
3252/// Save a group frame widget as a C++ statement(s) on output stream out.
3253
3254void TGGroupFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3255{
3256 char quote = '"';
3257
3258 // font + GC
3259 option = GetName()+5; // unique digit id of the name
3260 TString parGC, parFont;
3261 // coverity[returned_null]
3262 // coverity[dereference]
3263 parFont.Form("%s::GetDefaultFontStruct()",IsA()->GetName());
3264 // coverity[returned_null]
3265 // coverity[dereference]
3266 parGC.Form("%s::GetDefaultGC()()",IsA()->GetName());
3267
3268 if ((GetDefaultFontStruct() != fFontStruct) || (GetDefaultGC()() != fNormGC)) {
3269 TGFont *ufont = gClient->GetResourcePool()->GetFontPool()->FindFont(fFontStruct);
3270 if (ufont) {
3271 ufont->SavePrimitive(out, option);
3272 parFont.Form("ufont->GetFontStruct()");
3273 }
3274
3275 TGGC *userGC = gClient->GetResourcePool()->GetGCPool()->FindGC(fNormGC);
3276 if (userGC) {
3277 userGC->SavePrimitive(out, option);
3278 parGC.Form("uGC->GetGC()");
3279 }
3280 }
3281
3283
3284 out << std::endl << " // " << quote << GetTitle() << quote << " group frame" << std::endl;
3285 out << " TGGroupFrame *";
3286 out << GetName() <<" = new TGGroupFrame("<<fParent->GetName()
3287 << "," << quote << GetTitle() << quote;
3288
3291 if (fNormGC == GetDefaultGC()()) {
3292 if (GetOptions() & kVerticalFrame) {
3293 out <<");" << std::endl;
3294 } else {
3295 out << "," << GetOptionString() <<");" << std::endl;
3296 }
3297 } else {
3298 out << "," << GetOptionString() << "," << parGC.Data() <<");" << std::endl;
3299 }
3300 } else {
3301 out << "," << GetOptionString() << "," << parGC.Data() << "," << parFont.Data() << ");" << std::endl;
3302 }
3303 } else {
3304 out << "," << GetOptionString() << "," << parGC.Data() << "," << parFont.Data() << ",ucolor);" << std::endl;
3305 }
3306 if (option && strstr(option, "keep_names"))
3307 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3308
3309 if (GetTitlePos() != -1)
3310 out << " " << GetName() <<"->SetTitlePos(";
3311 if (GetTitlePos() == 0)
3312 out << "TGGroupFrame::kCenter);" << std::endl;
3313 if (GetTitlePos() == 1)
3314 out << "TGGroupFrame::kRight);" << std::endl;
3315
3317
3318 // setting layout manager
3319 out << " " << GetName() <<"->SetLayoutManager(";
3320 // coverity[returned_null]
3321 // coverity[dereference]
3323 out << ");"<< std::endl;
3324
3325 out << " " << GetName() <<"->Resize(" << GetWidth() << ","
3326 << GetHeight() << ");" << std::endl;
3327}
3328
3329
3330////////////////////////////////////////////////////////////////////////////////
3331/// Save the GUI transient frame widget in a C++ macro file.
3332
3334{
3335 // iterate over all active classes to exclude the base ones
3336
3337 TString opt = option;
3338 TBits *bc = new TBits();
3339 TClass *c1, *c2, *c3;
3340 UInt_t k = 0; // will mark k-bit of TBits if the class is a base class
3341
3342 // Reset the ClassSaved status of all classes
3343 gROOT->ResetClassSaved();
3344
3345 TIter nextc1(gROOT->GetListOfClasses());
3346 while((c1 = (TClass *)nextc1())) {
3347
3348 TIter nextc2(gROOT->GetListOfClasses());
3349 while ((c2 = (TClass *)nextc2())) {
3350 if (c1==c2) continue;
3351 else {
3352 c3 = c2->GetBaseClass(c1);
3353 if (c3 != 0) {
3354 bc->SetBitNumber(k, kTRUE);
3355 break;
3356 }
3357 }
3358 }
3359 k++;
3360 }
3361
3362 TList *ilist = new TList(); // will contain include file names without '.h'
3363 ilist->SetName("ListOfIncludes");
3364 gROOT->GetListOfSpecials()->Add(ilist);
3365 k=0;
3366
3367 // completes list of include file names
3368 TIter nextdo(gROOT->GetListOfClasses());
3369 while ((c2 = (TClass *)nextdo())) {
3370 // to have only used GUI header files
3371 if (bc->TestBitNumber(k) == 0 && c2->InheritsFrom(TGObject::Class()) == 1) {
3372 // for any used ROOT header files activate the line below, comment the line above
3373 //if (bc->TestBitNumber(k) == 0) {
3374 const char *iname;
3375 iname = c2->GetDeclFileName();
3376 if (iname[0] && strstr(iname,".h")) {
3377 const char *lastsl = strrchr(iname,'/');
3378 if (lastsl) iname = lastsl + 1;
3379 char *tname = new char[strlen(iname)+1];
3380 Int_t i=0;
3381 while (*iname != '.') {
3382 tname[i] = *iname;
3383 i++; iname++;
3384 }
3385 tname[i] = 0; //tname = include file name without '.h'
3386
3387 TObjString *iel = (TObjString *)ilist->FindObject(tname);
3388 if (!iel) {
3389 ilist->Add(new TObjString(tname));
3390 }
3391 delete [] tname;
3392 }
3393 k++; continue;
3394 }
3395 k++;
3396 }
3397
3398 char quote = '"';
3399 std::ofstream out;
3400
3401 TString ff = filename && strlen(filename) ? filename : "Rootdlog.C";
3402
3403 // Computes the main method name.
3404 const char *fname = gSystem->BaseName(ff.Data());
3405 Int_t lenfname = strlen(fname);
3406 char *sname = new char[lenfname+1];
3407
3408 Int_t i = 0;
3409 while ((*fname != '.') && (i < lenfname)) {
3410 sname[i] = *fname;
3411 i++; fname++;
3412 }
3413 if (i == lenfname)
3414 ff += ".C";
3415 sname[i] = 0;
3416
3417 out.open(ff.Data(), std::ios::out);
3418 if (!out.good()) {
3419 Error("SaveSource", "cannot open file: %s", ff.Data());
3420 delete [] sname;
3421 return;
3422 }
3423
3424 // writes include files in C++ macro
3425 TObjString *inc;
3426 ilist = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfIncludes");
3427
3428 if (!ilist) {
3429 delete [] sname;
3430 return;
3431 }
3432
3433 // write macro header, date/time stamp as string, and the used Root version
3434 TDatime t;
3435 out <<"// Dialog macro generated from application: "<< gApplication->Argv(0) << std::endl;
3436 out <<"// By ROOT version "<< gROOT->GetVersion() <<" on "<<t.AsSQLString()<< std::endl;
3437 out << std::endl;
3438
3439 out << std::endl << std::endl;
3440
3441 TIter nexti(ilist);
3442 while((inc = (TObjString *)nexti())) {
3443 out <<"#ifndef ROOT_"<< inc->GetString() << std::endl;
3444 out <<"#include "<< quote << inc->GetString() <<".h"<< quote << std::endl;
3445 out <<"#endif" << std::endl;
3446 if (strstr(inc->GetString(),"TRootEmbeddedCanvas")) {
3447 out <<"#ifndef ROOT_TCanvas"<< std::endl;
3448 out <<"#include "<< quote <<"TCanvas.h"<< quote << std::endl;
3449 out <<"#endif" << std::endl;
3450 }
3451 }
3452 out << std::endl << "#include " << quote << "Riostream.h" << quote << std::endl;
3453 out << std::endl << std::endl;
3454 // deletes created ListOfIncludes
3455 gROOT->GetListOfSpecials()->Remove(ilist);
3456 ilist->Delete();
3457 delete ilist;
3458 delete bc;
3459
3460 // writes the macro entry point equal to the fname
3461 out << std::endl;
3462 out << "void " << sname << "()" << std::endl;
3463 delete [] sname;
3464
3465 // Save GUI widgets as a C++ macro in a file
3466 out <<"{"<< std::endl;
3467
3469
3470 // saving slots
3471 TList *lSlots = new TList;
3472 lSlots->SetName("ListOfSlots");
3473 gROOT->GetListOfSpecials()->Add(lSlots);
3474
3476
3478 out<<" "<<GetName()<< "->SetClassHints("<<quote<<fClassName<<quote
3479 <<"," <<quote<<fResourceName<<quote
3480 <<");"<<std::endl;
3481 }
3482
3484 if (fMWMValue || fMWMFuncs || fMWMInput) {
3485 out << " " << GetName() << "->SetMWMHints(";
3486 out << GetMWMvalueString() << "," << std::endl;
3487 out << " ";
3488 out << GetMWMfuncString() << "," << std::endl;
3489 out << " ";
3490 out << GetMWMinpString() << ");"<< std::endl;
3491 }
3492
3494 if ((fWMX != -1) || (fWMY != -1)) {
3495 out <<" "<<GetName()<<"->SetWMPosition("<<fWMX<<","<<fWMY<<");"<<std::endl;
3496 }
3497
3499 if (fWMWidth != UInt_t(-1) || fWMHeight != UInt_t(-1)) {
3500 out <<" "<<GetName()<<"->SetWMSize("<<fWMWidth<<","<<fWMHeight<<");"<<std::endl;
3501 }
3502
3504 if (fWMMinWidth != UInt_t(-1) || fWMMinHeight != UInt_t(-1) ||
3505 fWMMaxWidth != UInt_t(-1) || fWMMaxHeight != UInt_t(-1) ||
3506 fWMWidthInc != UInt_t(-1) || fWMHeightInc != UInt_t(-1)) {
3507
3508 out <<" "<<GetName()<<"->SetWMSizeHints("<<fWMMinWidth<<","<<fWMMinHeight
3509 <<","<<fWMMaxWidth<<","<<fWMMaxHeight <<","<<fWMWidthInc<<","<<fWMHeightInc
3510 <<");"<<std::endl;
3511 }
3512
3514 if ((fWMX != -1) || (fWMY != -1)) {
3515 out <<" "<<GetName()<<"->Move("<<fWMX<<","<<fWMY<<");"<<std::endl;
3516 }
3517
3518 out << " " <<GetName()<< "->MapSubwindows();" << std::endl;
3519
3521 TGFrame *fhidden;
3522 while ((fhidden = (TGFrame*)nexth())) {
3523 out << " " <<fhidden->GetName()<< "->UnmapWindow();" << std::endl;
3524 }
3525 out << std::endl;
3527
3528 Bool_t usexy = kFALSE;
3529 // coverity[returned_null]
3530 // coverity[dereference]
3532 if (lm->InheritsFrom("TGXYLayout"))
3533 usexy = kTRUE;
3534
3535 if (!usexy)
3536 out << " " <<GetName()<< "->Resize("<< GetName()<< "->GetDefaultSize());" << std::endl;
3537 else
3538 out << " " <<GetName()<< "->Resize("<< GetWidth()<<","<<GetHeight()<<");"<<std::endl;
3539
3540 out << " " <<GetName()<< "->MapWindow();" <<std::endl;
3541 if (!usexy) out << " " <<GetName()<< "->Resize();" << std::endl;
3542 out << "} " << std::endl;
3543
3544 // writing slots
3545 TList *sl = (TList *)gROOT->GetListOfSpecials()->FindObject("ListOfSlots");
3546 if (sl) {
3547 TIter nextsl(sl);
3548 TObjString *slobj;
3549 Int_t pnumber = 1;
3550
3551 while ((slobj = (TObjString*) nextsl())) {
3552 TString s = slobj->GetString();
3553 TString p = "";
3554 Int_t lb, rb, eq;
3555 lb = s.First('(');
3556 rb = s.First(')');
3557 eq = s.First('=');
3558 out << std::endl;
3559
3560 if (rb - lb > 1 && eq == -1) {
3561 p = TString::Format(" par%d", pnumber);
3562 s.Insert(rb, p);
3563 pnumber++;
3564 out << "void " << s << std::endl;
3565 out << "{" << std::endl;
3566 s = slobj->GetString();
3567 s[rb] = ' ';
3568 out << " std::cout << " << quote << "Slot " << s << quote
3569 << " <<" << p << " << " << quote << ")" << quote
3570 << " << std::endl; " << std::endl;
3571 } else {
3572 if (eq != -1) {
3573 s.Remove(eq, rb-eq);
3574 out << "void " << s << std::endl;
3575 out << "{" << std::endl;
3576 out << " std::cout << " << quote << "Slot " << s
3577 << quote << " << std::endl; " << std::endl;
3578 } else {
3579 out << "void " << slobj->GetString() << std::endl;
3580 out << "{" << std::endl;
3581 out << " std::cout << " << quote << "Slot " << slobj->GetString()
3582 << quote << " << std::endl; " << std::endl;
3583 }
3584 }
3585 out << "}" << std::endl;
3586 }
3587 gROOT->GetListOfSpecials()->Remove(sl);
3588 sl->Delete();
3589 delete sl;
3590 }
3591
3592 out.close();
3593
3594 if (!opt.Contains("quiet"))
3595 printf(" C++ macro file %s has been generated\n", gSystem->BaseName(ff.Data()));
3596
3597 // Reset the ClassSaved status of all classes
3598 gROOT->ResetClassSaved();
3599}
3600
3601////////////////////////////////////////////////////////////////////////////////
3602/// Save a transient frame widget as a C++ statement(s) on output stream out.
3603
3604void TGTransientFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
3605{
3606 char quote = '"';
3607
3608 out << std::endl << " // transient frame" << std::endl;
3609 out << " TGTransientFrame *";
3610 out << GetName()<<" = new TGTransientFrame(gClient->GetRoot(),0"
3611 << "," << GetWidth() << "," << GetHeight() << "," << GetOptionString() <<");" << std::endl;
3612
3613 if (option && strstr(option, "keep_names"))
3614 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
3615
3616 // setting layout manager if it differs from transient frame type
3617 // coverity[returned_null]
3618 // coverity[dereference]
3620 if ((GetOptions() & kHorizontalFrame) &&
3622 ;
3623 } else if ((GetOptions() & kVerticalFrame) &&
3625 ;
3626 } else {
3627 out << " " << GetName() <<"->SetLayoutManager(";
3628 lm->SavePrimitive(out, option);
3629 out << ");"<< std::endl;
3630 }
3631
3633
3634 if (fWindowName.Length()) {
3635 out << " " << GetName() << "->SetWindowName(" << quote << GetWindowName()
3636 << quote << ");" << std::endl;
3637 }
3638 if (fIconName.Length()) {
3639 out <<" "<<GetName()<< "->SetIconName("<<quote<<GetIconName()<<quote<<");"<<std::endl;
3640 }
3641 if (fIconPixmap.Length()) {
3642 out << " " << GetName() << "->SetIconPixmap(" << quote << GetIconPixmap()
3643 << quote << ");" << std::endl;
3644 }
3645}
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
@ kSelectionClear
Definition GuiTypes.h:63
@ kColormapNotify
Definition GuiTypes.h:64
@ kConfigureNotify
Definition GuiTypes.h:62
@ kGKeyPress
Definition GuiTypes.h:60
@ kExpose
Definition GuiTypes.h:62
@ kButtonRelease
Definition GuiTypes.h:60
@ kSelectionNotify
Definition GuiTypes.h:63
@ kButtonPress
Definition GuiTypes.h:60
@ kButtonDoubleClick
Definition GuiTypes.h:64
@ kFocusOut
Definition GuiTypes.h:61
@ kMotionNotify
Definition GuiTypes.h:61
@ kFocusIn
Definition GuiTypes.h:61
@ kClientMessage
Definition GuiTypes.h:63
@ kEnterNotify
Definition GuiTypes.h:61
@ kSelectionRequest
Definition GuiTypes.h:63
@ kKeyRelease
Definition GuiTypes.h:60
@ kLeaveNotify
Definition GuiTypes.h:61
@ kArrowHor
Definition GuiTypes.h:374
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Definition GuiTypes.h:35
const Mask_t kExposureMask
Definition GuiTypes.h:165
const Mask_t kWAEventMask
Definition GuiTypes.h:151
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
const Mask_t kWABackPixel
Definition GuiTypes.h:140
const Mask_t kAnyModifier
Definition GuiTypes.h:210
ULong_t Time_t
Event time.
Definition GuiTypes.h:42
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
EInitialState
Initial window mapping state.
Definition GuiTypes.h:345
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kFitHeight
Definition GuiTypes.h:388
@ kRaisedFrame
Definition GuiTypes.h:384
@ kTempFrame
Definition GuiTypes.h:393
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
@ kDoubleBorder
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:387
@ kFitWidth
Definition GuiTypes.h:386
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
@ kOwnBackground
Definition GuiTypes.h:391
@ kTransientFrame
Definition GuiTypes.h:392
@ kMainFrame
Definition GuiTypes.h:380
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kKeyControlMask
Definition GuiTypes.h:197
const Mask_t kKeyMod2Mask
typically mod on numeric keys
Definition GuiTypes.h:199
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kAnyButton
Definition GuiTypes.h:214
ULongptr_t Handle_t
Generic resource handle.
Definition GuiTypes.h:26
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
@ kKey_S
Definition KeySymbols.h:144
@ kKey_s
Definition KeySymbols.h:176
int main()
Definition Prototype.cxx:12
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
double fy() const
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr UInt_t kMaxUInt
Definition RtypesCore.h:111
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TApplication * gApplication
constexpr Int_t kFatal
Definition TError.h:49
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
Int_t gErrorIgnoreLevel
Error handling routines.
Definition TError.cxx:31
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
#define gClient
Definition TGClient.h:156
R__EXTERN TGDNDManager * gDNDManager
@ kFDSave
TList * gListOfHiddenFrames
Definition TGFrame.cxx:145
static const char * gSaveMacroTypes[]
Definition TGFrame.cxx:134
@ kMWMDecorResizeH
Definition TGFrame.h:65
@ kMWMFuncAll
Definition TGFrame.h:49
@ kMWMFuncMove
Definition TGFrame.h:51
@ kMWMDecorBorder
Definition TGFrame.h:64
@ kMWMFuncResize
Definition TGFrame.h:50
@ kMWMDecorMaximize
Definition TGFrame.h:69
@ kMWMDecorTitle
Definition TGFrame.h:66
@ kMWMDecorMinimize
Definition TGFrame.h:68
@ kMWMDecorMenu
Definition TGFrame.h:67
@ kMWMDecorAll
Definition TGFrame.h:63
@ kMWMFuncMaximize
Definition TGFrame.h:53
@ kMWMInputModeless
Definition TGFrame.h:57
@ kMWMFuncClose
Definition TGFrame.h:54
@ kMWMFuncMinimize
Definition TGFrame.h:52
@ kNoCleanup
Definition TGFrame.h:40
@ kDeepCleanup
Definition TGFrame.h:42
@ kIsArranged
Definition TGFrame.h:35
@ kIsVisible
Definition TGFrame.h:33
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsExpandX
Definition TGLayout.h:30
@ kMBRetry
Definition TGMsgBox.h:35
@ kMBCancel
Definition TGMsgBox.h:37
@ kMBIconExclamation
Definition TGMsgBox.h:24
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmax
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t SetTextFont
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void funcs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetWMPosition
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t winc
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t modifier
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmax
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hinc
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGuiBuilder * gGuiBuilder
Definition TGuiBuilder.h:66
#define gROOT
Definition TROOT.h:406
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
R__EXTERN TSystem * gSystem
Definition TSystem.h:555
R__EXTERN TVirtualDragManager * gDragManager
#define gVirtualX
Definition TVirtualX.h:337
R__EXTERN Atom_t gROOT_MESSAGE
Definition TVirtualX.h:40
R__EXTERN Atom_t gWM_DELETE_WINDOW
Definition TVirtualX.h:38
char ** Argv() const
Container of bits.
Definition TBits.h:26
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:81
void SetName(const char *name)
const char * GetName() const override
Return name of this collection.
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:2358
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:2396
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:2413
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
Bool_t HandleButton(Event_t *event) override
Handle mouse button event.
Definition TGButton.cxx:330
Window client.
Definition TGClient.h:37
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:234
Bool_t IsEditable() const
Definition TGClient.h:89
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:348
const TGResourcePool * GetResourcePool() const
Definition TGClient.h:124
UInt_t GetDisplayHeight() const
Get display height.
Definition TGClient.cxx:275
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:289
TGGCPool * GetGCPool() const
Definition TGClient.h:131
void SetRoot(TGWindow *root=nullptr)
Sets the current root (i.e.
Definition TGClient.cxx:244
Bool_t IsEditDisabled() const
Returns kTRUE if edit/guibuilding is forbidden.
Definition TGClient.cxx:935
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:372
UInt_t GetDisplayWidth() const
Get display width.
Definition TGClient.cxx:262
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
Bool_t HandleDragDrop(TGFrame *frame, Int_t x, Int_t y, TGLayoutHints *lo) override
Handle drop event.
Definition TGFrame.cxx:1421
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
~TGCompositeFrame() override
Delete a composite frame.
Definition TGFrame.cxx:904
virtual TGFrameElement * FindFrameElement(TGFrame *f) const
Find frame-element holding frame f.
Definition TGFrame.cxx:1094
TGLayoutManager * fLayoutManager
layout manager
Definition TGFrame.h:291
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 void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
TGFrame * GetFrameFromPoint(Int_t x, Int_t y) override
Get frame located at specified point.
Definition TGFrame.cxx:1308
Int_t GetState(TGFrame *f) const
Get state of sub frame.
Definition TGFrame.cxx:1218
void Print(Option_t *option="") const override
Print all frames in this composite frame.
Definition TGFrame.cxx:1266
Bool_t HandleDragMotion(TGFrame *) override
Handle drag motion event.
Definition TGFrame.cxx:1413
virtual TGLayoutManager * GetLayoutManager() const
Definition TGFrame.h:338
Bool_t HandleSelection(Event_t *) override
Definition TGFrame.h:330
Bool_t HandleDragEnter(TGFrame *) override
Handle drag enter event.
Definition TGFrame.cxx:1365
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:967
Bool_t HandleDragLeave(TGFrame *) override
Handle drag leave event.
Definition TGFrame.cxx:1395
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:2667
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
TGCompositeFrame(const TGCompositeFrame &)=delete
virtual Bool_t TranslateCoordinates(TGFrame *child, Int_t x, Int_t y, Int_t &fx, Int_t &fy)
Translate coordinates to child frame.
Definition TGFrame.cxx:1332
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
Bool_t HandleMotion(Event_t *) override
Definition TGFrame.h:327
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
Bool_t IsEditable() const override
Return kTRUE if frame is being edited.
Definition TGFrame.cxx:927
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
Bool_t IsLayoutBroken() const override
Definition TGFrame.h:357
Bool_t HandleButton(Event_t *) override
Definition TGFrame.h:324
Bool_t IsArranged(TGFrame *f) const
Get state of sub frame.
Definition TGFrame.cxx:1244
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1149
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:948
static TGLayoutHints * fgDefaultHints
Definition TGFrame.h:297
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a composite frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:2769
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
virtual void RemoveAll()
Remove all frames from composite frame.
Definition TGFrame.cxx:1131
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1043
static TClass * Class()
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
void SetLayoutBroken(Bool_t on=kTRUE) override
Set broken layout. No Layout method is called.
Definition TGFrame.cxx:1012
Bool_t HandleSelectionRequest(Event_t *event)
Handle selection request event.
Bool_t HandleClientMessage(Event_t *event)
Handle DND related client messages.
Bool_t HandleSelection(Event_t *event)
Handle selection event.
Bool_t IsDragging() const
void SetMainFrame(TGFrame *main)
static Atom_t GetDNDSelection()
Bool_t Drag(Int_t x_root, Int_t y_root, Atom_t action, Time_t timestamp)
Process drag event.
Bool_t Drop()
Drop.
TGFrame * GetMainFrame() const
static Atom_t GetDNDActionCopy()
UInt_t fHeight
Definition TGDimension.h:21
UInt_t fWidth
Definition TGDimension.h:20
This class creates a file selection dialog.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fOverwrite
if true overwrite the file with existing name on save
void SetIniDir(const char *inidir)
Set directory name.
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
FontStruct_t GetFontStruct() const
Definition TGFont.h:184
void SavePrimitive(std::ostream &out, Option_t *="") override
Save the used font as a C++ statement(s) on output stream out.
Definition TGFont.cxx:1884
TGLayoutHints * fLayout
Definition TGLayout.h:114
TGFrame * fFrame
Definition TGLayout.h:112
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:321
virtual Bool_t HandleSelectionClear(Event_t *)
Definition TGFrame.h:170
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.cxx:584
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition TGFrame.cxx:696
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
static const TGGC * fgWhiteGC
Definition TGFrame.h:106
virtual Int_t GetDragType() const
Returns drag source type.
Definition TGFrame.cxx:824
~TGFrame() override
Destructor.
Definition TGFrame.cxx:266
virtual void StartGuiBuilding(Bool_t on=kTRUE)
Go into GUI building mode.
Definition TGFrame.cxx:841
Bool_t IsEditable() const override
Definition TGFrame.h:213
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:629
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
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
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
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
void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0) override
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGFrame.h:202
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3230
virtual void DrawBorder()
Draw frame border.
Definition TGFrame.cxx:421
static const TGGC * fgBckgndGC
Definition TGFrame.h:109
virtual Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t)
Definition TGFrame.h:183
virtual void Draw3dRectangle(UInt_t type, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw 3D rectangle on the frame border.
Definition TGFrame.cxx:357
Int_t fBorderWidth
frame border width
Definition TGFrame.h:93
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
static const TGGC * fgShadowGC
Definition TGFrame.h:108
Bool_t HandleEvent(Event_t *event) override
Handle all frame events.
Definition TGFrame.cxx:457
static Pixel_t fgDefaultSelectedBackground
Definition TGFrame.h:102
UInt_t fMinWidth
minimal frame width
Definition TGFrame.h:89
void DoRedraw() override
Redraw the frame.
Definition TGFrame.cxx:430
void MapWindow() override
map window
Definition TGFrame.h:204
@ kDeleteWindowCalled
Definition TGFrame.h:83
virtual Pixel_t GetForeground() const
Return frame foreground color.
Definition TGFrame.cxx:303
TGFrameElement * GetFrameElement() const
Definition TGFrame.h:235
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:755
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
void Move(Int_t x, Int_t y) override
Move frame.
Definition TGFrame.cxx:593
TClass * IsA() const override
Definition TGFrame.h:283
static const TGGC * fgBlackGC
Definition TGFrame.h:105
Int_t GetX() const
Definition TGFrame.h:231
static Int_t fgDbx
Definition TGFrame.h:112
static UInt_t fgUserColor
Definition TGFrame.h:114
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
virtual TGFrame * GetFrameFromPoint(Int_t x, Int_t y)
Definition TGFrame.h:240
virtual UInt_t GetOptions() const
Definition TGFrame.h:197
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2506
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
void UnmapWindow() override
unmap window
Definition TGFrame.h:206
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:645
virtual void ProcessedConfigure(Event_t *event)
Definition TGFrame.h:177
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:765
virtual Bool_t HandleSelectionRequest(Event_t *)
Definition TGFrame.h:169
virtual Bool_t HandleSelection(Event_t *)
Definition TGFrame.h:168
void Print(Option_t *option="") const override
Print window id.
Definition TGFrame.cxx:793
UInt_t fWidth
frame width
Definition TGFrame.h:87
virtual Bool_t HandleButton(Event_t *)
Definition TGFrame.h:161
virtual Bool_t HandleMotion(Event_t *)
Definition TGFrame.h:164
void SetFrameElement(TGFrameElement *fe)
Definition TGFrame.h:236
UInt_t GetHeight() const
Definition TGFrame.h:225
virtual void SetCleanup(Int_t=kLocalCleanup)
Definition TGFrame.h:217
void MapSubwindows() override
map sub windows
Definition TGFrame.h:200
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
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
Bool_t Contains(Int_t x, Int_t y) const
Definition TGFrame.h:238
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
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2479
static TClass * Class()
Pixel_t fBackground
frame background color
Definition TGFrame.h:95
static Pixel_t fgBlackPixel
Definition TGFrame.h:104
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:775
static const TGGC * fgHilightGC
Definition TGFrame.h:107
static Pixel_t fgDefaultFrameBackground
Definition TGFrame.h:101
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get the best matching graphics context depending on values.
Definition TGGC.cxx:987
void FreeGC(const TGGC *gc)
Delete graphics context if it is not used anymore.
Definition TGGC.cxx:918
TGGC * FindGC(const TGGC *gc)
Find graphics context. Returns 0 in case gc is not found.
Definition TGGC.cxx:951
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save graphics context info as a C++ statement(s) on output stream out.
Definition TGGC.cxx:627
A composite frame with a border and a title.
Definition TGFrame.h:522
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a group frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3254
static TClass * Class()
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:2347
static const TGGC * fgDefaultGC
Definition TGFrame.h:534
TGGroupFrame(const TGGroupFrame &)=delete
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
void DrawBorder() override
Draw border of around the group frame.
Definition TGFrame.cxx:2226
TGDimension GetDefaultSize() const override
Returns default size.
Definition TGFrame.cxx:2131
TClass * IsA() const override
Definition TGFrame.h:576
void DoRedraw() override
Redraw the group frame.
Definition TGFrame.cxx:2145
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:2202
GContext_t fNormGC
title graphics context
Definition TGFrame.h:527
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Definition TGFrame.cxx:2337
~TGGroupFrame() override
Delete a group frame.
Definition TGFrame.cxx:2118
Bool_t HasOwnFont() const
Returns kTRUE if text attributes are unique, returns kFALSE if text attributes are shared (global).
Definition TGFrame.cxx:2215
virtual void SetTextColor(Pixel_t color, Bool_t local=kTRUE)
Changes text color.
Definition TGFrame.cxx:2157
Int_t GetTitlePos() const
Definition TGFrame.h:563
const char * GetTitle() const override
Returns title of object.
Definition TGFrame.h:571
virtual void SetTitle(TGString *title)
Set or change title of the group frame.
Definition TGFrame.cxx:2308
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
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click mouse event in header frame.
Definition TGFrame.cxx:2422
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:2379
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
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion events in header frame.
Definition TGFrame.cxx:2449
TGTextButton ** fColHeader
column headers for in detailed mode
Definition TGFrame.h:587
Cursor_t fSplitCursor
split cursor;
Definition TGFrame.h:589
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in header frame.
Definition TGFrame.cxx:2390
Int_t fNColumns
number of columns
Definition TGFrame.h:586
Int_t fOverButton
Indicates over which button the mouse is.
Definition TGFrame.h:591
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a horizontal frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3144
static TClass * Class()
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
void SavePrimitive(std::ostream &out, Option_t *option="") override
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:397
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:431
UInt_t fWMHeightInc
WM height increments.
Definition TGFrame.h:432
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion events.
Definition TGFrame.cxx:1691
virtual Bool_t SaveFrameAsCodeOrImage()
Opens dialog window allowing user to save the frame contents as a ROOT macro or as an image.
Definition TGFrame.cxx:1527
virtual void SaveSource(const char *filename="Rootappl.C", Option_t *option="")
Save the GUI main frame widget in a C++ macro file.
Definition TGFrame.cxx:2817
TString GetMWMfuncString() const
used in SaveSource()
Definition TGFrame.cxx:2612
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition TGFrame.cxx:1780
UInt_t fWMWidth
WM width.
Definition TGFrame.h:425
UInt_t fWMMinHeight
WM min height.
Definition TGFrame.h:428
void GetWMPosition(Int_t &x, Int_t &y) const
Definition TGFrame.h:483
Int_t fWMY
WM y position.
Definition TGFrame.h:424
UInt_t fWMMinWidth
WM min width.
Definition TGFrame.h:427
TString fResourceName
WM resource name.
Definition TGFrame.h:419
UInt_t fMWMValue
MWM decoration hints.
Definition TGFrame.h:420
void GetWMSize(UInt_t &w, UInt_t &h) const
Definition TGFrame.h:484
Atom_t * fDNDTypeList
handles DND types
Definition TGFrame.h:413
virtual void SendCloseMessage()
Send close message to self.
Definition TGFrame.cxx:1744
void GetMWMHints(UInt_t &value, UInt_t &funcs, UInt_t &input) const
Definition TGFrame.h:481
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1858
Int_t fWMX
WM x position.
Definition TGFrame.h:423
virtual void CloseWindow()
Close and delete main frame.
Definition TGFrame.cxx:1770
TString fIconPixmap
icon pixmap name
Definition TGFrame.h:417
UInt_t fWMMaxWidth
WM max width.
Definition TGFrame.h:429
~TGMainFrame() override
TGMainFrame destructor.
Definition TGFrame.cxx:1507
Bool_t HandleButton(Event_t *event) override
Handle mouse button events.
Definition TGFrame.cxx:1679
Bool_t HandleClientMessage(Event_t *event) override
Handle client messages sent to this frame.
Definition TGFrame.cxx:1727
TString fWindowName
window name
Definition TGFrame.h:415
@ kDontCallClose
Definition TGFrame.h:400
UInt_t fWMHeight
WM height.
Definition TGFrame.h:426
TList * fBindList
list with key bindings
Definition TGFrame.h:414
UInt_t fWMMaxHeight
WM max height.
Definition TGFrame.h:430
void SetWMState(EInitialState state)
Set the initial state of the window. Either kNormalState or kIconicState.
Definition TGFrame.cxx:1924
virtual Bool_t BindKey(const TGWindow *w, Int_t keycode, Int_t modifier) const
Bind key to a window.
Definition TGFrame.cxx:1637
UInt_t fMWMFuncs
MWM functions.
Definition TGFrame.h:421
EInitialState fWMInitState
WM initial state.
Definition TGFrame.h:433
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
TString GetMWMinpString() const
used in SaveSource()
Definition TGFrame.cxx:2649
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
Definition TGFrame.cxx:1893
TString fClassName
WM class name.
Definition TGFrame.h:418
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition TGFrame.cxx:1881
TString fIconName
icon name
Definition TGFrame.h:416
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
TString GetMWMvalueString() const
used in SaveSource()
Definition TGFrame.cxx:2572
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1606
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
Definition TGFrame.cxx:1868
const char * GetWindowName() const
Definition TGFrame.h:476
Bool_t HandleSelection(Event_t *event) override
Handle primary selection event.
Definition TGFrame.cxx:1703
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:1906
const char * GetIconPixmap() const
Definition TGFrame.h:478
const char * GetIconName() const override
Returns mime type name of object.
Definition TGFrame.h:477
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a main frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3092
virtual void RemoveBind(const TGWindow *w, Int_t keycode, Int_t modifier) const
Remove key binding.
Definition TGFrame.cxx:1660
Bool_t HandleSelectionRequest(Event_t *event) override
Handle selection request event.
Definition TGFrame.cxx:1715
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition TGFrame.cxx:1816
UInt_t fMWMInput
MWM input modes.
Definition TGFrame.h:422
static TClass * Class()
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
static TClass * Class()
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
Pixmap_t GetPicture() const
Definition TGPicture.h:54
TGGCPool * GetGCPool() const
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Int_t GetLength() const
Definition TGString.h:29
const char * GetString() const
Definition TGString.h:30
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
Definition TGString.cxx:56
Yield an action as soon as it is clicked.
Definition TGButton.h:142
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:498
void SaveSource(const char *filename="Rootdlog.C", Option_t *option="") override
Save the GUI transient frame widget in a C++ macro file.
Definition TGFrame.cxx:3333
TGTransientFrame(const TGTransientFrame &)=delete
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:1957
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a transient frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3604
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in vertical splitter.
Bool_t HandleDoubleClick(Event_t *) override
Handle double click mouse event in splitter.
const TGFrame * GetFrame() const
Definition TGSplitter.h:77
Bool_t GetLeft() const
Definition TGSplitter.h:78
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a vertical frame widget as a C++ statement(s) on output stream out.
Definition TGFrame.cxx:3187
static TClass * Class()
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:152
virtual void Move(Int_t x, Int_t y)
Move the window.
Definition TGWindow.cxx:271
static Int_t fgCounter
counter of created windows in SavePrimitive
Definition TGWindow.h:31
void Print(Option_t *option="") const override
Print window id.
Definition TGWindow.cxx:307
virtual UInt_t GetEditDisabled() const
Definition TGWindow.h:112
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition TGWindow.h:113
virtual Bool_t HandleExpose(Event_t *event)
Definition TGWindow.h:101
virtual void SetName(const char *name)
Definition TGWindow.h:121
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kEditDisableLayout
window layout cannot be edited
Definition TGWindow.h:60
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move and resize the window.
Definition TGWindow.cxx:287
virtual Bool_t IsMapSubwindows() const
Definition TGWindow.h:124
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:192
virtual void SetWindowName(const char *name=nullptr)
Set window name.
Definition TGWindow.cxx:129
const TGWindow * GetParent() const
Definition TGWindow.h:83
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
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
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
A doubly linked list.
Definition TList.h:38
void Clear(Option_t *option="") override
Remove all objects from the list.
Definition TList.cxx:400
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:576
void Add(TObject *obj) override
Definition TList.h:83
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
Definition TList.cxx:691
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:468
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:199
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:207
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition TObject.cxx:751
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:525
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
TQConnection class is an internal class, used in the object communication mechanism.
const char * GetName() const override
Returns name of connection (aka name of slot)
TList * GetListOfSignals() const
Definition TQObject.h:88
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
UInt_t RemoveReference()
Definition TRefCnt.h:41
UInt_t References() const
Definition TRefCnt.h:38
Basic string class.
Definition TString.h:139
Ssiz_t Length() const
Definition TString.h:417
TString & Insert(Ssiz_t pos, const char *s)
Definition TString.h:661
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2244
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition TString.cxx:538
const char * Data() const
Definition TString.h:376
TString & Remove(Ssiz_t pos)
Definition TString.h:685
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:2378
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2356
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
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:934
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:258
virtual void SetPasteFrame(TGFrame *f)
static TVirtualDragManager * Instance()
Load plugin and create drag manager object.
virtual Bool_t HandleEvent(Event_t *)
virtual void SetEditable(Bool_t)
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
TGraphErrors * gr
Definition legend1.C:25
return c2
Definition legend2.C:14
return c3
Definition legend3.C:15
R__ALWAYS_INLINE bool HasBeenDeleted(const TObject *obj)
Check if the TObject's memory has been deleted.
Definition TObject.h:402
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Int_t fXRoot
Definition GuiTypes.h:179
Handle_t fHandle
general resource handle (used for atoms or windows)
Definition GuiTypes.h:185
Int_t fFormat
Next fields only used by kClientMessageEvent.
Definition GuiTypes.h:186
UInt_t fWidth
Definition GuiTypes.h:182
UInt_t fHeight
width and height of exposed area
Definition GuiTypes.h:182
Window_t fWindow
window reported event is relative to
Definition GuiTypes.h:176
UInt_t fState
key or button mask
Definition GuiTypes.h:181
Int_t fYRoot
coordinates relative to root
Definition GuiTypes.h:179
Int_t fX
Definition GuiTypes.h:178
Time_t fTime
time event event occurred in ms
Definition GuiTypes.h:177
UInt_t fCode
key or button code
Definition GuiTypes.h:180
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Definition GuiTypes.h:187
Graphics context structure.
Definition GuiTypes.h:224
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:93
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
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4