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