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