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