Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TGMdiMainFrame.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Bertrand Bellenot 20/08/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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
14 This file is part of TGMdi an extension to the xclass toolkit.
15 Copyright (C) 1998-2002 by Harald Radke, Hector Peraza.
16
17 This application is free software; you can redistribute it and/or
18 modify it under the terms of the GNU Library General Public
19 License as published by the Free Software Foundation; either
20 version 2 of the License, or (at your option) any later version.
21
22 This application is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 Library General Public License for more details.
26
27 You should have received a copy of the GNU Library General Public
28 License along with this library; if not, write to the Free
29 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30
31**************************************************************************/
32
33
34/** \class TGMdiMainFrame.
35 \ingroup guiwidgets
36
37This file contains the TGMdiMainFrame class.
38
39*/
40
41
42#include "KeySymbols.h"
43#include "TGFrame.h"
44#include "TGMdiMainFrame.h"
45#include "TGMdiDecorFrame.h"
46#include "TGMdiFrame.h"
47#include "TGMdiMenu.h"
48#include "TGGC.h"
49#include "TGResourcePool.h"
50#include "TList.h"
51#include "TVirtualX.h"
52
53#include <iostream>
54
55
56////////////////////////////////////////////////////////////////////////////////
57/// Create a MDI main frame.
58
60 Int_t w, Int_t h, UInt_t options,
61 Pixel_t back) :
62 TGCanvas(p, w, h, options | kDoubleBorder | kSunkenFrame | kMdiMainFrame, back)
63{
64 fContainer = new TGMdiContainer(this, 10, 10, kOwnBackground,
67
69 fMenuBar = menuBar;
70 fChildren = 0;
71 fCurrent = 0;
73
74 const TGResourcePool *res = GetResourcePool();
81
82 fBoxGC = new TGGC(*gClient->GetResourcePool()->GetFrameGC());
83 fBoxGC->SetForeground(fForeNotCurrent);
84 fBoxGC->SetBackground(fBackNotCurrent);
85 fBoxGC->SetFunction(kGXxor);
87 fBoxGC->SetSubwindowMode(kIncludeInferiors);
88 fBoxGC->SetStipple(fClient->GetResourcePool()->GetCheckeredBitmap());
89 fBoxGC->SetFillStyle(kFillOpaqueStippled);
90
91 fCurrentX = fCurrentY = 0;
93
94 fWinListMenu = new TGPopupMenu(fClient->GetDefaultRoot());
95
97 if (main){
98 Int_t keycode = gVirtualX->KeysymToKeycode(kKey_Tab);
99 main->BindKey(this, keycode, kKeyControlMask);
100 main->BindKey(this, keycode, kKeyControlMask | kKeyShiftMask);
101 keycode = gVirtualX->KeysymToKeycode(kKey_F4);
102 main->BindKey(this, keycode, kKeyControlMask);
103 ((TGFrame *)main)->Connect("ProcessedConfigure(Event_t*)",
104 "TGMdiMainFrame", this, "UpdateMdiButtons()");
105 }
106
108 Layout();
109 MapWindow();
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// MDI main frame destructor.
115
117{
118 TGMdiFrameList *tmp, *travel = fChildren;
119
120 while (travel) {
121 tmp = travel->GetNext();
122 delete travel;
123 travel = tmp;
124 }
125
126 if (fFontCurrent) fClient->FreeFont((TGFont *)fFontCurrent);
128
129 delete fBoxGC;
130
131 if (!MustCleanup()) {
132
134
135 if (main && main->InheritsFrom("TGMainFrame")) {
136 Int_t keycode = gVirtualX->KeysymToKeycode(kKey_Tab);
137 main->RemoveBind(this, keycode, kKeyControlMask);
138 main->RemoveBind(this, keycode, kKeyControlMask | kKeyShiftMask);
139 keycode = gVirtualX->KeysymToKeycode(kKey_F4);
140 main->RemoveBind(this, keycode, kKeyControlMask);
141 }
142 }
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Set MDI windows resize mode (opaque or transparent).
147
149{
150 TGMdiFrameList *travel;
151
152 fResizeMode = mode;
153 for (travel = fChildren; travel; travel = travel->GetNext()) {
154 travel->GetDecorFrame()->SetResizeMode(mode);
155 }
156}
157
158////////////////////////////////////////////////////////////////////////////////
159/// Handle keyboards events into MDI main frame.
160
162{
163 char input[10];
164 UInt_t keysym;
165
166 if (event->fType == kGKeyPress) {
167 gVirtualX->LookupString(event, input, sizeof(input), keysym);
168 if ((EKeySym)keysym == kKey_Tab) {
169 if (event->fState & kKeyControlMask) {
170 if (event->fState & kKeyShiftMask) {
171 CirculateUp();
172 } else {
174 }
175 return kTRUE;
176 }
177 } else if ((EKeySym)keysym == kKey_F4) {
178 if (event->fState & kKeyControlMask) {
179 Close(GetCurrent());
180 return kTRUE;
181 }
182 }
183 }
184 return kFALSE;
185}
186
187////////////////////////////////////////////////////////////////////////////////
188/// Add new MDI child window.
189
191{
192 TGMdiFrameList *travel;
193
194 frame->UnmapWindow();
195
196 travel = new TGMdiFrameList;
197 travel->SetCyclePrev(travel);
198 travel->SetCycleNext(travel);
199 travel->SetPrev(0);
200 if (fChildren) fChildren->SetPrev(travel);
201 travel->SetNext(fChildren);
202 fChildren = travel;
203
204 travel->SetDecorFrame(new TGMdiDecorFrame(this, frame, frame->GetWidth(),
205 frame->GetHeight(), fBoxGC));
206
207 travel->SetFrameId(frame->GetId());
209
210 if (fCurrentX + travel->GetDecorFrame()->GetWidth() > fWidth) fCurrentX = 0;
211 if (fCurrentY + travel->GetDecorFrame()->GetHeight() > fHeight) fCurrentY = 0;
213
217
219
221 SetCurrent(travel);
222 Layout();
223
225 FrameCreated(travel->GetDecorFrame()->GetId());
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Remove MDI child window.
230
232{
233 TGMdiFrameList *travel = fChildren;
234
235 if (!frame) return kFALSE;
236
237 if (frame->IsEditable()) frame->SetEditable(kFALSE);
238
239 while (travel && (travel->GetFrameId() != frame->GetId()))
240 travel = travel->GetNext();
241 if (!travel) return kFALSE;
242
243 if (travel == fCurrent) fCurrent = 0;
244
245 // unlink the element from the fCycle list
246 travel->GetCyclePrev()->SetCycleNext(travel->GetCycleNext());
247 travel->GetCycleNext()->SetCyclePrev(travel->GetCyclePrev());
248
249 // and from the main list
250 if (travel->GetNext()) {
251 travel->GetNext()->SetPrev(travel->GetPrev());
252 }
253 if (travel->GetPrev()) {
254 travel->GetPrev()->SetNext(travel->GetNext());
255 } else {
256 fChildren = travel->GetNext();
257 }
258
259 if (!fCurrent) {
260 if (fChildren) SetCurrent(travel->GetCyclePrev());
261 }
262
263 travel->GetDecorFrame()->RemoveFrame(frame);
264
265 UInt_t old_id = frame->GetId();
266
267 delete travel->fDecor;
268
270
272 Layout();
273
275 FrameClosed(old_id);
276
277 return kTRUE;
278}
279
280////////////////////////////////////////////////////////////////////////////////
281/// Set current (active) MDI child window (by id).
282
284{
285 if (fCurrent && (fCurrent->GetDecorFrame()->GetId() == id)) {
286 fCurrent->GetDecorFrame()->RaiseWindow();
287 if (fCurrent->GetDecorFrame()->IsMaximized() && fMenuBar)
288 fMenuBar->ShowFrames(fCurrent->GetDecorFrame()->GetTitleBar()->GetWinIcon(),
289 fCurrent->GetDecorFrame()->GetTitleBar()->GetButtons());
290
291 Emit("SetCurrent(TGMdiFrame*)", (Longptr_t)fCurrent->GetDecorFrame()->GetMdiFrame());
292 return kTRUE;
293 }
294
295 TGMdiFrameList *travel = fChildren;
296 while (travel && (travel->GetDecorFrame()->GetId() != id)) travel = travel->GetNext();
297 if (!travel) return kFALSE;
298
299 return SetCurrent(travel);
300}
301
302////////////////////////////////////////////////////////////////////////////////
303/// Set current (active) MDI child window (by frame pointer).
304
306{
307 if (fCurrent && (fCurrent->GetDecorFrame()->GetMdiFrame() == f)) {
308 fCurrent->GetDecorFrame()->RaiseWindow();
309 if (fCurrent->GetDecorFrame()->IsMaximized() && fMenuBar)
310 fMenuBar->ShowFrames(fCurrent->GetDecorFrame()->GetTitleBar()->GetWinIcon(),
311 fCurrent->GetDecorFrame()->GetTitleBar()->GetButtons());
312 Emit("SetCurrent(TGMdiFrame*)", (Longptr_t)fCurrent->GetDecorFrame()->GetMdiFrame());
313 return kTRUE;
314 }
315
316 TGMdiFrameList *travel = fChildren;
317 while (travel && (travel->GetDecorFrame()->GetMdiFrame() != f)) travel = travel->GetNext();
318 if (!travel) return kFALSE;
319
320 return SetCurrent(travel);
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// Set current (active) MDI child window (by frame list).
325
327{
328 if (fCurrent && (fCurrent == newcurrent)) {
329 fCurrent->GetDecorFrame()->RaiseWindow();
330 if (fCurrent->GetDecorFrame()->IsMaximized() && fMenuBar)
331 fMenuBar->ShowFrames(fCurrent->GetDecorFrame()->GetTitleBar()->GetWinIcon(),
332 fCurrent->GetDecorFrame()->GetTitleBar()->GetButtons());
333 Emit("SetCurrent(TGMdiFrame*)", (Longptr_t)fCurrent->GetDecorFrame()->GetMdiFrame());
334 return kTRUE;
335 }
336
337 if (fCurrent) {
338 if (!fCurrent->GetDecorFrame()->IsMaximized())
339 fCurrent->GetDecorFrame()->GetTitleBar()->SetTitleBarColors(fForeNotCurrent,
342 }
343
344 if (newcurrent) {
345 if (fCurrent) {
346 // unlink the element from the old position
347 newcurrent->GetCyclePrev()->SetCycleNext(newcurrent->GetCycleNext());
348 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent->GetCyclePrev());
349 // and link it to the top of the window fCycle stack
350 newcurrent->SetCyclePrev(fCurrent);
351 newcurrent->SetCycleNext(fCurrent->GetCycleNext());
352 fCurrent->SetCycleNext(newcurrent);
353 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent);
354 } else {
355 // no current? well, put it at the head of the list...
356 if (fChildren && newcurrent != fChildren) {
357 // unlink the element from the old position
358 newcurrent->GetCyclePrev()->SetCycleNext(newcurrent->GetCycleNext());
359 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent->GetCyclePrev());
360 // and link it to the beginning of the window list
361 newcurrent->SetCyclePrev(fChildren);
362 newcurrent->SetCycleNext(fChildren->GetCycleNext());
363 fChildren->SetCycleNext(newcurrent);
364 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent);
365 }
366 }
367 }
368
369 fCurrent = newcurrent;
370
371 if (!fCurrent) return kFALSE;
372
373 if (!fCurrent->GetDecorFrame()->IsMaximized())
374 fCurrent->GetDecorFrame()->GetTitleBar()->SetTitleBarColors(fForeCurrent,
377
378 fCurrent->GetDecorFrame()->RaiseWindow();
379 Emit("SetCurrent(TGMdiFrame*)", (Longptr_t)fCurrent->GetDecorFrame()->GetMdiFrame());
380
381 fWinListMenu->RCheckEntry(fCurrent->GetDecorFrame()->GetId(), 0, kMaxInt);
382
383 if (fCurrent->GetDecorFrame()->IsMaximized() && fMenuBar)
384 fMenuBar->ShowFrames(fCurrent->GetDecorFrame()->GetTitleBar()->GetWinIcon(),
385 fCurrent->GetDecorFrame()->GetTitleBar()->GetButtons());
386
387 return kTRUE;
388}
389
390////////////////////////////////////////////////////////////////////////////////
391/// Bring the lowest window to the top.
392
394{
395 if (fCurrent) {
396 fCurrent->GetDecorFrame()->GetTitleBar()->SetTitleBarColors(fForeNotCurrent,
399
400 fCurrent = fCurrent->GetCycleNext();
401
402 fCurrent->GetDecorFrame()->RaiseWindow();
403 fCurrent->GetDecorFrame()->GetTitleBar()->SetTitleBarColors(fForeCurrent,
406 if (fCurrent->GetDecorFrame()->IsMaximized() && fMenuBar)
407 fMenuBar->ShowFrames(fCurrent->GetDecorFrame()->GetTitleBar()->GetWinIcon(),
408 fCurrent->GetDecorFrame()->GetTitleBar()->GetButtons());
409
410 } else if (fChildren) {
412 }
413}
414
415////////////////////////////////////////////////////////////////////////////////
416/// Send the highest window to the bottom.
417
419{
420 if (fCurrent) {
421 fCurrent->GetDecorFrame()->LowerWindow();
422 fCurrent->GetDecorFrame()->GetTitleBar()->SetTitleBarColors(fForeNotCurrent,
425
426 fCurrent = fCurrent->GetCyclePrev(); // do not call SetCurrent in order
427 // to not to alter the stacking order
428 fCurrent->GetDecorFrame()->RaiseWindow();
429 fCurrent->GetDecorFrame()->GetTitleBar()->SetTitleBarColors(fForeCurrent,
432 if (fCurrent->GetDecorFrame()->IsMaximized() && fMenuBar)
433 fMenuBar->ShowFrames(fCurrent->GetDecorFrame()->GetTitleBar()->GetWinIcon(),
434 fCurrent->GetDecorFrame()->GetTitleBar()->GetButtons());
435 } else if (fChildren) {
437 }
438}
439
440////////////////////////////////////////////////////////////////////////////////
441/// Return decor frame of MDI child window (by frame pointer).
442
444{
445 TGMdiFrameList *travel = fChildren;
446 while (travel && (travel->GetDecorFrame()->GetMdiFrame() != frame))
447 travel = travel->GetNext();
448 if (!travel) return 0;
449 return travel->GetDecorFrame();
450}
451
452////////////////////////////////////////////////////////////////////////////////
453/// Return decor frame of MDI child window (by id).
454
456{
457 TGMdiFrameList *travel = fChildren;
458 while (travel && (travel->GetDecorFrame()->GetId() != id)) travel = travel->GetNext();
459 if (!travel) return 0;
460 return travel->GetDecorFrame();
461}
462
463////////////////////////////////////////////////////////////////////////////////
464/// Return frame of MDI child window (by id).
465
467{
468 TGMdiDecorFrame *frame = GetDecorFrame(id);
469 if (!frame) return 0;
470 return frame->GetMdiFrame();
471}
472
473////////////////////////////////////////////////////////////////////////////////
474/// Return resizing box (rectangle) for current MDI child.
475
477{
478 if (fCurrent && fCurrent->GetDecorFrame()->IsMaximized()) {
479 return TGRectangle(0, 0, fWidth - 2 * fBorderWidth, fHeight - 2 * fBorderWidth);
480 } else {
481 TGRectangle rect;
482 TGMdiFrameList *travel;
483
484 for (travel = fChildren; travel; travel = travel->GetNext()) {
485 Int_t x = travel->GetDecorFrame()->GetX();
486 Int_t y = travel->GetDecorFrame()->GetY();
487 UInt_t w = travel->GetDecorFrame()->GetWidth();
488 UInt_t h = travel->GetDecorFrame()->GetHeight();
489 TGRectangle wrect(x, y, w, h);
490 rect.Merge(wrect);
491 }
492 return rect;
493 }
494}
495
496////////////////////////////////////////////////////////////////////////////////
497/// Return minimized box (rectangle) for current MDI child.
498
500{
501 TGRectangle rect;
502 TGMdiFrameList *travel;
503 Int_t first = kTRUE;
504
505 for (travel = fChildren; travel; travel = travel->GetNext()) {
506 if (travel->GetDecorFrame()->IsMinimized()) {
507 TGRectangle wrect(travel->GetDecorFrame()->GetX(), travel->GetDecorFrame()->GetY(),
508 travel->GetDecorFrame()->GetWidth(), travel->GetDecorFrame()->GetHeight());
509 if (first) rect = wrect;
510 else rect.Merge(wrect);
511 first = kFALSE;
512 }
513 }
514 return rect;
515}
516
517////////////////////////////////////////////////////////////////////////////////
518/// Update MDI menu entries with current list of MDI child windows.
519
521{
522 TString buf;
523 char scut;
524 TGMdiFrameList *travel;
525 const TGPicture *pic;
526
527 TGMenuEntry *e;
528 TIter fNext(fWinListMenu->GetListOfEntries());
529 while ((e = (TGMenuEntry*)fNext())) {
530 fWinListMenu->DeleteEntry(e);
531 }
532 scut = '0';
533
534 if (!fChildren) {
535 fWinListMenu->AddEntry(new TGHotString("(None)"), 1000);
536 fWinListMenu->DisableEntry(1000);
537 return;
538 }
539
540 for (travel = fChildren; travel; travel = travel->GetNext()) {
541 scut++;
542 if (scut == ('9' + 1)) scut = 'A';
543 buf = TString::Format("&%c. %s", scut, travel->GetDecorFrame()->GetWindowName());
544 if (travel->GetDecorFrame()->GetMdiButtons() & kMdiMenu)
545 pic = travel->GetDecorFrame()->GetWindowIcon();
546 else
547 pic = 0;
548 fWinListMenu->AddEntry(new TGHotString(buf.Data()), travel->GetDecorFrame()->GetId(), 0, pic);
549 }
550
551 if (fCurrent)
552 fWinListMenu->RCheckEntry(fCurrent->GetDecorFrame()->GetId(), 0, kMaxInt);
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Recalculates the postion and the size of all MDI child windows.
557
559{
561 if (fCurrent && fCurrent->GetDecorFrame()->IsMaximized())
562 fCurrent->GetDecorFrame()->MoveResize(0, 0, fWidth - 2 *fBorderWidth, fHeight -
563 2 * fBorderWidth);
564}
565
566////////////////////////////////////////////////////////////////////////////////
567/// Update the status of MDI buttons in the decor frame of all children.
568
570{
571 static Bool_t done = kFALSE;
572 TGMdiFrameList *travel;
573 if (done) return;
574 for (travel = fChildren; travel; travel = travel->GetNext()) {
575 if (!travel->GetDecorFrame()->IsMaximized() &&
576 !travel->GetDecorFrame()->IsMinimized()) {
578 }
579 }
580 done = kTRUE;
581}
582
583////////////////////////////////////////////////////////////////////////////////
584/// Automatic repositioning and resizing of every MDI child window.
585/// depending on mode : tile horizontal, tile vertical, or cascade.
586
588{
589 Int_t factor_x = 0;
590 Int_t factor_y = 0;
591 Int_t num_mapped = 0;
592 Int_t x = 0;
593 Int_t y = 0;
594 Int_t w = fWidth - 2 * fBorderWidth; //GetContainer()->GetWidth();
595 Int_t h = fHeight - 2 * fBorderWidth; //GetContainer()->GetHeight();
596
597 fArrangementMode = mode;
598
599 TGMdiFrameList *tmp, *travel;
600
601 for (travel = fChildren; travel; travel = travel->GetNext()) {
602 if (travel->GetDecorFrame()->IsMaximized())
603 Restore(travel->GetDecorFrame()->GetMdiFrame());
604 if (!travel->GetDecorFrame()->IsMinimized())
605 ++num_mapped;
606 }
607
608 // must also restore view to 0,0
609 GetViewPort()->SetHPos(0);
610 GetViewPort()->SetVPos(0);
611
613
614 travel = fChildren;
615
616 if (num_mapped == 0) return;
617
619 h -= irect.fH;
620
621 switch (mode) {
623 factor_y = h / num_mapped;
624 for (travel = fChildren; travel; travel = travel->GetNext()) {
625 if (!travel->GetDecorFrame()->IsMinimized()) {
626 travel->GetDecorFrame()->MoveResize(x, y, w, factor_y);
627 y = y + factor_y;
628 }
629 }
630 break;
631
632 case kMdiTileVertical:
633 factor_x = w / num_mapped;
634 for (travel = fChildren; travel; travel = travel->GetNext()) {
635 if (!travel->GetDecorFrame()->IsMinimized()) {
636 travel->GetDecorFrame()->MoveResize(x, y, factor_x, h);
637 x = x + factor_x;
638 }
639 }
640 break;
641
642 case kMdiCascade:
643 y = travel->GetDecorFrame()->GetTitleBar()->GetX() +
644 travel->GetDecorFrame()->GetTitleBar()->GetHeight();
645 x = y;
646 factor_y = (h * 2) / 3;
647 factor_x = (w * 2) / 3;
648
649 travel = fCurrent;
650 if (!travel) travel = fChildren;
651 tmp = travel;
652 if (travel) {
653 do {
654 travel = travel->GetCycleNext();
655 if (!travel->GetDecorFrame()->IsMinimized()) {
656 travel->GetDecorFrame()->MoveResize(x - y, x - y, factor_x, factor_y);
657 x += y;
658 }
659 } while (travel != tmp);
660 }
661 break;
662 }
663
664 FramesArranged(mode);
665
666 Layout();
667}
668
669////////////////////////////////////////////////////////////////////////////////
670/// This is an attempt to an "smart" minimized window re-arrangement.
671
673{
674 TGMdiFrameList *travel, *closest;
675 Int_t x, y, w, h;
676
677 Bool_t arranged = kTRUE;
678
679 for (travel = fChildren; travel && arranged; travel = travel->GetNext())
680 if (travel->GetDecorFrame()->IsMinimized()) arranged = kFALSE;
681
682 // return if there is nothing to do
683
684 if (arranged || !fChildren) return;
685
686 h = fChildren->GetDecorFrame()->GetTitleBar()->GetDefaultHeight() +
687 fChildren->GetDecorFrame()->GetBorderWidth();
688 w = kMinimizedWidth * h + fChildren->GetDecorFrame()->GetBorderWidth();
689
690 x = 0;
691 y = GetViewPort()->GetHeight() - h;
692
693 // we'll use the _minimizedUserPlacement variable as a "not arranged" flag
694
695 for (travel = fChildren; travel; travel = travel->GetNext())
697
698 do {
699 closest = 0;
700 Int_t cdist = 0;
701 for (travel = fChildren; travel; travel = travel->GetNext()) {
702 if (travel->GetDecorFrame()->IsMinimized()) {
703 if (travel->GetDecorFrame()->GetMinUserPlacement()) {
704 Int_t dx = travel->GetDecorFrame()->GetX() - x;
705 Int_t dy = y - travel->GetDecorFrame()->GetY();
706 Int_t dist = dx * dx + dy * dy;
707 if (!closest || (dist < cdist)) {
708 closest = travel;
709 cdist = dist;
710 }
711 }
712 }
713 }
714
715 if (closest) {
716 closest->GetDecorFrame()->SetMinimizedX(x);
717 closest->GetDecorFrame()->SetMinimizedY(y);
718 closest->GetDecorFrame()->MoveResize(x, y, w, h);
720
721 x += w;
722 if (x + w > (Int_t)GetViewPort()->GetWidth()) {
723 x = 0;
724 y -= h;
725 }
726 }
727
728 } while (closest);
729
730 // reset the fMinimizedUserPlacement settings for all windows
731
732 for (travel = fChildren; travel; travel = travel->GetNext())
734}
735
736////////////////////////////////////////////////////////////////////////////////
737/// Process messages MDI main frame.
738
740{
741 switch (GET_MSG(msg)) {
742 case kC_MDI:
743 SetCurrent(parm1);
744 switch (GET_SUBMSG(msg)) {
745
746 case kMDI_MINIMIZE:
748 break;
749
750 case kMDI_MAXIMIZE:
752 break;
753
754 case kMDI_RESTORE:
756 break;
757
758 case kMDI_CLOSE:
759 Close(GetCurrent());
760 break;
761
762 case kMDI_MOVE:
764 break;
765
766 case kMDI_SIZE:
768 break;
769
770 case kMDI_HELP:
772 break;
773 }
774 break;
775
776 default:
777 return TGCanvas::ProcessMessage(msg, parm1, parm2);
778 }
779
780 return kTRUE;
781}
782
783////////////////////////////////////////////////////////////////////////////////
784/// Maximize MDI child window mdiframe.
785
787{
788 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
789
790 if (!frame) return;
791
792 if (frame->IsMaximized()) return;
793
794 if (frame->IsMinimized()) Restore(mdiframe);
795
796 frame->SetDecorBorderWidth(0);
797 frame->SetPreResizeX(frame->GetX());
798 frame->SetPreResizeY(frame->GetY());
799 frame->SetPreResizeWidth(frame->GetWidth());
800 frame->SetPreResizeHeight(frame->GetHeight());
801 frame->GetUpperHR()->UnmapWindow();
802 frame->GetLowerHR()->UnmapWindow();
803 frame->GetLeftVR()->UnmapWindow();
804 frame->GetRightVR()->UnmapWindow();
805 frame->GetUpperLeftCR()->UnmapWindow();
806 frame->GetUpperRightCR()->UnmapWindow();
807 frame->GetLowerLeftCR()->UnmapWindow();
808 frame->GetLowerRightCR()->UnmapWindow();
809
811 fHeight - 2 * fBorderWidth);
812 frame->Maximize();
813 frame->GetTitleBar()->LayoutButtons(frame->GetMdiButtons(), frame->IsMinimized(),
814 frame->IsMaximized());
815 frame->GetTitleBar()->RemoveFrames(frame->GetTitleBar()->GetWinIcon(),
816 frame->GetTitleBar()->GetButtons());
817 frame->HideFrame(frame->GetTitleBar());
818
819 if (fMenuBar) {
822 fMenuBar->AddFrames(frame->GetTitleBar()->GetWinIcon(),
823 frame->GetTitleBar()->GetButtons());
824 fMenuBar->Layout();
825 }
826
828 FrameMaximized(frame->GetId());
829
830 Layout();
831}
832
833////////////////////////////////////////////////////////////////////////////////
834/// Restore size of MDI child window mdiframe.
835
837{
838 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
839
840 if (!frame) return;
841
842 if (frame->IsMinimized() == kFALSE && frame->IsMaximized() == kFALSE) return;
843
844 if (frame->IsMinimized()) {
845 frame->SetMinimizedX(frame->GetX());
846 frame->SetMinimizedY(frame->GetY());
847 frame->Minimize(kFALSE);
851 } else if (frame->IsMaximized()) {
853 frame->MapSubwindows();
854
855 if (fMenuBar) {
856 fMenuBar->RemoveFrames(frame->GetTitleBar()->GetWinIcon(),
857 frame->GetTitleBar()->GetButtons());
858 fMenuBar->Layout();
859 }
860
861 frame->GetTitleBar()->AddFrames(frame->GetTitleBar()->GetWinIcon(),
862 frame->GetTitleBar()->GetButtons());
865 frame->ShowFrame(frame->GetTitleBar());
866 }
867 frame->Minimize(kFALSE);
868 frame->Maximize(kFALSE);
870 frame->MoveResize(frame->GetPreResizeX(), frame->GetPreResizeY(),
871 frame->GetPreResizeWidth(), frame->GetPreResizeHeight());
872 SetCurrent(mdiframe);
874 FrameRestored(frame->GetId());
875
876 Layout();
877}
878
879////////////////////////////////////////////////////////////////////////////////
880/// Minimize MDI child window mdiframe.
881
883{
884 Int_t x, y, w, h;
885 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
886
887 if (!frame) return;
888
889 if (frame->IsMinimized()) return;
890
891 if (frame->IsMaximized()) Restore(mdiframe);
892
893 frame->SetPreResizeX(frame->GetX());
894 frame->SetPreResizeY(frame->GetY());
895 frame->SetPreResizeWidth(frame->GetWidth());
896 frame->SetPreResizeHeight(frame->GetHeight());
897
898 h = frame->GetTitleBar()->GetDefaultHeight() + frame->GetBorderWidth();
899 w = kMinimizedWidth * h + frame->GetBorderWidth();
900
901 if (!frame->GetMinUserPlacement()) {
902
903 x = 0;
904 y = GetViewPort()->GetHeight() - h;
905
906 while (1) {
907 TGMdiFrameList *travel;
908 Bool_t taken = kFALSE;
909
910 // find an empty spot...
911 for (travel = fChildren; travel; travel = travel->GetNext()) {
912 if (travel->GetDecorFrame()->IsMinimized()) {
913 TGPosition p(travel->GetDecorFrame()->GetX(),
914 travel->GetDecorFrame()->GetY());
915 TGDimension s(travel->GetDecorFrame()->GetWidth(),
916 travel->GetDecorFrame()->GetHeight());
917 if ((x <= p.fX + (Int_t) s.fWidth - 1) && (x + w - 1 >= p.fX) &&
918 (y <= p.fY + (Int_t) s.fHeight - 1) && (y + h - 1 >= p.fY)) {
919 taken = kTRUE;
920 break;
921 }
922 }
923 }
924 if (!taken) break;
925
926 x += w;
927 if (x + w > (Int_t)GetViewPort()->GetWidth()) {
928 x = 0;
929 y -= h;
930 }
931 }
932
933 frame->SetMinimizedX(x);
934 frame->SetMinimizedY(y);
935 }
936
937 frame->Minimize();
938
939 frame->MoveResize(frame->GetMinimizedX(), frame->GetMinimizedY(), w, h);
940 frame->LowerWindow();
941 frame->GetTitleBar()->LayoutButtons(frame->GetMdiButtons(),
942 frame->IsMinimized(),
943 frame->IsMaximized());
944 frame->Layout();
945
947 FrameMinimized(frame->GetId());
948
949 Layout();
950}
951
952////////////////////////////////////////////////////////////////////////////////
953/// Close MDI child window mdiframe.
954
956{
957 if (!mdiframe) return kFALSE;
958
959 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
960 Restore(mdiframe);
961 mdiframe->Emit("CloseWindow()");
962 if (frame && !ROOT::Detail::HasBeenDeleted(mdiframe) && !mdiframe->TestBit(TGMdiFrame::kDontCallClose))
963 return frame->CloseWindow();
964 return kTRUE;
965}
966
967////////////////////////////////////////////////////////////////////////////////
968/// Allow to move MDI child window mdiframe.
969
971{
972 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
973 if (!frame) return;
974
975 Int_t x = frame->GetTitleBar()->GetWidth() / 2;
976 Int_t y = frame->GetTitleBar()->GetHeight() - 1;
977
978 gVirtualX->Warp(x, y, frame->GetTitleBar()->GetId());
979
980 frame->GetTitleBar()->SetLeftButPressed();
981 frame->GetTitleBar()->SetX0(x);
982 frame->GetTitleBar()->SetY0(y);
983 Cursor_t cursor = gVirtualX->CreateCursor(kMove);
984 gVirtualX->SetCursor(frame->GetTitleBar()->GetId(), cursor);
985
986 gVirtualX->GrabPointer(frame->GetTitleBar()->GetId(),
988 kNone, cursor, kTRUE, kFALSE);
989}
990
991////////////////////////////////////////////////////////////////////////////////
992/// Allow to resize MDI child window mdiframe.
993
995{
996 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
997 if (!frame) return;
998
999 Int_t x = frame->GetLowerRightCR()->GetWidth() - 5;
1000 Int_t y = frame->GetLowerRightCR()->GetHeight() - 5;
1001
1002 Int_t xroot, yroot;
1003 Window_t win;
1004
1005 gVirtualX->TranslateCoordinates(frame->GetLowerRightCR()->GetId(),
1006 fClient->GetDefaultRoot()->GetId(), x, y, xroot, yroot, win);
1007
1008 gVirtualX->Warp(x, y, frame->GetLowerRightCR()->GetId());
1009
1010 Event_t event;
1011
1012 event.fType = kButtonPress;
1013 event.fWindow = frame->GetLowerRightCR()->GetId();
1014 event.fCode = kButton1;
1015 event.fX = x;
1016 event.fY = y;
1017 event.fXRoot = xroot;
1018 event.fYRoot = yroot;
1019
1020 Cursor_t cursor = gVirtualX->CreateCursor(kBottomRight);
1021 gVirtualX->SetCursor(frame->GetLowerRightCR()->GetId(), cursor);
1022
1023 gVirtualX->GrabPointer(frame->GetLowerRightCR()->GetId(),
1025 kNone, cursor, kTRUE, kFALSE);
1026
1027 frame->GetLowerRightCR()->HandleButton(&event);
1028}
1029
1030////////////////////////////////////////////////////////////////////////////////
1031/// Calls Help() method of MDI child window mdiframe.
1032
1034{
1035 if (mdiframe)
1036 return mdiframe->Help();
1037 else
1038 return kFALSE;
1039}
1040
1041////////////////////////////////////////////////////////////////////////////////
1042/// Return pointer on current (active) MDI child window.
1043
1045{
1046 if (fCurrent)
1047 return fCurrent->GetDecorFrame()->GetMdiFrame();
1048 else
1049 return 0;
1050}
1051
1052////////////////////////////////////////////////////////////////////////////////
1053/// Get MDI geometry of MDI child window f.
1054
1056{
1057 TGMdiGeometry geom;
1058
1059 geom.fValueMask = 0;
1060
1061 const TGMdiDecorFrame *frame = GetDecorFrame(f);
1062 if (frame) {
1063 Int_t th = frame->GetTitleBar()->GetDefaultHeight();
1064 Int_t bw = frame->GetBorderWidth();
1065
1066 if (frame->IsMinimized() || frame->IsMaximized()) {
1067 geom.fDecoration = TGRectangle(frame->GetPreResizeX(),
1068 frame->GetPreResizeY(),
1069 (unsigned) frame->GetPreResizeWidth(),
1070 (unsigned) frame->GetPreResizeHeight());
1071 } else {
1072 geom.fDecoration = TGRectangle(frame->GetX(),
1073 frame->GetY(),
1074 (unsigned) frame->GetWidth(),
1075 (unsigned) frame->GetHeight());
1076 }
1078
1079 geom.fClient = TGRectangle(geom.fDecoration.fX + bw,
1080 geom.fDecoration.fY + bw + th,
1081 (unsigned) (geom.fDecoration.fW - 2 * bw),
1082 (unsigned) (geom.fDecoration.fH - 2 * bw - th));
1084
1085 if (frame->GetMinUserPlacement()) {
1086 Int_t mh = th + 2 * bw;
1087 Int_t mw = kMinimizedWidth * mh;
1088
1089 geom.fIcon = TGRectangle(frame->GetMinimizedX(),
1090 frame->GetMinimizedY(),
1091 (unsigned) mw,
1092 (unsigned) mh);
1094 }
1095
1096 }
1097
1098 return geom;
1099}
1100
1101////////////////////////////////////////////////////////////////////////////////
1102/// Set MDI geometry for MDI child window f.
1103
1105{
1107 if (frame) {
1108 if (geom.fValueMask & kMdiDecorGeometry) {
1109 if (frame->IsMinimized() || frame->IsMaximized()) {
1110 frame->SetPreResizeX(geom.fDecoration.fX);
1111 frame->SetPreResizeY(geom.fDecoration.fY);
1112 frame->SetPreResizeWidth(geom.fDecoration.fW);
1113 frame->SetPreResizeHeight(geom.fDecoration.fH);
1114 } else {
1115 frame->MoveResize(geom.fDecoration.fX, geom.fDecoration.fY,
1116 geom.fDecoration.fW, geom.fDecoration.fH);
1117 }
1118 } else if (geom.fValueMask & kMdiClientGeometry) {
1119
1120 }
1121 if (geom.fValueMask & kMdiIconGeometry) {
1122 frame->SetMinimizedX(geom.fIcon.fX);
1123 frame->SetMinimizedY(geom.fIcon.fY);
1124 frame->SetMinUserPlacement();
1125 if (frame->IsMinimized())
1126 frame->Move(frame->GetMinimizedX(), frame->GetMinimizedY());
1127 }
1128 Layout();
1129 }
1130}
1131
1132////////////////////////////////////////////////////////////////////////////////
1133/// Close all MDI child windows.
1134
1136{
1137 TGMdiFrameList *tmp, *travel = fChildren;
1138
1139 while (travel) {
1140 tmp = travel->GetNext();
1141 SetCurrent(travel);
1142 Close(GetCurrent());
1143 travel = tmp;
1144 }
1145}
1146
1147////////////////////////////////////////////////////////////////////////////////
1148/// Check if MDI child window f is maximized;
1149
1151{
1153 if (frame) return frame->IsMaximized();
1154 return kFALSE;
1155}
1156
1157////////////////////////////////////////////////////////////////////////////////
1158/// Check if MDI child window f is minimized;
1159
1161{
1163 if (frame) return frame->IsMinimized();
1164 return kFALSE;
1165}
1166
1167////////////////////////////////////////////////////////////////////////////////
1168/// TGMdiContainer constructor.
1169
1171 UInt_t options, ULong_t back) :
1172 TGFrame(p->GetViewPort(), w, h, options, back)
1173{
1174 fMain = p;
1176}
1177
1178////////////////////////////////////////////////////////////////////////////////
1179/// Return dimension of MDI container.
1180
1182{
1183 TGRectangle rect = fMain->GetBBox();
1184
1185 Int_t xpos = -fMain->GetViewPort()->GetHPos() - rect.LeftTop().fX;
1186 Int_t ypos = -fMain->GetViewPort()->GetVPos() - rect.LeftTop().fY;
1187
1188 return TGDimension(std::max(Int_t(xpos + fWidth), rect.RightBottom().fX + 1),
1189 std::max(Int_t(ypos + fHeight), rect.RightBottom().fY + 1));
1190}
1191
1192////////////////////////////////////////////////////////////////////////////////
1193/// Handle configure notify events for MDI container.
1194
1196{
1197 if (event->fWindow != fId) {
1198 TGRectangle rect = fMain->GetBBox();
1199
1200 Int_t vw = fMain->GetViewPort()->GetWidth();
1201 Int_t vh = fMain->GetViewPort()->GetHeight();
1202
1203 Int_t w = std::max(vw, rect.RightBottom().fX + 1);
1204 Int_t h = std::max(vh, rect.RightBottom().fY + 1);
1205
1206 if ((w != (Int_t)fWidth) || (h != (Int_t)fHeight)) {
1207 ((TGMdiMainFrame*)fMain)->Layout();
1208 return kTRUE;
1209 }
1210 }
1211 return kFALSE;
1212}
1213
1214////////////////////////////////////////////////////////////////////////////////
1215/// Save a MDI main frame as a C++ statement(s) on output stream out
1216
1217void TGMdiMainFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1218{
1219 // save options and custom color if not default
1220 auto extra_args = SaveCtorArgs(out);
1221
1222 out << "\n // MDI main frame\n";
1223 out << " TGMdiMainFrame *" << GetName() << " = new TGMdiMainFrame(" << fParent->GetName() << ","
1224 << GetMenu()->GetName() << "," << GetWidth() << "," << GetHeight() << extra_args << ");\n";
1225
1226 if (option && strstr(option, "keep_names"))
1227 out << " " << GetName() << "->SetName(\"" << GetName() << "\");\n";
1228
1229 TGMdiFrameList *travel = fChildren;
1230 travel->SetCycleNext(travel);
1231 for (travel = fChildren; travel; travel = travel->GetNext()) {
1232 TGMdiFrame *mf = travel->GetDecorFrame()->GetMdiFrame();
1233 if (mf)
1234 mf->SavePrimitive(out, option);
1235 }
1236 if (fArrangementMode) {
1237 out << " " << GetName() << "->ArrangeFrames(";
1238 switch (fArrangementMode) {
1239
1240 case kMdiTileHorizontal: out << "kMdiTileHorizontal);\n"; break;
1241
1242 case kMdiTileVertical: out << "kMdiTileVertical);\n"; break;
1243
1244 case kMdiCascade: out << "kMdiCascade);\n"; break;
1245 }
1246 }
1247 if (fResizeMode != kMdiOpaque)
1248 out << " " << GetName() << "->SetResizeMode(kMdiNonOpaque);\n";
1249
1250 if (fCurrent)
1251 out << " " << GetName() << "->SetCurrent(" << GetCurrent()->GetName() << ");\n";
1252}
@ kGKeyPress
Definition GuiTypes.h:61
@ kButtonPress
Definition GuiTypes.h:61
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:35
@ kGXxor
src XOR dst
Definition GuiTypes.h:75
const Mask_t kPointerMotionMask
Definition GuiTypes.h:164
const Mask_t kKeyShiftMask
Definition GuiTypes.h:196
@ kSunkenFrame
Definition GuiTypes.h:384
@ kDoubleBorder
Definition GuiTypes.h:386
@ kMdiMainFrame
Definition GuiTypes.h:395
@ kOwnBackground
Definition GuiTypes.h:392
const Handle_t kNone
Definition GuiTypes.h:89
const Mask_t kKeyControlMask
Definition GuiTypes.h:198
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:167
@ kFillOpaqueStippled
Definition GuiTypes.h:52
@ kIncludeInferiors
Definition GuiTypes.h:54
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:163
@ kBottomRight
Definition GuiTypes.h:373
@ kMove
Definition GuiTypes.h:375
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
@ kButton1
Definition GuiTypes.h:215
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
EKeySym
Definition KeySymbols.h:25
@ kKey_F4
Definition KeySymbols.h:60
@ kKey_Tab
Definition KeySymbols.h:27
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
constexpr Int_t kMaxInt
Definition RtypesCore.h:119
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
Definition RtypesCore.h:89
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
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
#define gClient
Definition TGClient.h:157
@ kMdiDecorGeometry
@ kMdiIconGeometry
@ kMdiClientGeometry
@ kMdiDefaultResizeMode
@ kMdiOpaque
@ kMdiTileVertical
@ kMdiCascade
@ kMdiTileHorizontal
@ kMdiMenu
#define gVirtualX
Definition TVirtualX.h:375
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
@ kMDI_CLOSE
@ kMDI_HELP
@ kMDI_RESTORE
@ kMDI_CREATE
@ kMDI_MINIMIZE
@ kMDI_MAXIMIZE
@ kMDI_SIZE
@ kMDI_MOVE
Int_t GET_SUBMSG(Long_t val)
virtual void SetContainer(TGFrame *f)
Definition TGCanvas.h:222
TGViewPort * GetViewPort() const
Definition TGCanvas.h:217
void MapSubwindows() override
Map all canvas sub windows.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle message generated by the canvas scrollbars.
TGCanvas(const TGCanvas &)=delete
void Layout() override
Create layout for canvas.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:316
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1196
Bool_t IsEditable() const override
Return kTRUE if frame is being edited.
Definition TGFrame.cxx:919
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1141
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:940
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1182
UInt_t fHeight
Definition TGDimension.h:21
UInt_t fWidth
Definition TGDimension.h:20
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:331
Int_t GetBorderWidth() const
Definition TGFrame.h:235
TGFrame(const TGFrame &)=delete
UInt_t fHeight
frame height
Definition TGFrame.h:88
Int_t fBorderWidth
frame border width
Definition TGFrame.h:93
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:304
void MapWindow() override
map window
Definition TGFrame.h:206
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:675
Int_t GetX() const
Definition TGFrame.h:233
void UnmapWindow() override
unmap window
Definition TGFrame.h:208
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:637
const TGResourcePool * GetResourcePool() const
Definition TGFrame.h:123
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
Int_t GetY() const
Definition TGFrame.h:234
UInt_t GetWidth() const
Definition TGFrame.h:226
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:399
TGDimension GetDefaultSize() const override
Return dimension of MDI container.
TGMdiContainer(const TGMdiMainFrame *p, Int_t w, Int_t h, UInt_t options=0, ULong_t back=GetDefaultFrameBackground())
TGMdiContainer constructor.
Bool_t HandleConfigureNotify(Event_t *event) override
Handle configure notify events for MDI container.
const TGMdiMainFrame * fMain
This file contains all different MDI frame decoration classes.
TGMdiFrame * GetMdiFrame() const
TGMdiHorizontalWinResizer * GetLeftVR() const
Int_t GetMinimizedY() const
Int_t GetMinimizedX() const
Bool_t IsMaximized() const
Bool_t IsMinimized() const
void SetMinimizedX(Int_t x)
const char * GetWindowName()
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set resize mode (opaque or transparent).
void Layout() override
Recalculates the postion and the size of all decor frame components.
void Maximize(Bool_t max=kTRUE)
TGMdiCornerWinResizer * GetLowerRightCR() const
Int_t GetPreResizeWidth() const
void Minimize(Bool_t min=kTRUE)
const TGPicture * GetWindowIcon()
void SetPreResizeX(Int_t x)
Int_t GetPreResizeX() const
ULong_t GetMdiButtons() const
TGMdiHorizontalWinResizer * GetRightVR() const
void SetPreResizeWidth(Int_t w)
void SetMinimizedY(Int_t y)
void SetPreResizeY(Int_t y)
void SetMinUserPlacement(Bool_t place=kTRUE)
TGMdiTitleBar * GetTitleBar() const
TGMdiCornerWinResizer * GetLowerLeftCR() const
void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h) override
Move the MDI window at position x, y and set size to w, h.
virtual Int_t CloseWindow()
Int_t GetPreResizeY() const
TGMdiVerticalWinResizer * GetUpperHR() const
Int_t GetPreResizeHeight() const
TGMdiVerticalWinResizer * GetLowerHR() const
void SetPreResizeHeight(Int_t h)
void Move(Int_t x, Int_t y) override
Move the MDI window at position x, y.
void SetMdiButtons(ULong_t buttons)
Set-up MDI buttons.
TGMdiCornerWinResizer * GetUpperRightCR() const
Bool_t GetMinUserPlacement() const
TGMdiCornerWinResizer * GetUpperLeftCR() const
void SetDecorBorderWidth(Int_t bw)
Set border width of the decor.
void SetCyclePrev(TGMdiFrameList *prev)
UInt_t GetFrameId() const
void SetFrameId(UInt_t id)
void SetDecorFrame(TGMdiDecorFrame *decor)
TGMdiFrameList * GetCyclePrev() const
void SetPrev(TGMdiFrameList *prev)
void SetNext(TGMdiFrameList *next)
TGMdiDecorFrame * fDecor
MDI decor frame.
TGMdiFrameList * GetCycleNext() const
TGMdiDecorFrame * GetDecorFrame() const
TGMdiFrameList * GetNext() const
TGMdiFrameList * GetPrev() const
void SetCycleNext(TGMdiFrameList *next)
virtual Bool_t Help()
Definition TGMdiFrame.h:63
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a MDIframe as a C++ statement(s) on output stream out.
TGRectangle fIcon
client, decoration and icon rectangles
Int_t fValueMask
MDI hints mask.
TGRectangle fDecoration
TGRectangle fClient
This file contains the TGMdiMainFrame class.
TGMdiMenuBar * GetMenu() const
virtual void ArrangeFrames(Int_t mode)
Automatic repositioning and resizing of every MDI child window.
virtual void FramesArranged(Int_t mode)
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process messages MDI main frame.
TGMdiGeometry GetWindowGeometry(TGMdiFrame *f) const
Get MDI geometry of MDI child window f.
~TGMdiMainFrame() override
MDI main frame destructor.
void AddMdiFrame(TGMdiFrame *f)
Add new MDI child window.
virtual void Restore(TGMdiFrame *frame)
Restore size of MDI child window mdiframe.
virtual void FrameMinimized(Int_t id)
TGMdiMenuBar * fMenuBar
menu bar
virtual void FreeMove(TGMdiFrame *frame)
Allow to move MDI child window mdiframe.
Bool_t SetCurrent(TGMdiFrameList *newcurrent)
Set current (active) MDI child window (by frame list).
TGFont * fFontNotCurrent
fonts for active and inactive MDI children
Bool_t IsMinimized(TGMdiFrame *f)
Check if MDI child window f is minimized;.
virtual void FrameCreated(Int_t id)
TGMdiMainFrame(const TGWindow *p, TGMdiMenuBar *menu, Int_t w, Int_t h, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Create a MDI main frame.
TGFrame * fContainer
MDI container.
TGGC * fBoxGC
GC used to draw resizing box (rectangle).
virtual void CirculateDown()
Send the highest window to the bottom.
TGRectangle GetBBox() const
Return resizing box (rectangle) for current MDI child.
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set MDI windows resize mode (opaque or transparent).
TGMdiFrame * GetMdiFrame(UInt_t id) const
Return frame of MDI child window (by id).
Pixel_t fForeCurrent
back and fore colors for active MDI children
friend class TGMdiFrame
Long_t fNumberOfFrames
number of MDI child windows
Bool_t RemoveMdiFrame(TGMdiFrame *f)
Remove MDI child window.
virtual void FrameRestored(Int_t id)
virtual void Minimize(TGMdiFrame *frame)
Minimize MDI child window mdiframe.
virtual void CloseAll()
Close all MDI child windows.
virtual void CirculateUp()
Bring the lowest window to the top.
virtual void FrameClosed(Int_t id)
Pixel_t fBackNotCurrent
TGPopupMenu * fWinListMenu
popup menu with list of MDI child windows
TGMdiFrame * GetCurrent() const
Return pointer on current (active) MDI child window.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a MDI main frame as a C++ statement(s) on output stream out.
virtual void ArrangeMinimized()
This is an attempt to an "smart" minimized window re-arrangement.
Bool_t IsMaximized(TGMdiFrame *f)
Check if MDI child window f is maximized;.
virtual void FrameMaximized(Int_t id)
virtual void Maximize(TGMdiFrame *frame)
Maximize MDI child window mdiframe.
TGMdiFrameList * fChildren
list of MDI child windows
Int_t fResizeMode
current MDI child XY position and resize mode
Bool_t HandleKey(Event_t *event) override
Handle keyboards events into MDI main frame.
TGRectangle GetMinimizedBBox() const
Return minimized box (rectangle) for current MDI child.
void ConfigureWindow(TGMdiFrame *f, TGMdiGeometry &geom)
Set MDI geometry for MDI child window f.
virtual Int_t Close(TGMdiFrame *frame)
Close MDI child window mdiframe.
TGMdiFrameList * fCurrent
current list of MDI child windows
virtual void FreeSize(TGMdiFrame *frame)
Allow to resize MDI child window mdiframe.
TGFont * fFontCurrent
TGMdiDecorFrame * GetDecorFrame(UInt_t id) const
Return decor frame of MDI child window (by id).
void Layout() override
Recalculates the postion and the size of all MDI child windows.
void UpdateWinListMenu()
Update MDI menu entries with current list of MDI child windows.
Pixel_t fForeNotCurrent
back and fore colors for inactive MDI children
virtual Int_t ContextHelp(TGMdiFrame *frame)
Calls Help() method of MDI child window mdiframe.
void UpdateMdiButtons()
Update the status of MDI buttons in the decor frame of all children.
Int_t fArrangementMode
MDI children arrangement mode.
void LayoutButtons(UInt_t buttonmask, Bool_t isMinimized, Bool_t isMaximized)
Recalculates the position of every enabled (displayed) buttons.
TGMdiTitleIcon * GetWinIcon() const
void SetX0(Int_t x0)
void SetTitleBarColors(UInt_t fore, UInt_t back, TGFont *f)
Set title bar color (blue or grey, depends on active state).
void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Maximize().
void SetLeftButPressed(Bool_t press=kTRUE)
void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Restore().
void SetY0(Int_t y0)
TGMdiButtons * GetButtons() const
Bool_t HandleButton(Event_t *event) override
Handle button events in resizer (grab button and resize).
This class contains all information about a menu entry.
Definition TGMenu.h:57
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
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
This class creates a popup menu object.
Definition TGMenu.h:110
Int_t fY
y position
Definition TGDimension.h:39
Int_t fX
x position
Definition TGDimension.h:38
UInt_t fH
height
Definition TGDimension.h:94
UInt_t fW
width
Definition TGDimension.h:93
TGPosition LeftTop() const
Int_t fX
x position
Definition TGDimension.h:91
void Merge(const TGRectangle &r)
Int_t fY
y position
Definition TGDimension.h:92
TGPosition RightBottom() const
This class implements a pool for the default GUI resource set, like GC's, colors, fonts,...
const TGFont * GetMenuFont() const
Pixel_t GetSelectedBgndColor() const
Pixel_t GetSelectedFgndColor() const
Pixel_t GetFrameShadowColor() const
Pixel_t GetFrameBgndColor() const
virtual void SetHPos(Int_t xpos)
Moves content of container frame in horizontal direction.
Definition TGCanvas.cxx:175
virtual void SetVPos(Int_t ypos)
Moves content of container frame in vertical direction.
Definition TGCanvas.cxx:226
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:150
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
virtual Int_t MustCleanup() const
Definition TGWindow.h:116
TGWindow(Window_t id)
Definition TGWindow.h:34
virtual void LowerWindow()
lower window
Definition TGWindow.cxx:214
virtual void SetWindowName(const char *name=nullptr)
Set window name.
Definition TGWindow.cxx:127
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:334
Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2385
int main(int argc, char **argv)
Definition hadd.cxx:631
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
bool HasBeenDeleted(const TObject *obj)
Check if the TObject's memory has been deleted.
Definition TObject.h:409
Event structure.
Definition GuiTypes.h:175
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:176
Window_t fWindow
window reported event is relative to
Definition GuiTypes.h:177
UInt_t fState
key or button mask
Definition GuiTypes.h:182