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