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
44
45////////////////////////////////////////////////////////////////////////////////
46/// Create a split frame tool tip. P is the tool tips parent window (normally
47/// fClient->GetRoot() and f is the frame to which the tool tip is associated.
48
51{
55 attr.fSaveUnder = kTRUE;
56
57 gVirtualX->ChangeWindowAttributes(fId, &attr);
59
61 fRectGC.SetForeground(0x99ff99);
62
63 TClass *cl = TClass::GetClass("TGSplitFrame");
65 TList *ml = cl->GetMenuList();
66 ((TClassMenuItem *)ml->At(1))->SetTitle("Cleanup Frame");
67 ((TClassMenuItem *)ml->At(2))->SetTitle("Close and Collapse");
68 ((TClassMenuItem *)ml->At(3))->SetTitle("Undock Frame");
69 ((TClassMenuItem *)ml->At(4))->SetTitle("Dock Frame Back");
70 ((TClassMenuItem *)ml->At(5))->SetTitle("Switch to Main");
71 ((TClassMenuItem *)ml->At(6))->SetTitle("Horizontally Split...");
72 ((TClassMenuItem *)ml->At(7))->SetTitle("Vertically Split...");
73 fContextMenu = new TContextMenu("SplitFrameContextMenu", "Actions");
77 if (f) Resize(f->GetWidth()/10, f->GetHeight()/10);
79
80 fWindow = f;
81 fX = fY = -1;
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// TGSplitTool destructor.
86
88{
89 delete fContextMenu;
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Add a rectangle representation of a split frame in the map, together
94/// with the frame itself.
95
97{
98 TGRectMap *rect = new TGRectMap(x, y, w, h);
99 fMap.Add(rect, frame);
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// Redraw split frame tool.
104
106{
107 TGRectMap *rect;
108 TMapIter next(&fMap);
109 while ((rect = (TGRectMap*)next())) {
110 gVirtualX->FillRectangle(fId, GetBckgndGC()(), rect->fX,
111 rect->fY, rect->fW, rect->fH);
112 gVirtualX->DrawRectangle(fId, GetBlackGC()(), rect->fX, rect->fY,
113 rect->fW, rect->fH);
114 }
115 DrawBorder();
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// Draw border of tool window.
120
122{
123 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
124 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
125 gVirtualX->DrawLine(fId, GetBlackGC()(), 0, fHeight-1, fWidth-1, fHeight-1);
126 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth-1, fHeight-1, fWidth-1, 0);
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Handle mouse click events in the tool.
131
133{
134 if (event->fType != kButtonPress)
135 return kTRUE;
136 Int_t px = 0, py = 0;
137 Window_t wtarget;
138 TGRectMap *rect;
139 TGSplitFrame *frm = 0;
140 TMapIter next(&fMap);
141 while ((rect = (TGRectMap*)next())) {
142 if (rect->Contains(event->fX, event->fY)) {
143 frm = (TGSplitFrame *)fMap.GetValue((const TObject *)rect);
144 gVirtualX->TranslateCoordinates(event->fWindow,
145 gClient->GetDefaultRoot()->GetId(),
146 event->fX, event->fY, px, py, wtarget);
147 fContextMenu->Popup(px, py, frm);
148 // connect PoppedDown signal to close the tool window
149 // when the menu is closed
151 ((TGPopupMenu *)menu)->Connect("PoppedDown()", "TGSplitTool", this, "Hide()");
152 return kTRUE;
153 }
154 }
155 Hide();
156 return kTRUE;
157}
158
159////////////////////////////////////////////////////////////////////////////////
160/// handle mouse motion events
161
163{
164 static TGRectMap *rect = 0, *oldrect = 0;
165 TMapIter next(&fMap);
166 while ((rect = (TGRectMap*)next())) {
167 if (rect->Contains(event->fX, event->fY)) {
168 // if inside a rectangle, highlight it
169 if (rect != oldrect) {
170 if (oldrect) {
171 gVirtualX->FillRectangle(fId, GetBckgndGC()(), oldrect->fX,
172 oldrect->fY, oldrect->fW, oldrect->fH);
173 gVirtualX->DrawRectangle(fId, GetBlackGC()(), oldrect->fX, oldrect->fY,
174 oldrect->fW, oldrect->fH);
175 }
176 gVirtualX->FillRectangle(fId, fRectGC(), rect->fX, rect->fY, rect->fW,
177 rect->fH);
178 gVirtualX->DrawRectangle(fId, GetBlackGC()(), rect->fX, rect->fY,
179 rect->fW, rect->fH);
180 oldrect = rect;
181 }
182 return kTRUE;
183 }
184 }
185 if (oldrect) {
186 gVirtualX->FillRectangle(fId, GetBckgndGC()(), oldrect->fX,
187 oldrect->fY, oldrect->fW, oldrect->fH);
188 gVirtualX->DrawRectangle(fId, GetBlackGC()(), oldrect->fX, oldrect->fY,
189 oldrect->fW, oldrect->fH);
190 }
191 return kTRUE;
192}
193////////////////////////////////////////////////////////////////////////////////
194/// Hide tool window. Use this method to hide the tool in a client class.
195
197{
198 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
199 fMap.Delete();
200 UnmapWindow();
201}
202
203////////////////////////////////////////////////////////////////////////////////
204/// Reset tool tip popup delay timer. Use this method to activate tool tip
205/// in a client class.
206
208{
209 fMap.Delete();
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Set popup position within specified frame (as specified in the ctor).
214/// To get back default behaviour (in the middle just below the designated
215/// frame) set position to -1,-1.
216
218{
219 fX = x;
220 fY = y;
221
222 if (fX < -1)
223 fX = 0;
224 if (fY < -1)
225 fY = 0;
226
227 if (fWindow) {
228 if (fX > (Int_t) fWindow->GetWidth())
229 fX = fWindow->GetWidth();
230 if (fY > (Int_t) fWindow->GetHeight())
231 fY = fWindow->GetHeight();
232 }
233}
234
235////////////////////////////////////////////////////////////////////////////////
236/// Show tool window.
237
239{
240 Move(x, y);
241 MapWindow();
242 RaiseWindow();
243
244 // last argument kFALSE forces all specified events to this window
247 kTRUE, kFALSE);
248 // Long_t args[2];
249 // args[0] = x;
250 // args[1] = y;
251}
252
253////////////////////////////////////////////////////////////////////////////////
254/// Default constructor.
255
257 UInt_t options) : TGCompositeFrame(p, w, h, options),
258 fFrame(0), fSplitter(0), fFirst(0), fSecond(0)
259{
260 fSplitTool = new TGSplitTool(gClient->GetDefaultRoot(), this);
261 fHRatio = fWRatio = 0.0;
262 fUndocked = 0;
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// Destructor. Make cleanup.
269
271{
272 delete fSplitTool;
273 Cleanup();
274}
275
276////////////////////////////////////////////////////////////////////////////////
277/// Add a frame in the split frame using layout hints l.
278
280{
282 fFrame = f;
283}
284
285////////////////////////////////////////////////////////////////////////////////
286/// Add a frame in the split frame using layout hints l.
287
289{
291 if (f == fFrame)
292 fFrame = 0;
293}
294
295////////////////////////////////////////////////////////////////////////////////
296/// Recursively cleanup child frames.
297
299{
301 fFirst = 0;
302 fSecond = 0;
303 fSplitter = 0;
304 fUndocked = 0;
305}
306
307////////////////////////////////////////////////////////////////////////////////
308/// Return the top level split frame.
309
311{
312 TGSplitFrame *top = this;
313 TGWindow *w = (TGWindow *)GetParent();
314 TGSplitFrame *p = dynamic_cast<TGSplitFrame *>(w);
315 while (p) {
316 top = p;
317 w = (TGWindow *)p->GetParent();
318 p = dynamic_cast<TGSplitFrame *>(w);
319 }
320 return top;
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// Close (unmap and remove from the list of frames) the frame contained in
325/// this split frame.
326
328{
329 if (fFrame) {
332 }
333 fFrame = 0;
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Close (unmap, remove from the list of frames and destroy) the frame
338/// contained in this split frame. Then unsplit the parent frame.
339
341{
342 if (!fSplitter || !fFirst || !fSecond) {
343 TGSplitFrame *parent = (TGSplitFrame *)GetParent();
344 if (parent->GetFirst() && parent->GetSecond()) {
345 if (parent->GetFirst() == this)
346 parent->UnSplit("first");
347 else if (parent->GetSecond() == this)
348 parent->UnSplit("second");
349 }
350 }
351}
352////////////////////////////////////////////////////////////////////////////////
353/// Emit Undocked() signal.
354
356{
357 Emit("Docked(TGFrame*)", (Longptr_t)frame);
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// Extract the frame contained in this split frame an reparent it in a
362/// transient frame. Keep a pointer on the transient frame to be able to
363/// swallow the child frame back to this.
364
366{
367 if (fFrame) {
369 fUndocked = new TGTransientFrame(gClient->GetDefaultRoot(), GetMainFrame(), 800, 600);
372 // Layout...
374 fUndocked->Layout();
377 fUndocked->Connect("CloseWindow()", "TGSplitFrame", this, "SwallowBack()");
379 }
380}
381
382////////////////////////////////////////////////////////////////////////////////
383/// Handles resize events for this frame.
384/// This is needed to keep as much as possible the sizes ratio between
385/// all subframes.
386
388{
389 if (!fFirst) {
390 // case of resizing a frame with the splitter (and not from parent)
391 TGWindow *w = (TGWindow *)GetParent();
392 TGSplitFrame *p = dynamic_cast<TGSplitFrame *>(w);
393 if (p) {
394 if (p->GetFirst()) {
395 // set the correct ratio for this child
396 Float_t hratio = (Float_t)p->GetFirst()->GetHeight() / (Float_t)p->GetHeight();
397 Float_t wratio = (Float_t)p->GetFirst()->GetWidth() / (Float_t)p->GetWidth();
398 p->SetHRatio(hratio);
399 p->SetWRatio(wratio);
400 }
401 }
402 return kTRUE;
403 }
404 // case of resize event comes from the parent (i.e. by rezing TGMainFrame)
405 if ((fHRatio > 0.0) && (fWRatio > 0.0)) {
410 }
411 // memorize the actual ratio for next resize event
414 fClient->NeedRedraw(this);
415 if (!gVirtualX->InheritsFrom("TGX11"))
416 Layout();
417 return kTRUE;
418}
419
420////////////////////////////////////////////////////////////////////////////////
421/// Horizontally split the frame.
422
424{
425 // return if already split
426 if ((fSplitter != 0) || (fFirst != 0) || (fSecond != 0) || (fFrame != 0))
427 return;
428 UInt_t height = (h > 0) ? h : fHeight/2;
429 // set correct option (vertical frame)
431 // create first split frame with fixed height - required for the splitter
432 fFirst = new TGSplitFrame(this, fWidth, height, kSunkenFrame | kFixedHeight);
433 // create second split frame
434 fSecond = new TGSplitFrame(this, fWidth, height, kSunkenFrame);
435 // create horizontal splitter
436 fSplitter = new TGHSplitter(this, 4, 4);
437 // set the splitter's frame to the first one
439 fSplitter->Connect("ProcessedEvent(Event_t*)", "TGSplitFrame", this,
440 "OnSplitterClicked(Event_t*)");
441 // add all frames
447}
448
449////////////////////////////////////////////////////////////////////////////////
450/// Vertically split the frame.
451
453{
454 // return if already split
455 if ((fSplitter != 0) || (fFirst != 0) || (fSecond != 0) || (fFrame != 0))
456 return;
457 UInt_t width = (w > 0) ? w : fWidth/2;
458 // set correct option (horizontal frame)
460 // create first split frame with fixed width - required for the splitter
462 // create second split frame
464 // create vertical splitter
465 fSplitter = new TGVSplitter(this, 4, 4);
466 // set the splitter's frame to the first one
468 fSplitter->Connect("ProcessedEvent(Event_t*)", "TGSplitFrame", this,
469 "OnSplitterClicked(Event_t*)");
470 // add all frames
476}
477
478////////////////////////////////////////////////////////////////////////////////
479/// Map this split frame in the small overview tooltip.
480
482{
483 Int_t px = 0, py = 0;
484 Int_t rx = 0, ry = 0;
485 Int_t cx, cy, cw, ch;
486 Window_t wtarget;
487 if (!fFirst && !fSecond) {
488 TGSplitFrame *parent = dynamic_cast<TGSplitFrame *>((TGFrame *)fParent);
489 if (parent && parent->fSecond == this) {
490 if (parent->GetOptions() & kVerticalFrame)
491 ry = parent->GetFirst()->GetHeight();
492 if (parent->GetOptions() & kHorizontalFrame)
493 rx = parent->GetFirst()->GetWidth();
494 }
495 gVirtualX->TranslateCoordinates(GetId(), top->GetId(),
496 fX, fY, px, py, wtarget);
497 cx = ((px-rx)/10)+2;
498 cy = ((py-ry)/10)+2;
499 cw = (fWidth/10)-4;
500 ch = (fHeight/10)-4;
501 top->GetSplitTool()->AddRectangle(this, cx, cy, cw, ch);
502 return;
503 }
504 if (fFirst)
506 if (fSecond)
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Handle mouse click events on the splitter.
512
514{
515 Int_t px = 0, py = 0;
516 Window_t wtarget;
517 if (event->fType != kButtonPress)
518 return;
519 if (event->fCode != kButton3)
520 return;
521 gVirtualX->TranslateCoordinates(event->fWindow,
522 gClient->GetDefaultRoot()->GetId(),
523 event->fX, event->fY, px, py, wtarget);
524 TGSplitFrame *top = GetTopFrame();
525 top->GetSplitTool()->Reset();
526 top->GetSplitTool()->Resize(1+top->GetWidth()/10, 1+top->GetHeight()/10);
527 top->MapToSPlitTool(top);
528 top->GetSplitTool()->Show(px, py);
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Horizontally split the frame, and if it contains a child frame, ask
533/// the user where to keep it (top or bottom). This is the method used
534/// via the context menu.
535
537{
538 char side[200];
539 snprintf(side, 200, "top");
540 if (fFrame) {
541 new TGInputDialog(gClient->GetRoot(), GetTopFrame(),
542 "In which side the actual frame has to be kept (top / bottom)",
543 side, side);
544 if ( strcmp(side, "") == 0 ) // Cancel button was pressed
545 return;
546 }
547 SplitHorizontal(side);
548}
549
550////////////////////////////////////////////////////////////////////////////////
551/// Horizontally split the frame, and if it contains a child frame, ask
552/// the user where to keep it (top or bottom). This method is the actual
553/// implementation.
554
555void TGSplitFrame::SplitHorizontal(const char *side)
556{
557 if (fFrame) {
558 TGFrame *frame = fFrame;
559 frame->UnmapWindow();
560 frame->ReparentWindow(gClient->GetDefaultRoot());
562 HSplit();
563 if (!strcmp(side, "top")) {
564 frame->ReparentWindow(GetFirst());
566 }
567 else if (!strcmp(side, "bottom")) {
568 frame->ReparentWindow(GetSecond());
570 }
571 }
572 else {
573 HSplit();
574 }
576 Layout();
577}
578
579////////////////////////////////////////////////////////////////////////////////
580/// Vertically split the frame, and if it contains a child frame, ask
581/// the user where to keep it (left or right). This is the method used
582/// via the context menu.
583
585{
586 char side[200];
587 snprintf(side, 200, "left");
588 if (fFrame) {
589 new TGInputDialog(gClient->GetRoot(), GetTopFrame(),
590 "In which side the actual frame has to be kept (left / right)",
591 side, side);
592 if ( strcmp(side, "") == 0 ) // Cancel button was pressed
593 return;
594 }
595 SplitVertical(side);
596}
597
598////////////////////////////////////////////////////////////////////////////////
599/// Vertically split the frame, and if it contains a child frame, ask
600/// the user where to keep it (left or right). This method is the actual
601/// implementation.
602
603void TGSplitFrame::SplitVertical(const char *side)
604{
605 if (fFrame) {
606 TGFrame *frame = fFrame;
607 frame->UnmapWindow();
608 frame->ReparentWindow(gClient->GetDefaultRoot());
610 VSplit();
611 if (!strcmp(side, "left")) {
612 frame->ReparentWindow(GetFirst());
614 }
615 else if (!strcmp(side, "right")) {
616 frame->ReparentWindow(GetSecond());
618 }
619 }
620 else {
621 VSplit();
622 }
624 Layout();
625}
626
627////////////////////////////////////////////////////////////////////////////////
628/// Swallow back the child frame previously extracted, and close its
629/// parent (transient frame).
630
632{
633 if (!fUndocked) {
634 fUndocked = dynamic_cast<TGTransientFrame *>((TQObject*)gTQSender);
635 }
636 if (fUndocked) {
637 TGFrameElement *el = dynamic_cast<TGFrameElement*>(fUndocked->GetList()->First());
638 if (!el || !el->fFrame) return;
639 TGSplitFrame *frame = (TGSplitFrame *)el->fFrame;
640 frame->UnmapWindow();
641 fUndocked->RemoveFrame(frame);
642 frame->ReparentWindow(this);
644 // Layout...
646 Layout();
648 fUndocked = 0;
649 Docked(frame);
650 }
651}
652
653////////////////////////////////////////////////////////////////////////////////
654/// Switch (exchange) two frames.
655/// frame is the source, dest is the destination (the new parent)
656/// prev is the frame that has to be exchanged with the source
657/// (the one actually in the destination)
658
660 TGFrame *prev)
661{
662 // get parent of the source (its container)
663 TGCompositeFrame *parent = (TGCompositeFrame *)frame->GetParent();
664
665 // unmap the window (to avoid flickering)
666 prev->UnmapWindow();
667 // remove it from the destination frame
668 dest->RemoveFrame(prev);
669 // temporary reparent it to root (desktop window)
670 prev->ReparentWindow(gClient->GetDefaultRoot());
671
672 // now unmap the source window (still to avoid flickering)
673 frame->UnmapWindow();
674 // remove it from its parent (its container)
675 parent->RemoveFrame(frame);
676 // reparent it to the target location
677 frame->ReparentWindow(dest);
678 // add it to its new parent (for layout managment)
679 dest->AddFrame(frame, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
680 // Layout...
681 frame->Resize(dest->GetDefaultSize());
682 dest->MapSubwindows();
683 dest->Layout();
684
685 // now put back the previous one in the previous source parent
686 // reparent to the previous source container
687 prev->ReparentWindow(parent);
688 // add it to the frame (for layout managment)
690 // Layout...
691 prev->Resize(parent->GetDefaultSize());
692 parent->MapSubwindows();
693 parent->Layout();
694}
695
696////////////////////////////////////////////////////////////////////////////////
697/// Switch the actual embedded frame to the main (first) split frame.
698
700{
701 TGFrame *source = fFrame;
703 TGFrame *prev = (TGFrame *)(dest->GetFrame());
704 if ((source != prev) && (source != dest))
705 SwitchFrames(source, dest, prev);
706}
707
708////////////////////////////////////////////////////////////////////////////////
709/// Emit Undocked() signal.
710
712{
713 Emit("Undocked(TGFrame*)", (Longptr_t)frame);
714}
715
716////////////////////////////////////////////////////////////////////////////////
717/// Close (unmap and remove from the list of frames) the frame contained in
718/// this split frame.
719
720void TGSplitFrame::UnSplit(const char *which)
721{
722 TGCompositeFrame *keepframe = 0;
723 TGSplitFrame *kframe = 0, *dframe = 0;
724 if (!strcmp(which, "first")) {
725 dframe = GetFirst();
726 kframe = GetSecond();
727 }
728 else if (!strcmp(which, "second")) {
729 dframe = GetSecond();
730 kframe = GetFirst();
731 }
732 if (!kframe || !dframe)
733 return;
734 keepframe = (TGCompositeFrame *)kframe->GetFrame();
735 if (keepframe) {
736 keepframe->UnmapWindow();
737 keepframe->ReparentWindow(gClient->GetDefaultRoot());
738 kframe->RemoveFrame(keepframe);
739 }
740 Cleanup();
741 if (keepframe) {
742 keepframe->ReparentWindow(this);
744 }
746 Layout();
747}
748
749////////////////////////////////////////////////////////////////////////////////
750/// Save a splittable frame as a C++ statement(s) on output stream out.
751
752void TGSplitFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
753{
755
756 out << std::endl << " // splittable frame" << std::endl;
757 out << " TGSplitFrame *";
758 out << GetName() << " = new TGSplitFrame(" << fParent->GetName()
759 << "," << GetWidth() << "," << GetHeight();
760
762 if (!GetOptions()) {
763 out << ");" << std::endl;
764 } else {
765 out << "," << GetOptionString() <<");" << std::endl;
766 }
767 } else {
768 out << "," << GetOptionString() << ",ucolor);" << std::endl;
769 }
770 if (option && strstr(option, "keep_names"))
771 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
772
773 // setting layout manager if it differs from the main frame type
774 // coverity[returned_null]
775 // coverity[dereference]
777 if ((GetOptions() & kHorizontalFrame) &&
778 (lm->InheritsFrom(TGHorizontalLayout::Class()))) {
779 ;
780 } else if ((GetOptions() & kVerticalFrame) &&
781 (lm->InheritsFrom(TGVerticalLayout::Class()))) {
782 ;
783 } else {
784 out << " " << GetName() <<"->SetLayoutManager(";
785 lm->SavePrimitive(out, option);
786 out << ");"<< std::endl;
787 }
788
789 SavePrimitiveSubframes(out, option);
790}
@ kButtonPress
Definition GuiTypes.h:60
const Mask_t kWAOverrideRedirect
Definition GuiTypes.h:149
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
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
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
long Longptr_t
Definition RtypesCore.h:82
const Bool_t kFALSE
Definition RtypesCore.h:101
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
#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
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gVirtualX
Definition TVirtualX.h:338
T1 fFirst
Definition X11Events.mm:86
T2 fSecond
Definition X11Events.mm:87
#define snprintf
Definition civetweb.c:1540
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:80
TList * GetMenuList() const
Return the list of menu items associated with the class.
Definition TClass.cxx:4327
void MakeCustomMenuList()
Makes a customizable version of the popup menu list, i.e.
Definition TClass.cxx:4269
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:2966
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:372
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual TList * GetList() const
Definition TGFrame.h:310
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual TGLayoutManager * GetLayoutManager() const
Definition TGFrame.h:338
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition TGFrame.cxx:967
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
virtual void SavePrimitiveSubframes(std::ostream &out, Option_t *option="")
Auxiliary protected method used to save subframes.
Definition TGFrame.cxx:2665
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1043
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:316
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1149
TGFrame * fFrame
Definition TGLayout.h:112
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:735
Int_t fX
frame x position
Definition TGFrame.h:85
virtual void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0)
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGFrame.h:202
UInt_t fHeight
frame height
Definition TGFrame.h:88
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
virtual UInt_t GetOptions() const
Definition TGFrame.h:197
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2504
Int_t fY
frame y position
Definition TGFrame.h:86
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:765
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition TGFrame.cxx:593
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:605
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:225
virtual void SetWidth(UInt_t w)
Definition TGFrame.h:246
virtual void MapWindow()
map window
Definition TGFrame.h:204
UInt_t GetWidth() const
Definition TGFrame.h:224
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2477
virtual void SetHeight(UInt_t h)
Definition TGFrame.h:247
Pixel_t fBackground
frame background color
Definition TGFrame.h:95
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:775
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:206
void SetFillStyle(Int_t v)
Set fill style (kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled).
Definition TGGC.cxx:345
void SetForeground(Pixel_t v)
Set foreground color.
Definition TGGC.cxx:278
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:1770
TGClient * fClient
Connection to display server.
Definition TGObject.h:27
Handle_t GetId() const
Definition TGObject.h:37
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:26
This class creates a popup menu object.
Definition TGMenu.h:110
UInt_t fH
height
Int_t fX
x position
Bool_t Contains(Int_t px, Int_t py) const
UInt_t fW
width
Int_t fY
y position
Pixel_t GetTipBgndColor() const
Cursor_t GetGrabCursor() const
A split frame.
void MapToSPlitTool(TGSplitFrame *top)
Map this split frame in the small overview tooltip.
virtual void Cleanup()
Recursively cleanup child frames.
virtual void VSplit(UInt_t w=0)
Vertically split the frame.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a splittable frame as a C++ statement(s) on output stream out.
TGSplitFrame * GetFirst() const
void OnSplitterClicked(Event_t *event)
Handle mouse click events on the splitter.
virtual ~TGSplitFrame()
Destructor. Make cleanup.
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.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add a frame in the split frame using layout hints l.
void SetHRatio(Float_t r)
TGSplitFrame * fSecond
Pointer to the second child (if any)
TGSplitTool * GetSplitTool() const
virtual void RemoveFrame(TGFrame *f)
Add a frame in the split frame using layout hints l.
virtual void HSplit(UInt_t h=0)
Horizontally split the frame.
TGSplitFrame * GetTopFrame()
Return the top level split frame.
void SetWRatio(Float_t r)
TGSplitFrame(const TGSplitFrame &)=delete
void SwallowBack()
Swallow back the child frame previously extracted, and close its parent (transient frame).
TGFrame * GetFrame() const
TGSplitTool * fSplitTool
SplitFrame Tool.
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)
virtual Bool_t HandleConfigureNotify(Event_t *)
Handles resize events for this frame.
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 * 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.
Int_t fX
X position in fWindow where to popup.
Bool_t HandleMotion(Event_t *event)
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
virtual ~TGSplitTool()
TGSplitTool destructor.
TGSplitTool(const TGSplitTool &)=delete
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.
void DrawBorder()
Draw border of tool window.
void SetPosition(Int_t x, Int_t y)
Set popup position within specified frame (as specified in the ctor).
void DoRedraw()
Redraw split frame tool.
void Reset()
Reset tool tip popup delay timer.
const TGFrame * fWindow
frame to which tool tip is associated
TMap fMap
map of rectangles/subframes
Bool_t HandleButton(Event_t *event)
Handle mouse click events in the tool.
void Hide()
Hide tool window. Use this method to hide the tool in a client class.
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:499
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:152
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
const TGWindow * GetParent() const
Definition TGWindow.h:76
virtual void RaiseWindow()
raise window
Definition TGWindow.cxx:208
A doubly linked list.
Definition TList.h:38
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:357
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:659
Iterator of map.
Definition TMap.h:144
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
Definition TMap.cxx:54
void Delete(Option_t *option="")
Remove all (key,value) pairs from the map AND delete the keys when they are allocated on the heap.
Definition TMap.cxx:134
virtual void SetOwnerValue(Bool_t enable=kTRUE)
Set whether this map is the owner (enable==true) of its values.
Definition TMap.cxx:341
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition TMap.cxx:236
Mother of all ROOT objects.
Definition TObject.h:41
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition TObject.cxx:736
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:515
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:869
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
Attributes that can be used when creating or changing a window.
Definition GuiTypes.h:93
Bool_t fOverrideRedirect
boolean value for override-redirect
Definition GuiTypes.h:107
Mask_t fMask
bit mask specifying which fields are valid
Definition GuiTypes.h:110
Bool_t fSaveUnder
should bits under be saved (popups)?
Definition GuiTypes.h:104
auto * l
Definition textangle.C:4
#define dest(otri, vertexptr)
Definition triangle.c:1041