Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGSplitFrame.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 23/01/2008
3
4/*************************************************************************
5 * Copyright (C) 1995-2008, 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#include "TGFrame.h"
13#include "TGLayout.h"
14#include "TGMenu.h"
15#include "TGSplitter.h"
16#include "TGSplitFrame.h"
17#include "TGInputDialog.h"
18#include "TGResourcePool.h"
19#include "TRootContextMenu.h"
20#include "TClassMenuItem.h"
21#include "TContextMenu.h"
22#include "TString.h"
23#include "TClass.h"
24#include "TList.h"
25#include "TVirtualX.h"
26#include "snprintf.h"
27
28#include <iostream>
29
30/** \class TGSplitFrame
31 \ingroup guiwidgets
32A split frame.
33*/
34
35
36/** \class TGSplitTool
37 \ingroup guiwidgets
38A split frame tool tip.
39*/
40
41
42
43////////////////////////////////////////////////////////////////////////////////
44/// Create a split frame tool tip. P is the tool tips parent window (normally
45/// fClient->GetRoot() and f is the frame to which the tool tip is associated.
46
49{
52 attr.fOverrideRedirect = kTRUE;
53 attr.fSaveUnder = kTRUE;
54
55 gVirtualX->ChangeWindowAttributes(fId, &attr);
56 SetBackgroundColor(fClient->GetResourcePool()->GetTipBgndColor());
57
59 fRectGC.SetForeground(0x99ff99);
60
61 TClass *cl = TClass::GetClass("TGSplitFrame");
63 TList *ml = cl->GetMenuList();
64 ((TClassMenuItem *)ml->At(1))->SetTitle("Cleanup Frame");
65 ((TClassMenuItem *)ml->At(2))->SetTitle("Close and Collapse");
66 ((TClassMenuItem *)ml->At(3))->SetTitle("Undock Frame");
67 ((TClassMenuItem *)ml->At(4))->SetTitle("Dock Frame Back");
68 ((TClassMenuItem *)ml->At(5))->SetTitle("Switch to Main");
69 ((TClassMenuItem *)ml->At(6))->SetTitle("Horizontally Split...");
70 ((TClassMenuItem *)ml->At(7))->SetTitle("Vertically Split...");
71 fContextMenu = new TContextMenu("SplitFrameContextMenu", "Actions");
75 if (f) Resize(f->GetWidth()/10, f->GetHeight()/10);
77
78 fWindow = f;
79 fX = fY = -1;
80}
81
82////////////////////////////////////////////////////////////////////////////////
83/// TGSplitTool destructor.
84
89
90////////////////////////////////////////////////////////////////////////////////
91/// Add a rectangle representation of a split frame in the map, together
92/// with the frame itself.
93
95{
96 TGRectMap *rect = new TGRectMap(x, y, w, h);
97 fMap.Add(rect, frame);
98}
99
100////////////////////////////////////////////////////////////////////////////////
101/// Redraw split frame tool.
102
104{
106 TMapIter next(&fMap);
107 while ((rect = (TGRectMap*)next())) {
108 gVirtualX->FillRectangle(fId, GetBckgndGC()(), rect->fX,
109 rect->fY, rect->fW, rect->fH);
110 gVirtualX->DrawRectangle(fId, GetBlackGC()(), rect->fX, rect->fY,
111 rect->fW, rect->fH);
112 }
113 DrawBorder();
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Draw border of tool window.
118
120{
121 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
122 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
123 gVirtualX->DrawLine(fId, GetBlackGC()(), 0, fHeight-1, fWidth-1, fHeight-1);
124 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth-1, fHeight-1, fWidth-1, 0);
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Handle mouse click events in the tool.
129
131{
132 if (event->fType != kButtonPress)
133 return kTRUE;
134 Int_t px = 0, py = 0;
137 TGSplitFrame *frm = 0;
138 TMapIter next(&fMap);
139 while ((rect = (TGRectMap*)next())) {
140 if (rect->Contains(event->fX, event->fY)) {
141 frm = (TGSplitFrame *)fMap.GetValue((const TObject *)rect);
142 gVirtualX->TranslateCoordinates(event->fWindow,
143 gClient->GetDefaultRoot()->GetId(),
144 event->fX, event->fY, px, py, wtarget);
145 fContextMenu->Popup(px, py, frm);
146 // connect PoppedDown signal to close the tool window
147 // when the menu is closed
149 ((TGPopupMenu *)menu)->Connect("PoppedDown()", "TGSplitTool", this, "Hide()");
150 return kTRUE;
151 }
152 }
153 Hide();
154 return kTRUE;
155}
156
157////////////////////////////////////////////////////////////////////////////////
158/// handle mouse motion events
159
161{
162 static TGRectMap *rect = 0, *oldrect = 0;
163 TMapIter next(&fMap);
164 while ((rect = (TGRectMap*)next())) {
165 if (rect->Contains(event->fX, event->fY)) {
166 // if inside a rectangle, highlight it
167 if (rect != oldrect) {
168 if (oldrect) {
169 gVirtualX->FillRectangle(fId, GetBckgndGC()(), oldrect->fX,
170 oldrect->fY, oldrect->fW, oldrect->fH);
171 gVirtualX->DrawRectangle(fId, GetBlackGC()(), oldrect->fX, oldrect->fY,
172 oldrect->fW, oldrect->fH);
173 }
174 gVirtualX->FillRectangle(fId, fRectGC(), rect->fX, rect->fY, rect->fW,
175 rect->fH);
176 gVirtualX->DrawRectangle(fId, GetBlackGC()(), rect->fX, rect->fY,
177 rect->fW, rect->fH);
178 oldrect = rect;
179 }
180 return kTRUE;
181 }
182 }
183 if (oldrect) {
184 gVirtualX->FillRectangle(fId, GetBckgndGC()(), oldrect->fX,
185 oldrect->fY, oldrect->fW, oldrect->fH);
186 gVirtualX->DrawRectangle(fId, GetBlackGC()(), oldrect->fX, oldrect->fY,
187 oldrect->fW, oldrect->fH);
188 }
189 return kTRUE;
190}
191////////////////////////////////////////////////////////////////////////////////
192/// Hide tool window. Use this method to hide the tool in a client class.
193
195{
196 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
197 fMap.Delete();
198 UnmapWindow();
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Reset tool tip popup delay timer. Use this method to activate tool tip
203/// in a client class.
204
206{
207 fMap.Delete();
208}
209
210////////////////////////////////////////////////////////////////////////////////
211/// Set popup position within specified frame (as specified in the ctor).
212/// To get back default behaviour (in the middle just below the designated
213/// frame) set position to -1,-1.
214
216{
217 fX = x;
218 fY = y;
219
220 if (fX < -1)
221 fX = 0;
222 if (fY < -1)
223 fY = 0;
224
225 if (fWindow) {
226 if (fX > (Int_t) fWindow->GetWidth())
227 fX = fWindow->GetWidth();
228 if (fY > (Int_t) fWindow->GetHeight())
229 fY = fWindow->GetHeight();
230 }
231}
232
233////////////////////////////////////////////////////////////////////////////////
234/// Show tool window.
235
237{
238 Move(x, y);
239 MapWindow();
240 RaiseWindow();
241
242 // last argument kFALSE forces all specified events to this window
244 fClient->GetResourcePool()->GetGrabCursor(),
245 kTRUE, kFALSE);
246 // Longptr_t args[2];
247 // args[0] = x;
248 // args[1] = y;
249}
250
251////////////////////////////////////////////////////////////////////////////////
252/// Default constructor.
253
255 UInt_t options) : TGCompositeFrame(p, w, h, options),
256 fFrame(0), fSplitter(0), fFirst(0), fSecond(0)
257{
258 fSplitTool = new TGSplitTool(gClient->GetDefaultRoot(), this);
259 fHRatio = fWRatio = 0.0;
260 fUndocked = 0;
263}
264
265////////////////////////////////////////////////////////////////////////////////
266/// Destructor. Make cleanup.
267
269{
270 delete fSplitTool;
271 Cleanup();
272}
273
274////////////////////////////////////////////////////////////////////////////////
275/// Add a frame in the split frame using layout hints l.
276
282
283////////////////////////////////////////////////////////////////////////////////
284/// Add a frame in the split frame using layout hints l.
285
292
293////////////////////////////////////////////////////////////////////////////////
294/// Recursively cleanup child frames.
295
297{
299 fFirst = 0;
300 fSecond = 0;
301 fSplitter = 0;
302 fUndocked = 0;
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Return the top level split frame.
307
309{
310 TGSplitFrame *top = this;
312 TGSplitFrame *p = dynamic_cast<TGSplitFrame *>(w);
313 while (p) {
314 top = p;
315 w = (TGWindow *)p->GetParent();
316 p = dynamic_cast<TGSplitFrame *>(w);
317 }
318 return top;
319}
320
321////////////////////////////////////////////////////////////////////////////////
322/// Close (unmap and remove from the list of frames) the frame contained in
323/// this split frame.
324
326{
327 if (fFrame) {
330 }
331 fFrame = 0;
332}
333
334////////////////////////////////////////////////////////////////////////////////
335/// Close (unmap, remove from the list of frames and destroy) the frame
336/// contained in this split frame. Then unsplit the parent frame.
337
339{
340 if (!fSplitter || !fFirst || !fSecond) {
341 TGSplitFrame *parent = (TGSplitFrame *)GetParent();
342 if (parent->GetFirst() && parent->GetSecond()) {
343 if (parent->GetFirst() == this)
344 parent->UnSplit("first");
345 else if (parent->GetSecond() == this)
346 parent->UnSplit("second");
347 }
348 }
349}
350////////////////////////////////////////////////////////////////////////////////
351/// Emit Undocked() signal.
352
354{
355 Emit("Docked(TGFrame*)", (Longptr_t)frame);
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Extract the frame contained in this split frame an reparent it in a
360/// transient frame. Keep a pointer on the transient frame to be able to
361/// swallow the child frame back to this.
362
364{
365 if (fFrame) {
367 fUndocked = new TGTransientFrame(gClient->GetDefaultRoot(), GetMainFrame(), 800, 600);
370 // Layout...
372 fUndocked->Layout();
375 fUndocked->Connect("CloseWindow()", "TGSplitFrame", this, "SwallowBack()");
377 }
378}
379
380////////////////////////////////////////////////////////////////////////////////
381/// Handles resize events for this frame.
382/// This is needed to keep as much as possible the sizes ratio between
383/// all subframes.
384
386{
387 if (!fFirst) {
388 // case of resizing a frame with the splitter (and not from parent)
390 TGSplitFrame *p = dynamic_cast<TGSplitFrame *>(w);
391 if (p) {
392 if (p->GetFirst()) {
393 // set the correct ratio for this child
394 Float_t hratio = (Float_t)p->GetFirst()->GetHeight() / (Float_t)p->GetHeight();
395 Float_t wratio = (Float_t)p->GetFirst()->GetWidth() / (Float_t)p->GetWidth();
396 p->SetHRatio(hratio);
397 p->SetWRatio(wratio);
398 }
399 }
400 return kTRUE;
401 }
402 // case of resize event comes from the parent (i.e. by rezing TGMainFrame)
403 if ((fHRatio > 0.0) && (fWRatio > 0.0)) {
408 }
409 // memorize the actual ratio for next resize event
412 fClient->NeedRedraw(this);
413 if (!gVirtualX->InheritsFrom("TGX11"))
414 Layout();
415 return kTRUE;
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Horizontally split the frame.
420
422{
423 // return if already split
424 if ((fSplitter != 0) || (fFirst != 0) || (fSecond != 0) || (fFrame != 0))
425 return;
426 UInt_t height = (h > 0) ? h : fHeight/2;
427 // set correct option (vertical frame)
429 // create first split frame with fixed height - required for the splitter
431 // create second split frame
433 // create horizontal splitter
434 fSplitter = new TGHSplitter(this, 4, 4);
435 // set the splitter's frame to the first one
437 fSplitter->Connect("ProcessedEvent(Event_t*)", "TGSplitFrame", this,
438 "OnSplitterClicked(Event_t*)");
439 // add all frames
445}
446
447////////////////////////////////////////////////////////////////////////////////
448/// Vertically split the frame.
449
451{
452 // return if already split
453 if ((fSplitter != 0) || (fFirst != 0) || (fSecond != 0) || (fFrame != 0))
454 return;
455 UInt_t width = (w > 0) ? w : fWidth/2;
456 // set correct option (horizontal frame)
458 // create first split frame with fixed width - required for the splitter
460 // create second split frame
462 // create vertical splitter
463 fSplitter = new TGVSplitter(this, 4, 4);
464 // set the splitter's frame to the first one
466 fSplitter->Connect("ProcessedEvent(Event_t*)", "TGSplitFrame", this,
467 "OnSplitterClicked(Event_t*)");
468 // add all frames
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Map this split frame in the small overview tooltip.
478
480{
481 Int_t px = 0, py = 0;
482 Int_t rx = 0, ry = 0;
483 Int_t cx, cy, cw, ch;
485 if (!fFirst && !fSecond) {
486 TGSplitFrame *parent = dynamic_cast<TGSplitFrame *>((TGFrame *)fParent);
487 if (parent && parent->fSecond == this) {
488 if (parent->GetOptions() & kVerticalFrame)
489 ry = parent->GetFirst()->GetHeight();
490 if (parent->GetOptions() & kHorizontalFrame)
491 rx = parent->GetFirst()->GetWidth();
492 }
493 gVirtualX->TranslateCoordinates(GetId(), top->GetId(),
494 fX, fY, px, py, wtarget);
495 cx = ((px-rx)/10)+2;
496 cy = ((py-ry)/10)+2;
497 cw = (fWidth/10)-4;
498 ch = (fHeight/10)-4;
499 top->GetSplitTool()->AddRectangle(this, cx, cy, cw, ch);
500 return;
501 }
502 if (fFirst)
504 if (fSecond)
506}
507
508////////////////////////////////////////////////////////////////////////////////
509/// Handle mouse click events on the splitter.
510
512{
513 Int_t px = 0, py = 0;
515 if (event->fType != kButtonPress)
516 return;
517 if (event->fCode != kButton3)
518 return;
519 gVirtualX->TranslateCoordinates(event->fWindow,
520 gClient->GetDefaultRoot()->GetId(),
521 event->fX, event->fY, px, py, wtarget);
522 TGSplitFrame *top = GetTopFrame();
523 top->GetSplitTool()->Reset();
524 top->GetSplitTool()->Resize(1+top->GetWidth()/10, 1+top->GetHeight()/10);
525 top->MapToSPlitTool(top);
526 top->GetSplitTool()->Show(px, py);
527}
528
529////////////////////////////////////////////////////////////////////////////////
530/// Horizontally split the frame, and if it contains a child frame, ask
531/// the user where to keep it (top or bottom). This is the method used
532/// via the context menu.
533
535{
536 char side[200];
537 snprintf(side, 200, "top");
538 if (fFrame) {
539 new TGInputDialog(gClient->GetRoot(), GetTopFrame(),
540 "In which side the actual frame has to be kept (top / bottom)",
541 side, side);
542 if ( strcmp(side, "") == 0 ) // Cancel button was pressed
543 return;
544 }
545 SplitHorizontal(side);
546}
547
548////////////////////////////////////////////////////////////////////////////////
549/// Horizontally split the frame, and if it contains a child frame, ask
550/// the user where to keep it (top or bottom). This method is the actual
551/// implementation.
552
553void TGSplitFrame::SplitHorizontal(const char *side)
554{
555 if (fFrame) {
556 TGFrame *frame = fFrame;
557 frame->UnmapWindow();
558 frame->ReparentWindow(gClient->GetDefaultRoot());
560 HSplit();
561 if (!strcmp(side, "top")) {
562 frame->ReparentWindow(GetFirst());
564 }
565 else if (!strcmp(side, "bottom")) {
566 frame->ReparentWindow(GetSecond());
568 }
569 }
570 else {
571 HSplit();
572 }
574 Layout();
575}
576
577////////////////////////////////////////////////////////////////////////////////
578/// Vertically split the frame, and if it contains a child frame, ask
579/// the user where to keep it (left or right). This is the method used
580/// via the context menu.
581
583{
584 char side[200];
585 snprintf(side, 200, "left");
586 if (fFrame) {
587 new TGInputDialog(gClient->GetRoot(), GetTopFrame(),
588 "In which side the actual frame has to be kept (left / right)",
589 side, side);
590 if ( strcmp(side, "") == 0 ) // Cancel button was pressed
591 return;
592 }
593 SplitVertical(side);
594}
595
596////////////////////////////////////////////////////////////////////////////////
597/// Vertically split the frame, and if it contains a child frame, ask
598/// the user where to keep it (left or right). This method is the actual
599/// implementation.
600
601void TGSplitFrame::SplitVertical(const char *side)
602{
603 if (fFrame) {
604 TGFrame *frame = fFrame;
605 frame->UnmapWindow();
606 frame->ReparentWindow(gClient->GetDefaultRoot());
608 VSplit();
609 if (!strcmp(side, "left")) {
610 frame->ReparentWindow(GetFirst());
612 }
613 else if (!strcmp(side, "right")) {
614 frame->ReparentWindow(GetSecond());
616 }
617 }
618 else {
619 VSplit();
620 }
622 Layout();
623}
624
625////////////////////////////////////////////////////////////////////////////////
626/// Swallow back the child frame previously extracted, and close its
627/// parent (transient frame).
628
630{
631 if (!fUndocked) {
632 fUndocked = dynamic_cast<TGTransientFrame *>((TQObject*)gTQSender);
633 }
634 if (fUndocked) {
635 TGFrameElement *el = dynamic_cast<TGFrameElement*>(fUndocked->GetList()->First());
636 if (!el || !el->fFrame) return;
637 TGSplitFrame *frame = (TGSplitFrame *)el->fFrame;
638 frame->UnmapWindow();
639 fUndocked->RemoveFrame(frame);
640 frame->ReparentWindow(this);
642 // Layout...
644 Layout();
646 fUndocked = 0;
647 Docked(frame);
648 }
649}
650
651////////////////////////////////////////////////////////////////////////////////
652/// Switch (exchange) two frames.
653/// frame is the source, dest is the destination (the new parent)
654/// prev is the frame that has to be exchanged with the source
655/// (the one actually in the destination)
656
658 TGFrame *prev)
659{
660 // get parent of the source (its container)
661 TGCompositeFrame *parent = (TGCompositeFrame *)frame->GetParent();
662
663 // unmap the window (to avoid flickering)
664 prev->UnmapWindow();
665 // remove it from the destination frame
666 dest->RemoveFrame(prev);
667 // temporary reparent it to root (desktop window)
668 prev->ReparentWindow(gClient->GetDefaultRoot());
669
670 // now unmap the source window (still to avoid flickering)
671 frame->UnmapWindow();
672 // remove it from its parent (its container)
673 parent->RemoveFrame(frame);
674 // reparent it to the target location
675 frame->ReparentWindow(dest);
676 // add it to its new parent (for layout managment)
677 dest->AddFrame(frame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
678 // Layout...
679 frame->Resize(dest->GetDefaultSize());
680 dest->MapSubwindows();
681 dest->Layout();
682
683 // now put back the previous one in the previous source parent
684 // reparent to the previous source container
685 prev->ReparentWindow(parent);
686 // add it to the frame (for layout managment)
688 // Layout...
689 prev->Resize(parent->GetDefaultSize());
690 parent->MapSubwindows();
691 parent->Layout();
692}
693
694////////////////////////////////////////////////////////////////////////////////
695/// Switch the actual embedded frame to the main (first) split frame.
696
698{
701 TGFrame *prev = (TGFrame *)(dest->GetFrame());
702 if ((source != prev) && (source != dest))
703 SwitchFrames(source, dest, prev);
704}
705
706////////////////////////////////////////////////////////////////////////////////
707/// Emit Undocked() signal.
708
710{
711 Emit("Undocked(TGFrame*)", (Longptr_t)frame);
712}
713
714////////////////////////////////////////////////////////////////////////////////
715/// Close (unmap and remove from the list of frames) the frame contained in
716/// this split frame.
717
719{
721 TGSplitFrame *kframe = 0, *dframe = 0;
722 if (!strcmp(which, "first")) {
723 dframe = GetFirst();
724 kframe = GetSecond();
725 }
726 else if (!strcmp(which, "second")) {
727 dframe = GetSecond();
728 kframe = GetFirst();
729 }
730 if (!kframe || !dframe)
731 return;
732 keepframe = (TGCompositeFrame *)kframe->GetFrame();
733 if (keepframe) {
734 keepframe->UnmapWindow();
735 keepframe->ReparentWindow(gClient->GetDefaultRoot());
736 kframe->RemoveFrame(keepframe);
737 }
738 Cleanup();
739 if (keepframe) {
740 keepframe->ReparentWindow(this);
742 }
744 Layout();
745}
746
747////////////////////////////////////////////////////////////////////////////////
748/// Save a splittable frame as a C++ statement(s) on output stream out.
749
750void TGSplitFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
751{
752 // save options and color if not default
753 auto extra_args = SaveCtorArgs(out);
754
755 out << "\n // splittable frame\n";
756 out << " TGSplitFrame *" << GetName() << " = new TGSplitFrame(" << fParent->GetName() << "," << GetWidth() << ","
757 << GetHeight() << extra_args << ");\n";
758
759 if (option && strstr(option, "keep_names"))
760 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
761
762 // setting layout manager if it differs from the main frame type
763 // coverity[returned_null]
764 // coverity[dereference]
766 if (!((GetOptions() & kHorizontalFrame) && lm->InheritsFrom(TGHorizontalLayout::Class())) &&
767 !((GetOptions() & kVerticalFrame) && lm->InheritsFrom(TGVerticalLayout::Class()))) {
768 out << " " << GetName() << "->SetLayoutManager(";
769 lm->SavePrimitive(out, option);
770 out << ");\n";
771 }
772
774}
@ kButtonPress
Definition GuiTypes.h:60
const Mask_t kWAOverrideRedirect
Definition GuiTypes.h:149
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
const Mask_t kWASaveUnder
Definition GuiTypes.h:150
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kRaisedFrame
Definition GuiTypes.h:384
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
@ kFixedSize
Definition GuiTypes.h:390
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
@ kFillSolid
Definition GuiTypes.h:51
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
@ kButton3
Definition GuiTypes.h:214
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gClient
Definition TGClient.h:157
@ kLocalCleanup
Definition TGFrame.h:41
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gVirtualX
Definition TVirtualX.h:337
T1 fFirst
Definition X11Events.mm:86
T2 fSecond
Definition X11Events.mm:87
#define snprintf
Definition civetweb.c:1579
Describes one element of the context menu associated to a class The menu item may describe.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
TList * GetMenuList() const
Return the list of menu items associated with the class.
Definition TClass.cxx:4368
void MakeCustomMenuList()
Makes a customizable version of the popup menu list, i.e.
Definition TClass.cxx:4310
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2973
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
This class provides an interface to context sensitive popup menus.
virtual void Popup(Int_t x, Int_t y, TObject *obj, TVirtualPad *c=nullptr, TVirtualPad *p=nullptr)
Popup context menu at given location in canvas c and pad p for selected object.
virtual TContextMenuImp * GetContextMenuImp()
const TGResourcePool * GetResourcePool() const
Definition TGClient.h:124
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:380
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
virtual TList * GetList() const
Definition TGFrame.h:312
virtual TGLayoutManager * GetLayoutManager() const
Definition TGFrame.h:340
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:959
virtual void SavePrimitiveSubframes(std::ostream &out, Option_t *option="")
Auxiliary protected method used to save subframes.
Definition TGFrame.cxx:2641
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1249
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1064
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1141
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1035
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:331
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:727
Int_t fX
frame x position
Definition TGFrame.h:85
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
UInt_t fHeight
frame height
Definition TGFrame.h:88
void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0) override
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGFrame.h:204
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:304
void MapWindow() override
map window
Definition TGFrame.h:206
void Move(Int_t x, Int_t y) override
Move frame.
Definition TGFrame.cxx:585
virtual UInt_t GetOptions() const
Definition TGFrame.h:199
Int_t fY
frame y position
Definition TGFrame.h:86
void UnmapWindow() override
unmap window
Definition TGFrame.h:208
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:757
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:227
TString SaveCtorArgs(std::ostream &out, UInt_t dflt_options=kChildFrame, Bool_t check_white_pixel=kFALSE)
Return options and custom color as constructor args Used in the SavePrimitive methods,...
Definition TGFrame.cxx:2493
virtual void SetWidth(UInt_t w)
Definition TGFrame.h:248
UInt_t GetWidth() const
Definition TGFrame.h:226
virtual void SetHeight(UInt_t h)
Definition TGFrame.h:249
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:767
void SetFillStyle(Int_t v)
Set fill style (kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled).
Definition TGGC.cxx:344
void SetForeground(Pixel_t v)
Set foreground color.
Definition TGGC.cxx:277
static TClass * Class()
Input Dialog Widget.
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
Frame layout manager.
Definition TGLayout.h:135
virtual void CloseWindow()
Close and delete main frame.
Definition TGFrame.cxx:1762
TGClient * fClient
Connection to display server.
Definition TGObject.h:25
Handle_t GetId() const
Definition TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:24
This class creates a popup menu object.
Definition TGMenu.h:110
A split frame.
void MapToSPlitTool(TGSplitFrame *top)
Map this split frame in the small overview tooltip.
Bool_t HandleConfigureNotify(Event_t *) override
Handles resize events for this frame.
virtual void VSplit(UInt_t w=0)
Vertically split the frame.
void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr) override
Add a frame in the split frame using layout hints l.
TGSplitFrame * GetFirst() const
void Cleanup() override
Recursively cleanup child frames.
void OnSplitterClicked(Event_t *event)
Handle mouse click events on the splitter.
void SplitVertical(const char *side="left")
Vertically split the frame, and if it contains a child frame, ask the user where to keep it (left or ...
void SwitchToMain()
Switch the actual embedded frame to the main (first) split frame.
TGSplitFrame * fSecond
Pointer to the second child (if any)
TGSplitTool * GetSplitTool() const
virtual void HSplit(UInt_t h=0)
Horizontally split the frame.
TGSplitFrame * GetTopFrame()
Return the top level split frame.
TGSplitFrame(const TGSplitFrame &)=delete
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a splittable frame as a C++ statement(s) on output stream out.
void SwallowBack()
Swallow back the child frame previously extracted, and close its parent (transient frame).
TGSplitTool * fSplitTool
SplitFrame Tool.
void RemoveFrame(TGFrame *f) override
Add a frame in the split frame using layout hints l.
TGTransientFrame * fUndocked
Main frame used when "undocking" frame.
TGSplitter * fSplitter
Pointer to the (H/V) Splitter (if any)
void Docked(TGFrame *frame)
Emit Undocked() signal.
void Undocked(TGFrame *frame)
Emit Undocked() signal.
TGFrame * fFrame
Pointer to the embedded frame (if any)
static void SwitchFrames(TGFrame *frame, TGCompositeFrame *dest, TGFrame *prev)
Switch (exchange) two frames.
void Close()
Close (unmap and remove from the list of frames) the frame contained in this split frame.
TGSplitFrame * fFirst
Pointer to the first child (if any)
Float_t fHRatio
Height ratio between the first child and this.
void SplitHorizontal(const char *side="top")
Horizontally split the frame, and if it contains a child frame, ask the user where to keep it (top or...
Float_t fWRatio
Width ratio between the first child and this.
~TGSplitFrame() override
Destructor. Make cleanup.
TGSplitFrame * GetSecond() const
void ExtractFrame()
Extract the frame contained in this split frame an reparent it in a transient frame.
void SplitVer()
Vertically split the frame, and if it contains a child frame, ask the user where to keep it (left or ...
void UnSplit(const char *which)
Close (unmap and remove from the list of frames) the frame contained in this split frame.
void CloseAndCollapse()
Close (unmap, remove from the list of frames and destroy) the frame contained in this split frame.
void SplitHor()
Horizontally split the frame, and if it contains a child frame, ask the user where to keep it (top or...
A split frame tool tip.
void DoRedraw() override
Redraw split frame tool.
Int_t fX
X position in fWindow where to popup.
Bool_t HandleMotion(Event_t *event) override
handle mouse motion events
Int_t fY
Y position in fWindow where to popup.
void Show(Int_t x, Int_t y)
Show tool window.
TGGC fRectGC
rectangles drawing context
TGSplitTool(const TGSplitTool &)=delete
void DrawBorder() override
Draw border of tool window.
void AddRectangle(TGFrame *frm, Int_t x, Int_t y, Int_t w, Int_t h)
Add a rectangle representation of a split frame in the map, together with the frame itself.
~TGSplitTool() override
TGSplitTool destructor.
void SetPosition(Int_t x, Int_t y)
Set popup position within specified frame (as specified in the ctor).
void Reset()
Reset tool tip popup delay timer.
const TGFrame * fWindow
frame to which tool tip is associated
TMap fMap
map of rectangles/subframes
void Hide()
Hide tool window. Use this method to hide the tool in a client class.
Bool_t HandleButton(Event_t *event) override
Handle mouse click events in the tool.
TContextMenu * fContextMenu
Context menu for the splitter.
virtual void SetFrame(TGFrame *frame, Bool_t prev)=0
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:500
static TClass * Class()
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:150
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
const TGWindow * GetParent() const
Definition TGWindow.h:83
virtual void RaiseWindow()
raise window
Definition TGWindow.cxx:206
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:334
A doubly linked list.
Definition TList.h:38
Iterator of map.
Definition TMap.h:144
void Delete(Option_t *option="") override
Remove all (key,value) pairs from the map AND delete the keys when they are allocated on the heap.
Definition TMap.cxx:133
void Add(TObject *obj) override
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
Definition TMap.cxx:53
virtual void SetOwnerValue(Bool_t enable=kTRUE)
Set whether this map is the owner (enable==true) of its values.
Definition TMap.cxx:340
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition TMap.cxx:235
Mother of all ROOT objects.
Definition TObject.h:41
SCoord_t fY
Definition TPoint.h:36
SCoord_t fX
Definition TPoint.h:35
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition TQObject.h:48
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:865
This class provides an interface to context sensitive popup menus.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Window_t fWindow
window reported event is relative to
Definition GuiTypes.h:176
Int_t fX
Definition GuiTypes.h:178
UInt_t fCode
key or button code
Definition GuiTypes.h:180
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:93
TLine l
Definition textangle.C:4