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// //
35// TGMdiMainFrame. //
36// //
37// This file contains the TGMdiMainFrame class. //
38// //
39//////////////////////////////////////////////////////////////////////////
40
41#include "KeySymbols.h"
42#include "TGFrame.h"
43#include "TGMdiMainFrame.h"
44#include "TGMdiDecorFrame.h"
45#include "TGMdiFrame.h"
46#include "TGMdiMenu.h"
47#include "TGGC.h"
48#include "TGResourcePool.h"
49#include "TList.h"
50#include "TVirtualX.h"
51
52#include <iostream>
53
58
59////////////////////////////////////////////////////////////////////////////////
60/// Create a MDI main frame.
61
63 Int_t w, Int_t h, UInt_t options,
64 Pixel_t back) :
65 TGCanvas(p, w, h, options | kDoubleBorder | kSunkenFrame | kMdiMainFrame, back)
66{
67 fContainer = new TGMdiContainer(this, 10, 10, kOwnBackground,
70
72 fMenuBar = menuBar;
73 fChildren = 0;
74 fCurrent = 0;
76
77 const TGResourcePool *res = GetResourcePool();
84
85 fBoxGC = new TGGC(*gClient->GetResourcePool()->GetFrameGC());
93
94 fCurrentX = fCurrentY = 0;
96
98
100 if (main){
101 Int_t keycode = gVirtualX->KeysymToKeycode(kKey_Tab);
102 main->BindKey(this, keycode, kKeyControlMask);
103 main->BindKey(this, keycode, kKeyControlMask | kKeyShiftMask);
104 keycode = gVirtualX->KeysymToKeycode(kKey_F4);
105 main->BindKey(this, keycode, kKeyControlMask);
106 ((TGFrame *)main)->Connect("ProcessedConfigure(Event_t*)",
107 "TGMdiMainFrame", this, "UpdateMdiButtons()");
108 }
109
111 Layout();
112 MapWindow();
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// MDI main frame destructor.
118
120{
121 TGMdiFrameList *tmp, *travel = fChildren;
122
123 while (travel) {
124 tmp = travel->GetNext();
125 delete travel;
126 travel = tmp;
127 }
128
131
132 delete fBoxGC;
133
134 if (!MustCleanup()) {
135
137
138 if (main && main->InheritsFrom("TGMainFrame")) {
139 Int_t keycode = gVirtualX->KeysymToKeycode(kKey_Tab);
140 main->RemoveBind(this, keycode, kKeyControlMask);
141 main->RemoveBind(this, keycode, kKeyControlMask | kKeyShiftMask);
142 keycode = gVirtualX->KeysymToKeycode(kKey_F4);
143 main->RemoveBind(this, keycode, kKeyControlMask);
144 }
145 }
146}
147
148////////////////////////////////////////////////////////////////////////////////
149/// Set MDI windows resize mode (opaque or transparent).
150
152{
153 TGMdiFrameList *travel;
154
155 fResizeMode = mode;
156 for (travel = fChildren; travel; travel = travel->GetNext()) {
157 travel->GetDecorFrame()->SetResizeMode(mode);
158 }
159}
160
161////////////////////////////////////////////////////////////////////////////////
162/// Handle keyboards events into MDI main frame.
163
165{
166 char input[10];
167 UInt_t keysym;
168
169 if (event->fType == kGKeyPress) {
170 gVirtualX->LookupString(event, input, sizeof(input), keysym);
171 if ((EKeySym)keysym == kKey_Tab) {
172 if (event->fState & kKeyControlMask) {
173 if (event->fState & kKeyShiftMask) {
174 CirculateUp();
175 } else {
177 }
178 return kTRUE;
179 }
180 } else if ((EKeySym)keysym == kKey_F4) {
181 if (event->fState & kKeyControlMask) {
182 Close(GetCurrent());
183 return kTRUE;
184 }
185 }
186 }
187 return kFALSE;
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Add new MDI child window.
192
194{
195 TGMdiFrameList *travel;
196
197 frame->UnmapWindow();
198
199 travel = new TGMdiFrameList;
200 travel->SetCyclePrev(travel);
201 travel->SetCycleNext(travel);
202 travel->SetPrev(0);
203 if (fChildren) fChildren->SetPrev(travel);
204 travel->SetNext(fChildren);
205 fChildren = travel;
206
207 travel->SetDecorFrame(new TGMdiDecorFrame(this, frame, frame->GetWidth(),
208 frame->GetHeight(), fBoxGC));
209
210 travel->SetFrameId(frame->GetId());
212
213 if (fCurrentX + travel->GetDecorFrame()->GetWidth() > fWidth) fCurrentX = 0;
214 if (fCurrentY + travel->GetDecorFrame()->GetHeight() > fHeight) fCurrentY = 0;
216
220
222
224 SetCurrent(travel);
225 Layout();
226
228 FrameCreated(travel->GetDecorFrame()->GetId());
229}
230
231////////////////////////////////////////////////////////////////////////////////
232/// Remove MDI child window.
233
235{
236 TGMdiFrameList *travel = fChildren;
237
238 if (!frame) return kFALSE;
239
240 if (frame->IsEditable()) frame->SetEditable(kFALSE);
241
242 while (travel && (travel->GetFrameId() != frame->GetId()))
243 travel = travel->GetNext();
244 if (!travel) return kFALSE;
245
246 if (travel == fCurrent) fCurrent = 0;
247
248 // unlink the element from the fCycle list
249 travel->GetCyclePrev()->SetCycleNext(travel->GetCycleNext());
250 travel->GetCycleNext()->SetCyclePrev(travel->GetCyclePrev());
251
252 // and from the main list
253 if (travel->GetNext()) {
254 travel->GetNext()->SetPrev(travel->GetPrev());
255 }
256 if (travel->GetPrev()) {
257 travel->GetPrev()->SetNext(travel->GetNext());
258 } else {
259 fChildren = travel->GetNext();
260 }
261
262 if (!fCurrent) {
263 if (fChildren) SetCurrent(travel->GetCyclePrev());
264 }
265
266 travel->GetDecorFrame()->RemoveFrame(frame);
267
268 UInt_t old_id = frame->GetId();
269
270 delete travel->fDecor;
271
273
275 Layout();
276
278 FrameClosed(old_id);
279
280 return kTRUE;
281}
282
283////////////////////////////////////////////////////////////////////////////////
284/// Set current (active) MDI child window (by id).
285
287{
288 if (fCurrent && (fCurrent->GetDecorFrame()->GetId() == id)) {
293
294 Emit("SetCurrent(TGMdiFrame*)", (long)fCurrent->GetDecorFrame()->GetMdiFrame());
295 return kTRUE;
296 }
297
298 TGMdiFrameList *travel = fChildren;
299 while (travel && (travel->GetDecorFrame()->GetId() != id)) travel = travel->GetNext();
300 if (!travel) return kFALSE;
301
302 return SetCurrent(travel);
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Set current (active) MDI child window (by frame pointer).
307
309{
310 if (fCurrent && (fCurrent->GetDecorFrame()->GetMdiFrame() == f)) {
315 Emit("SetCurrent(TGMdiFrame*)", (long)fCurrent->GetDecorFrame()->GetMdiFrame());
316 return kTRUE;
317 }
318
319 TGMdiFrameList *travel = fChildren;
320 while (travel && (travel->GetDecorFrame()->GetMdiFrame() != f)) travel = travel->GetNext();
321 if (!travel) return kFALSE;
322
323 return SetCurrent(travel);
324}
325
326////////////////////////////////////////////////////////////////////////////////
327/// Set current (active) MDI child window (by frame list).
328
330{
331 if (fCurrent && (fCurrent == newcurrent)) {
336 Emit("SetCurrent(TGMdiFrame*)", (long)fCurrent->GetDecorFrame()->GetMdiFrame());
337 return kTRUE;
338 }
339
340 if (fCurrent) {
345 }
346
347 if (newcurrent) {
348 if (fCurrent) {
349 // unlink the element from the old position
350 newcurrent->GetCyclePrev()->SetCycleNext(newcurrent->GetCycleNext());
351 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent->GetCyclePrev());
352 // and link it to the top of the window fCycle stack
353 newcurrent->SetCyclePrev(fCurrent);
354 newcurrent->SetCycleNext(fCurrent->GetCycleNext());
355 fCurrent->SetCycleNext(newcurrent);
356 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent);
357 } else {
358 // no current? well, put it at the head of the list...
359 if (fChildren && newcurrent != fChildren) {
360 // unlink the element from the old position
361 newcurrent->GetCyclePrev()->SetCycleNext(newcurrent->GetCycleNext());
362 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent->GetCyclePrev());
363 // and link it to the beginning of the window list
364 newcurrent->SetCyclePrev(fChildren);
365 newcurrent->SetCycleNext(fChildren->GetCycleNext());
366 fChildren->SetCycleNext(newcurrent);
367 newcurrent->GetCycleNext()->SetCyclePrev(newcurrent);
368 }
369 }
370 }
371
372 fCurrent = newcurrent;
373
374 if (!fCurrent) return kFALSE;
375
380
382 Emit("SetCurrent(TGMdiFrame*)", (long)fCurrent->GetDecorFrame()->GetMdiFrame());
383
385
389
390 return kTRUE;
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// Bring the lowest window to the top.
395
397{
398 if (fCurrent) {
402
404
412
413 } else if (fChildren) {
415 }
416}
417
418////////////////////////////////////////////////////////////////////////////////
419/// Send the highest window to the bottom.
420
422{
423 if (fCurrent) {
428
429 fCurrent = fCurrent->GetCyclePrev(); // do not call SetCurrent in order
430 // to not to alter the stacking order
438 } else if (fChildren) {
440 }
441}
442
443////////////////////////////////////////////////////////////////////////////////
444/// Return decor frame of MDI child window (by frame pointer).
445
447{
448 TGMdiFrameList *travel = fChildren;
449 while (travel && (travel->GetDecorFrame()->GetMdiFrame() != frame))
450 travel = travel->GetNext();
451 if (!travel) return 0;
452 return travel->GetDecorFrame();
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// Return decor frame of MDI child window (by id).
457
459{
460 TGMdiFrameList *travel = fChildren;
461 while (travel && (travel->GetDecorFrame()->GetId() != id)) travel = travel->GetNext();
462 if (!travel) return 0;
463 return travel->GetDecorFrame();
464}
465
466////////////////////////////////////////////////////////////////////////////////
467/// Return frame of MDI child window (by id).
468
470{
471 TGMdiDecorFrame *frame = GetDecorFrame(id);
472 if (!frame) return 0;
473 return frame->GetMdiFrame();
474}
475
476////////////////////////////////////////////////////////////////////////////////
477/// Return resizing box (rectangle) for current MDI child.
478
480{
482 return TGRectangle(0, 0, fWidth - 2 * fBorderWidth, fHeight - 2 * fBorderWidth);
483 } else {
484 TGRectangle rect;
485 TGMdiFrameList *travel;
486
487 for (travel = fChildren; travel; travel = travel->GetNext()) {
488 Int_t x = travel->GetDecorFrame()->GetX();
489 Int_t y = travel->GetDecorFrame()->GetY();
490 UInt_t w = travel->GetDecorFrame()->GetWidth();
491 UInt_t h = travel->GetDecorFrame()->GetHeight();
492 TGRectangle wrect(x, y, w, h);
493 rect.Merge(wrect);
494 }
495 return rect;
496 }
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Return minimized box (rectangle) for current MDI child.
501
503{
504 TGRectangle rect;
505 TGMdiFrameList *travel;
506 Int_t first = kTRUE;
507
508 for (travel = fChildren; travel; travel = travel->GetNext()) {
509 if (travel->GetDecorFrame()->IsMinimized()) {
510 TGRectangle wrect(travel->GetDecorFrame()->GetX(), travel->GetDecorFrame()->GetY(),
511 travel->GetDecorFrame()->GetWidth(), travel->GetDecorFrame()->GetHeight());
512 if (first) rect = wrect;
513 else rect.Merge(wrect);
514 first = kFALSE;
515 }
516 }
517 return rect;
518}
519
520////////////////////////////////////////////////////////////////////////////////
521/// Update MDI menu entries with current list of MDI child windows.
522
524{
525 TString buf;
526 char scut;
527 TGMdiFrameList *travel;
528 const TGPicture *pic;
529
530 TGMenuEntry *e;
532 while ((e = (TGMenuEntry*)fNext())) {
534 }
535 scut = '0';
536
537 if (!fChildren) {
538 fWinListMenu->AddEntry(new TGHotString("(None)"), 1000);
540 return;
541 }
542
543 for (travel = fChildren; travel; travel = travel->GetNext()) {
544 scut++;
545 if (scut == ('9' + 1)) scut = 'A';
546 buf = TString::Format("&%c. %s", scut, travel->GetDecorFrame()->GetWindowName());
547 if (travel->GetDecorFrame()->GetMdiButtons() & kMdiMenu)
548 pic = travel->GetDecorFrame()->GetWindowIcon();
549 else
550 pic = 0;
551 fWinListMenu->AddEntry(new TGHotString(buf.Data()), travel->GetDecorFrame()->GetId(), 0, pic);
552 }
553
554 if (fCurrent)
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Recalculates the postion and the size of all MDI child windows.
560
562{
566 2 * fBorderWidth);
567}
568
569////////////////////////////////////////////////////////////////////////////////
570/// Update the status of MDI buttons in the decor frame of all children.
571
573{
574 static Bool_t done = kFALSE;
575 TGMdiFrameList *travel;
576 if (done) return;
577 for (travel = fChildren; travel; travel = travel->GetNext()) {
578 if (!travel->GetDecorFrame()->IsMaximized() &&
579 !travel->GetDecorFrame()->IsMinimized()) {
581 }
582 }
583 done = kTRUE;
584}
585
586////////////////////////////////////////////////////////////////////////////////
587/// Automatic repositionning and resizing of every MDI child window.
588/// depending on mode : tile horizontal, tile vertical, or cascade.
589
591{
592 Int_t factor_x = 0;
593 Int_t factor_y = 0;
594 Int_t num_mapped = 0;
595 Int_t x = 0;
596 Int_t y = 0;
597 Int_t w = fWidth - 2 * fBorderWidth; //GetContainer()->GetWidth();
598 Int_t h = fHeight - 2 * fBorderWidth; //GetContainer()->GetHeight();
599
600 fArrangementMode = mode;
601
602 TGMdiFrameList *tmp, *travel;
603
604 for (travel = fChildren; travel; travel = travel->GetNext()) {
605 if (travel->GetDecorFrame()->IsMaximized())
606 Restore(travel->GetDecorFrame()->GetMdiFrame());
607 if (!travel->GetDecorFrame()->IsMinimized())
608 ++num_mapped;
609 }
610
611 // must also restore view to 0,0
612 GetViewPort()->SetHPos(0);
613 GetViewPort()->SetVPos(0);
614
616
617 travel = fChildren;
618
619 if (num_mapped == 0) return;
620
622 h -= irect.fH;
623
624 switch (mode) {
626 factor_y = h / num_mapped;
627 for (travel = fChildren; travel; travel = travel->GetNext()) {
628 if (!travel->GetDecorFrame()->IsMinimized()) {
629 travel->GetDecorFrame()->MoveResize(x, y, w, factor_y);
630 y = y + factor_y;
631 }
632 }
633 break;
634
635 case kMdiTileVertical:
636 factor_x = w / num_mapped;
637 for (travel = fChildren; travel; travel = travel->GetNext()) {
638 if (!travel->GetDecorFrame()->IsMinimized()) {
639 travel->GetDecorFrame()->MoveResize(x, y, factor_x, h);
640 x = x + factor_x;
641 }
642 }
643 break;
644
645 case kMdiCascade:
646 y = travel->GetDecorFrame()->GetTitleBar()->GetX() +
647 travel->GetDecorFrame()->GetTitleBar()->GetHeight();
648 x = y;
649 factor_y = (h * 2) / 3;
650 factor_x = (w * 2) / 3;
651
652 travel = fCurrent;
653 if (!travel) travel = fChildren;
654 tmp = travel;
655 if (travel) {
656 do {
657 travel = travel->GetCycleNext();
658 if (!travel->GetDecorFrame()->IsMinimized()) {
659 travel->GetDecorFrame()->MoveResize(x - y, x - y, factor_x, factor_y);
660 x += y;
661 }
662 } while (travel != tmp);
663 }
664 break;
665 }
666
667 FramesArranged(mode);
668
669 Layout();
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// This is an attempt to an "smart" minimized window re-arrangement.
674
676{
677 TGMdiFrameList *travel, *closest;
678 Int_t x, y, w, h;
679
680 Bool_t arranged = kTRUE;
681
682 for (travel = fChildren; travel && arranged; travel = travel->GetNext())
683 if (travel->GetDecorFrame()->IsMinimized()) arranged = kFALSE;
684
685 // return if there is nothing to do
686
687 if (arranged || !fChildren) return;
688
692
693 x = 0;
694 y = GetViewPort()->GetHeight() - h;
695
696 // we'll use the _minimizedUserPlacement variable as a "not arranged" flag
697
698 for (travel = fChildren; travel; travel = travel->GetNext())
700
701 do {
702 closest = 0;
703 Int_t cdist = 0;
704 for (travel = fChildren; travel; travel = travel->GetNext()) {
705 if (travel->GetDecorFrame()->IsMinimized()) {
706 if (travel->GetDecorFrame()->GetMinUserPlacement()) {
707 Int_t dx = travel->GetDecorFrame()->GetX() - x;
708 Int_t dy = y - travel->GetDecorFrame()->GetY();
709 Int_t dist = dx * dx + dy * dy;
710 if (!closest || (dist < cdist)) {
711 closest = travel;
712 cdist = dist;
713 }
714 }
715 }
716 }
717
718 if (closest) {
719 closest->GetDecorFrame()->SetMinimizedX(x);
720 closest->GetDecorFrame()->SetMinimizedY(y);
721 closest->GetDecorFrame()->MoveResize(x, y, w, h);
723
724 x += w;
725 if (x + w > (Int_t)GetViewPort()->GetWidth()) {
726 x = 0;
727 y -= h;
728 }
729 }
730
731 } while (closest);
732
733 // reset the fMinimizedUserPlacement settings for all windows
734
735 for (travel = fChildren; travel; travel = travel->GetNext())
737}
738
739////////////////////////////////////////////////////////////////////////////////
740/// Process messages MDI main frame.
741
743{
744 switch (GET_MSG(msg)) {
745 case kC_MDI:
746 SetCurrent(parm1);
747 switch (GET_SUBMSG(msg)) {
748
749 case kMDI_MINIMIZE:
751 break;
752
753 case kMDI_MAXIMIZE:
755 break;
756
757 case kMDI_RESTORE:
759 break;
760
761 case kMDI_CLOSE:
762 Close(GetCurrent());
763 break;
764
765 case kMDI_MOVE:
767 break;
768
769 case kMDI_SIZE:
771 break;
772
773 case kMDI_HELP:
775 break;
776 }
777 break;
778
779 default:
780 return TGCanvas::ProcessMessage(msg, parm1, parm2);
781 }
782
783 return kTRUE;
784}
785
786////////////////////////////////////////////////////////////////////////////////
787/// Maximize MDI child window mdiframe.
788
790{
791 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
792
793 if (!frame) return;
794
795 if (frame->IsMaximized()) return;
796
797 if (frame->IsMinimized()) Restore(mdiframe);
798
799 frame->SetDecorBorderWidth(0);
800 frame->SetPreResizeX(frame->GetX());
801 frame->SetPreResizeY(frame->GetY());
802 frame->SetPreResizeWidth(frame->GetWidth());
803 frame->SetPreResizeHeight(frame->GetHeight());
804 frame->GetUpperHR()->UnmapWindow();
805 frame->GetLowerHR()->UnmapWindow();
806 frame->GetLeftVR()->UnmapWindow();
807 frame->GetRightVR()->UnmapWindow();
808 frame->GetUpperLeftCR()->UnmapWindow();
809 frame->GetUpperRightCR()->UnmapWindow();
810 frame->GetLowerLeftCR()->UnmapWindow();
811 frame->GetLowerRightCR()->UnmapWindow();
812
814 fHeight - 2 * fBorderWidth);
815 frame->Maximize();
816 frame->GetTitleBar()->LayoutButtons(frame->GetMdiButtons(), frame->IsMinimized(),
817 frame->IsMaximized());
818 frame->GetTitleBar()->RemoveFrames(frame->GetTitleBar()->GetWinIcon(),
819 frame->GetTitleBar()->GetButtons());
820 frame->HideFrame(frame->GetTitleBar());
821
822 if (fMenuBar) {
826 frame->GetTitleBar()->GetButtons());
827 fMenuBar->Layout();
828 }
829
831 FrameMaximized(frame->GetId());
832
833 Layout();
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Restore size of MDI child window mdiframe.
838
840{
841 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
842
843 if (!frame) return;
844
845 if (frame->IsMinimized() == kFALSE && frame->IsMaximized() == kFALSE) return;
846
847 if (frame->IsMinimized()) {
848 frame->SetMinimizedX(frame->GetX());
849 frame->SetMinimizedY(frame->GetY());
850 frame->Minimize(kFALSE);
854 } else if (frame->IsMaximized()) {
856 frame->MapSubwindows();
857
858 if (fMenuBar) {
860 frame->GetTitleBar()->GetButtons());
861 fMenuBar->Layout();
862 }
863
864 frame->GetTitleBar()->AddFrames(frame->GetTitleBar()->GetWinIcon(),
865 frame->GetTitleBar()->GetButtons());
868 frame->ShowFrame(frame->GetTitleBar());
869 }
870 frame->Minimize(kFALSE);
871 frame->Maximize(kFALSE);
873 frame->MoveResize(frame->GetPreResizeX(), frame->GetPreResizeY(),
874 frame->GetPreResizeWidth(), frame->GetPreResizeHeight());
875 SetCurrent(mdiframe);
877 FrameRestored(frame->GetId());
878
879 Layout();
880}
881
882////////////////////////////////////////////////////////////////////////////////
883/// Minimize MDI child window mdiframe.
884
886{
887 Int_t x, y, w, h;
888 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
889
890 if (!frame) return;
891
892 if (frame->IsMinimized()) return;
893
894 if (frame->IsMaximized()) Restore(mdiframe);
895
896 frame->SetPreResizeX(frame->GetX());
897 frame->SetPreResizeY(frame->GetY());
898 frame->SetPreResizeWidth(frame->GetWidth());
899 frame->SetPreResizeHeight(frame->GetHeight());
900
901 h = frame->GetTitleBar()->GetDefaultHeight() + frame->GetBorderWidth();
902 w = kMinimizedWidth * h + frame->GetBorderWidth();
903
904 if (!frame->GetMinUserPlacement()) {
905
906 x = 0;
907 y = GetViewPort()->GetHeight() - h;
908
909 while (1) {
910 TGMdiFrameList *travel;
911 Bool_t taken = kFALSE;
912
913 // find an empty spot...
914 for (travel = fChildren; travel; travel = travel->GetNext()) {
915 if (travel->GetDecorFrame()->IsMinimized()) {
916 TGPosition p(travel->GetDecorFrame()->GetX(),
917 travel->GetDecorFrame()->GetY());
918 TGDimension s(travel->GetDecorFrame()->GetWidth(),
919 travel->GetDecorFrame()->GetHeight());
920 if ((x <= p.fX + (Int_t) s.fWidth - 1) && (x + w - 1 >= p.fX) &&
921 (y <= p.fY + (Int_t) s.fHeight - 1) && (y + h - 1 >= p.fY)) {
922 taken = kTRUE;
923 break;
924 }
925 }
926 }
927 if (!taken) break;
928
929 x += w;
930 if (x + w > (Int_t)GetViewPort()->GetWidth()) {
931 x = 0;
932 y -= h;
933 }
934 }
935
936 frame->SetMinimizedX(x);
937 frame->SetMinimizedY(y);
938 }
939
940 frame->Minimize();
941
942 frame->MoveResize(frame->GetMinimizedX(), frame->GetMinimizedY(), w, h);
943 frame->LowerWindow();
944 frame->GetTitleBar()->LayoutButtons(frame->GetMdiButtons(),
945 frame->IsMinimized(),
946 frame->IsMaximized());
947 frame->Layout();
948
950 FrameMinimized(frame->GetId());
951
952 Layout();
953}
954
955////////////////////////////////////////////////////////////////////////////////
956/// Close MDI child window mdiframe.
957
959{
960 if (!mdiframe) return kFALSE;
961
962 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
963 Restore(mdiframe);
964 mdiframe->Emit("CloseWindow()");
965 if (frame && mdiframe->TestBit(kNotDeleted) && !mdiframe->TestBit(TGMdiFrame::kDontCallClose))
966 return frame->CloseWindow();
967 return kTRUE;
968}
969
970////////////////////////////////////////////////////////////////////////////////
971/// Allow to move MDI child window mdiframe.
972
974{
975 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
976 if (!frame) return;
977
978 Int_t x = frame->GetTitleBar()->GetWidth() / 2;
979 Int_t y = frame->GetTitleBar()->GetHeight() - 1;
980
981 gVirtualX->Warp(x, y, frame->GetTitleBar()->GetId());
982
983 frame->GetTitleBar()->SetLeftButPressed();
984 frame->GetTitleBar()->SetX0(x);
985 frame->GetTitleBar()->SetY0(y);
986 Cursor_t cursor = gVirtualX->CreateCursor(kMove);
987 gVirtualX->SetCursor(frame->GetTitleBar()->GetId(), cursor);
988
989 gVirtualX->GrabPointer(frame->GetTitleBar()->GetId(),
991 kNone, cursor, kTRUE, kFALSE);
992}
993
994////////////////////////////////////////////////////////////////////////////////
995/// Allow to resize MDI child window mdiframe.
996
998{
999 TGMdiDecorFrame *frame = GetDecorFrame(mdiframe);
1000 if (!frame) return;
1001
1002 Int_t x = frame->GetLowerRightCR()->GetWidth() - 5;
1003 Int_t y = frame->GetLowerRightCR()->GetHeight() - 5;
1004
1005 Int_t xroot, yroot;
1006 Window_t win;
1007
1008 gVirtualX->TranslateCoordinates(frame->GetLowerRightCR()->GetId(),
1009 fClient->GetDefaultRoot()->GetId(), x, y, xroot, yroot, win);
1010
1011 gVirtualX->Warp(x, y, frame->GetLowerRightCR()->GetId());
1012
1013 Event_t event;
1014
1015 event.fType = kButtonPress;
1016 event.fWindow = frame->GetLowerRightCR()->GetId();
1017 event.fCode = kButton1;
1018 event.fX = x;
1019 event.fY = y;
1020 event.fXRoot = xroot;
1021 event.fYRoot = yroot;
1022
1023 Cursor_t cursor = gVirtualX->CreateCursor(kBottomRight);
1024 gVirtualX->SetCursor(frame->GetLowerRightCR()->GetId(), cursor);
1025
1026 gVirtualX->GrabPointer(frame->GetLowerRightCR()->GetId(),
1028 kNone, cursor, kTRUE, kFALSE);
1029
1030 frame->GetLowerRightCR()->HandleButton(&event);
1031}
1032
1033////////////////////////////////////////////////////////////////////////////////
1034/// Calls Help() method of MDI child window mdiframe.
1035
1037{
1038 if (mdiframe)
1039 return mdiframe->Help();
1040 else
1041 return kFALSE;
1042}
1043
1044////////////////////////////////////////////////////////////////////////////////
1045/// Return pointer on current (active) MDI child window.
1046
1048{
1049 if (fCurrent)
1050 return fCurrent->GetDecorFrame()->GetMdiFrame();
1051 else
1052 return 0;
1053}
1054
1055////////////////////////////////////////////////////////////////////////////////
1056/// Get MDI geometry of MDI child window f.
1057
1059{
1060 TGMdiGeometry geom;
1061
1062 geom.fValueMask = 0;
1063
1064 const TGMdiDecorFrame *frame = GetDecorFrame(f);
1065 if (frame) {
1066 Int_t th = frame->GetTitleBar()->GetDefaultHeight();
1067 Int_t bw = frame->GetBorderWidth();
1068
1069 if (frame->IsMinimized() || frame->IsMaximized()) {
1070 geom.fDecoration = TGRectangle(frame->GetPreResizeX(),
1071 frame->GetPreResizeY(),
1072 (unsigned) frame->GetPreResizeWidth(),
1073 (unsigned) frame->GetPreResizeHeight());
1074 } else {
1075 geom.fDecoration = TGRectangle(frame->GetX(),
1076 frame->GetY(),
1077 (unsigned) frame->GetWidth(),
1078 (unsigned) frame->GetHeight());
1079 }
1081
1082 geom.fClient = TGRectangle(geom.fDecoration.fX + bw,
1083 geom.fDecoration.fY + bw + th,
1084 (unsigned) (geom.fDecoration.fW - 2 * bw),
1085 (unsigned) (geom.fDecoration.fH - 2 * bw - th));
1087
1088 if (frame->GetMinUserPlacement()) {
1089 Int_t mh = th + 2 * bw;
1090 Int_t mw = kMinimizedWidth * mh;
1091
1092 geom.fIcon = TGRectangle(frame->GetMinimizedX(),
1093 frame->GetMinimizedY(),
1094 (unsigned) mw,
1095 (unsigned) mh);
1097 }
1098
1099 }
1100
1101 return geom;
1102}
1103
1104////////////////////////////////////////////////////////////////////////////////
1105/// Set MDI geometry for MDI child window f.
1106
1108{
1110 if (frame) {
1111 if (geom.fValueMask & kMdiDecorGeometry) {
1112 if (frame->IsMinimized() || frame->IsMaximized()) {
1113 frame->SetPreResizeX(geom.fDecoration.fX);
1114 frame->SetPreResizeY(geom.fDecoration.fY);
1115 frame->SetPreResizeWidth(geom.fDecoration.fW);
1116 frame->SetPreResizeHeight(geom.fDecoration.fH);
1117 } else {
1118 frame->MoveResize(geom.fDecoration.fX, geom.fDecoration.fY,
1119 geom.fDecoration.fW, geom.fDecoration.fH);
1120 }
1121 } else if (geom.fValueMask & kMdiClientGeometry) {
1122
1123 }
1124 if (geom.fValueMask & kMdiIconGeometry) {
1125 frame->SetMinimizedX(geom.fIcon.fX);
1126 frame->SetMinimizedY(geom.fIcon.fY);
1127 frame->SetMinUserPlacement();
1128 if (frame->IsMinimized())
1129 frame->Move(frame->GetMinimizedX(), frame->GetMinimizedY());
1130 }
1131 Layout();
1132 }
1133}
1134
1135////////////////////////////////////////////////////////////////////////////////
1136/// Close all MDI child windows.
1137
1139{
1140 TGMdiFrameList *tmp, *travel = fChildren;
1141
1142 while (travel) {
1143 tmp = travel->GetNext();
1144 SetCurrent(travel);
1145 Close(GetCurrent());
1146 travel = tmp;
1147 }
1148}
1149
1150////////////////////////////////////////////////////////////////////////////////
1151/// Check if MDI child window f is maximized;
1152
1154{
1156 if (frame) return frame->IsMaximized();
1157 return kFALSE;
1158}
1159
1160////////////////////////////////////////////////////////////////////////////////
1161/// Check if MDI child window f is minimized;
1162
1164{
1166 if (frame) return frame->IsMinimized();
1167 return kFALSE;
1168}
1169
1170////////////////////////////////////////////////////////////////////////////////
1171/// TGMdiContainer constructor.
1172
1174 UInt_t options, ULong_t back) :
1175 TGFrame(p->GetViewPort(), w, h, options, back)
1176{
1177 fMain = p;
1179}
1180
1181////////////////////////////////////////////////////////////////////////////////
1182/// Return dimension of MDI container.
1183
1185{
1186 TGRectangle rect = fMain->GetBBox();
1187
1188 Int_t xpos = -fMain->GetViewPort()->GetHPos() - rect.LeftTop().fX;
1189 Int_t ypos = -fMain->GetViewPort()->GetVPos() - rect.LeftTop().fY;
1190
1191 return TGDimension(TMath::Max(Int_t(xpos + fWidth), rect.RightBottom().fX + 1),
1192 TMath::Max(Int_t(ypos + fHeight), rect.RightBottom().fY + 1));
1193}
1194
1195////////////////////////////////////////////////////////////////////////////////
1196/// Handle configure notify events for MDI container.
1197
1199{
1200 if (event->fWindow != fId) {
1201 TGRectangle rect = fMain->GetBBox();
1202
1203 Int_t vw = fMain->GetViewPort()->GetWidth();
1204 Int_t vh = fMain->GetViewPort()->GetHeight();
1205
1206 Int_t w = TMath::Max(vw, rect.RightBottom().fX + 1);
1207 Int_t h = TMath::Max(vh, rect.RightBottom().fY + 1);
1208
1209 if ((w != (Int_t)fWidth) || (h != (Int_t)fHeight)) {
1210 ((TGMdiMainFrame*)fMain)->Layout();
1211 return kTRUE;
1212 }
1213 }
1214 return kFALSE;
1215}
1216
1217////////////////////////////////////////////////////////////////////////////////
1218/// Save a MDI main frame as a C++ statement(s) on output stream out
1219
1220void TGMdiMainFrame::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
1221{
1223
1224 out << std::endl << " // MDI main frame" << std::endl;
1225 out << " TGMdiMainFrame *";
1226 out << GetName() << " = new TGMdiMainFrame(" << fParent->GetName()
1227 << "," << GetMenu()->GetName() << "," << GetWidth() << "," << GetHeight();
1228
1230 if (!GetOptions()) {
1231 out << ");" << std::endl;
1232 } else {
1233 out << "," << GetOptionString() <<");" << std::endl;
1234 }
1235 } else {
1236 out << "," << GetOptionString() << ",ucolor);" << std::endl;
1237 }
1238 if (option && strstr(option, "keep_names"))
1239 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
1240
1241 TGMdiFrameList *travel=fChildren;
1242 travel->SetCycleNext(travel);
1243 for (travel = fChildren; travel; travel = travel->GetNext()) {
1244 TGMdiFrame *mf = travel->GetDecorFrame()->GetMdiFrame();
1245 if (mf) mf->SavePrimitive(out, option);
1246 }
1247 if (fArrangementMode) {
1248 out << " " << GetName() << "->ArrangeFrames(";
1249 switch (fArrangementMode) {
1250
1251 case kMdiTileHorizontal:
1252 out << "kMdiTileHorizontal);" << std::endl;
1253 break;
1254
1255 case kMdiTileVertical:
1256 out << "kMdiTileVertical);" << std::endl;
1257 break;
1258
1259 case kMdiCascade:
1260 out << "kMdiCascade);" << std::endl;
1261 break;
1262 }
1263 }
1264 if (fResizeMode != kMdiOpaque)
1265 out << " " << GetName() << "->SetResizeMode(kMdiNonOpaque);" << std::endl;
1266
1267 if (fCurrent)
1268 out << " " << GetName() << "->SetCurrent(" << GetCurrent()->GetName()
1269 << ");" << std::endl;
1270}
1271
1272
@ kGKeyPress
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
@ kGXxor
src XOR dst
Definition GuiTypes.h:74
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
const Mask_t kKeyShiftMask
Definition GuiTypes.h:195
@ kSunkenFrame
Definition GuiTypes.h:383
@ kDoubleBorder
Definition GuiTypes.h:385
@ kMdiMainFrame
Definition GuiTypes.h:394
@ kOwnBackground
Definition GuiTypes.h:391
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kKeyControlMask
Definition GuiTypes.h:197
const Mask_t kStructureNotifyMask
Definition GuiTypes.h:166
@ kFillOpaqueStippled
Definition GuiTypes.h:51
@ kIncludeInferiors
Definition GuiTypes.h:53
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
@ kBottomRight
Definition GuiTypes.h:372
@ kMove
Definition GuiTypes.h:374
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton1
Definition GuiTypes.h:214
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
Definition RtypesCore.h:45
const Int_t kMaxInt
Definition RtypesCore.h:103
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
#define gClient
Definition TGClient.h:166
@ kMdiDecorGeometry
@ kMdiIconGeometry
@ kMdiClientGeometry
@ kMdiDefaultResizeMode
@ kMdiOpaque
@ kMdiTileVertical
@ kMdiCascade
@ kMdiTileHorizontal
@ kMdiMenu
#define gVirtualX
Definition TVirtualX.h:338
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:232
virtual void MapSubwindows()
Map all canvas sub windows.
TGViewPort * GetViewPort() const
Definition TGCanvas.h:227
virtual void Layout()
Create layout for canvas.
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle message generated by the canvas scrollbars.
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:233
const TGResourcePool * GetResourcePool() const
Definition TGClient.h:133
void FreeFont(const TGFont *font)
Free a font.
Definition TGClient.cxx:363
Pixel_t GetShadow(Pixel_t base_color) const
Return pixel value of shadow color based on base_color.
Definition TGClient.cxx:480
virtual void SetEditable(Bool_t on=kTRUE)
Switch ON/OFF edit mode.
Definition TGFrame.cxx:933
virtual void Layout()
Layout the elements of the composite frame.
Definition TGFrame.cxx:1242
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1149
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1189
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:350
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1134
virtual Bool_t IsEditable() const
Return kTRUE if frame is being edited.
Definition TGFrame.cxx:912
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1175
UInt_t fHeight
Definition TGDimension.h:30
UInt_t fWidth
Definition TGDimension.h:29
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:324
Int_t GetBorderWidth() const
Definition TGFrame.h:257
UInt_t fHeight
Definition TGFrame.h:112
Int_t fBorderWidth
Definition TGFrame.h:117
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:297
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition TGFrame.cxx:630
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:668
Int_t GetX() const
Definition TGFrame.h:255
virtual UInt_t GetOptions() const
Definition TGFrame.h:221
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition TGFrame.cxx:2465
const TGResourcePool * GetResourcePool() const
Definition TGFrame.h:147
UInt_t fWidth
Definition TGFrame.h:111
UInt_t GetHeight() const
Definition TGFrame.h:249
Int_t GetY() const
Definition TGFrame.h:256
virtual void MapWindow()
map window
Definition TGFrame.h:228
UInt_t GetWidth() const
Definition TGFrame.h:248
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition TGFrame.cxx:2438
Pixel_t fBackground
Definition TGFrame.h:119
virtual void UnmapWindow()
unmap window
Definition TGFrame.h:230
Definition TGGC.h:31
void SetLineWidth(Int_t v)
Set line width.
Definition TGGC.cxx:299
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
void SetBackground(Pixel_t v)
Set background color.
Definition TGGC.cxx:288
void SetFunction(EGraphicsFunction v)
Set graphics context drawing function.
Definition TGGC.cxx:255
void SetStipple(Pixmap_t v)
Set 1 plane pixmap for stippling.
Definition TGGC.cxx:377
void SetSubwindowMode(Int_t v)
Set sub window mode (kClipByChildren, kIncludeInferiors).
Definition TGGC.cxx:421
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handle configure notify events for MDI container.
virtual TGDimension GetDefaultSize() const
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.
const TGMdiMainFrame * fMain
virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
Move the MDI window at position x, y and set size to w, h.
TGMdiFrame * GetMdiFrame() const
TGMdiHorizontalWinResizer * GetLeftVR() const
Int_t GetMinimizedY() const
virtual void Layout()
Recalculates the postion and the size of all decor frame components.
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 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
virtual Int_t CloseWindow()
virtual void Move(Int_t x, Int_t y)
Move the MDI window at position x, y.
Int_t GetPreResizeY() const
TGMdiVerticalWinResizer * GetUpperHR() const
Int_t GetPreResizeHeight() const
TGMdiVerticalWinResizer * GetLowerHR() const
void SetPreResizeHeight(Int_t h)
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
TGMdiFrameList * GetCycleNext() const
TGMdiDecorFrame * GetDecorFrame() const
TGMdiFrameList * GetNext() const
TGMdiFrameList * GetPrev() const
void SetCycleNext(TGMdiFrameList *next)
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a MDIframe as a C++ statement(s) on output stream out.
virtual Bool_t Help()
Definition TGMdiFrame.h:72
TGRectangle fIcon
TGRectangle fDecoration
TGRectangle fClient
TGMdiMenuBar * GetMenu() const
virtual void ArrangeFrames(Int_t mode)
Automatic repositionning and resizing of every MDI child window.
virtual void FramesArranged(Int_t mode)
TGMdiGeometry GetWindowGeometry(TGMdiFrame *f) const
Get MDI geometry of MDI child window f.
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
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
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
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).
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 ~TGMdiMainFrame()
MDI main frame destructor.
virtual void FrameClosed(Int_t id)
Pixel_t fBackNotCurrent
TGPopupMenu * fWinListMenu
TGMdiFrame * GetCurrent() const
Return pointer on current (active) MDI child window.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
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
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages MDI main frame.
TGRectangle GetMinimizedBBox() const
Return minimized box (rectangle) for current MDI child.
virtual Bool_t HandleKey(Event_t *event)
Handle keyboards events into MDI main frame.
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
virtual void FreeSize(TGMdiFrame *frame)
Allow to resize MDI child window mdiframe.
TGFont * fFontCurrent
virtual void Layout()
Recalculates the postion and the size of all MDI child windows.
TGMdiDecorFrame * GetDecorFrame(UInt_t id) const
Return decor frame of MDI child window (by id).
void UpdateWinListMenu()
Update MDI menu entries with current list of MDI child windows.
Pixel_t fForeNotCurrent
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.
void ShowFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Maximize().
void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Maximize().
Definition TGMdiMenu.cxx:95
void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Restore()
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
virtual Bool_t HandleButton(Event_t *event)
Handle button events in resizer (grab button and resize).
TGClient * fClient
Definition TGObject.h:37
Handle_t GetId() const
Definition TGObject.h:47
Handle_t fId
Definition TGObject.h:36
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1723
virtual void DeleteEntry(Int_t id)
Delete entry with specified id from menu.
Definition TGMenu.cxx:1925
virtual void RCheckEntry(Int_t id, Int_t IDfirst, Int_t IDlast)
Radio-select entry (note that they cannot be unselected, the selection must be moved to another entry...
Definition TGMenu.cxx:1859
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:989
const TList * GetListOfEntries() const
Definition TGMenu.h:213
TGPosition LeftTop() const
void Merge(const TGRectangle &r)
TGPosition RightBottom() const
const TGFont * GetMenuFont() const
Pixmap_t GetCheckeredBitmap() const
Pixel_t GetSelectedBgndColor() const
Pixel_t GetSelectedFgndColor() const
Pixel_t GetFrameShadowColor() const
Pixel_t GetFrameBgndColor() const
Int_t GetHPos() const
Definition TGCanvas.h:194
Int_t GetVPos() const
Definition TGCanvas.h:195
virtual void SetHPos(Int_t xpos)
Moves content of container frame in horizontal direction.
Definition TGCanvas.cxx:174
virtual void SetVPos(Int_t ypos)
Moves content of container frame in vertical direction.
Definition TGCanvas.cxx:225
virtual void SetWindowName(const char *name=0)
Set window name.
Definition TGWindow.cxx:128
virtual const TGWindow * GetMainFrame() const
Returns top level main frame.
Definition TGWindow.cxx:151
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:335
const TGWindow * fParent
Definition TGWindow.h:36
virtual Int_t MustCleanup() const
Definition TGWindow.h:117
virtual void LowerWindow()
lower window
Definition TGWindow.cxx:215
virtual void RaiseWindow()
raise window
Definition TGWindow.cxx:207
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:187
@ kNotDeleted
object has not been deleted
Definition TObject.h:78
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
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:2331
int main()
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Short_t Max(Short_t a, Short_t b)
Definition TMathBase.h:212
Definition first.py:1
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Window_t fWindow
window reported event is relative to
Definition GuiTypes.h:176
UInt_t fState
key or button mask
Definition GuiTypes.h:181