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