Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGMdiDecorFrame.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 TGMdiDecorFrame
35 \ingroup guiwidgets
36
37This file contains all different MDI frame decoration classes.
38
39*/
40
41
42#include <cstdio>
43#include <cstdlib>
44
45#include "KeySymbols.h"
46#include "TGResourcePool.h"
47#include "TGDimension.h"
48#include "WidgetMessageTypes.h"
49#include "TGMdiFrame.h"
50#include "TGMdiDecorFrame.h"
51#include "TGMdiMainFrame.h"
52#include "TVirtualX.h"
53
54
55
56////////////////////////////////////////////////////////////////////////////////
57/// TGMdiDecorFrame constructor.
58/// The TGMdiDecorFrame is the frame containing MDI decorations like
59/// title bar, minimize, maximize, restore and close buttons, and resizers.
60
62 Int_t w, Int_t h, const TGGC *boxGC,
63 UInt_t options, Pixel_t back) :
64 TGCompositeFrame(main->GetContainer(), w, h,
65 options | kOwnBackground | kVerticalFrame | kFixedSize, back)
66{
67
69 fEditDisabled = 1;
70 fFrame = frame;
76
78
80
83
86
95
108
117
119
121 fFrame->fParent = this;
123
126 Layout();
127
128 MapWindow();
130
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// TGMdiDecorFrame destructor.
137
139{
140 if (!MustCleanup()) {
141 delete fUpperHR;
142 delete fLowerHR;
143 delete fLeftVR;
144 delete fRightVR;
145 delete fUpperLeftCR;
146 delete fLowerLeftCR;
147 delete fUpperRightCR;
148 delete fLowerRightCR;
149 }
151}
152
153////////////////////////////////////////////////////////////////////////////////
154/// Set border width of the decor.
155
160
161////////////////////////////////////////////////////////////////////////////////
162/// Set-up MDI buttons.
163
188
189////////////////////////////////////////////////////////////////////////////////
190/// Set resize mode (opaque or transparent)
191
203
204////////////////////////////////////////////////////////////////////////////////
205/// Recalculates the postion and the size of all decor frame components.
206
236
237////////////////////////////////////////////////////////////////////////////////
238/// Set MDI Window name (appearing in the title bar)
239
245
246////////////////////////////////////////////////////////////////////////////////
247/// Set Window icon (appearing in the title bar)
248
254
255////////////////////////////////////////////////////////////////////////////////
256/// Move the MDI window at position x, y.
257
270
271////////////////////////////////////////////////////////////////////////////////
272/// Move the MDI window at position x, y and set size to w, h.
273
286
287////////////////////////////////////////////////////////////////////////////////
288/// Handle configure notify event.
289
291{
292 if ((event->fX < 0) || (event->fY < 0) ||
293 (event->fX + event->fWidth > fMdiMainFrame->GetViewPort()->GetWidth()) ||
294 (event->fY + event->fHeight > fMdiMainFrame->GetViewPort()->GetHeight())) {
296 }
297
298 if (event->fWindow == fFrame->GetId()) {
299 UInt_t newW = event->fWidth + 2 * fBorderWidth;
300 UInt_t newH = event->fHeight + 2 * fBorderWidth +
302
303 if ((fWidth != newW) || (fHeight != newH)) {
304 Resize(newW, newH);
305 }
307 return kTRUE;
308 }
310 return kFALSE;
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Handle mouse button events.
315
317{
318 if (event->fType == kButtonPress) {
319 void *ud;
322 }
323 return kTRUE;
324}
325
326
327////////////////////////////////////////////////////////////////////////////////
328/// TGMdiTitleBar constructor.
329/// the TGMdiTitleBar is the frame containing a title (window name)
330/// an icon and MDI picture buttons as minimize, maximize, restore,
331/// close and help.
332
334 const char *name) :
336{
337 fMdiWin = mdiwin;
339 fWinName = 0;
341
343
346 //fMiddleHint = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 1, 1, 1);
349
350 fLFrame = new TGCompositeFrame(this, 10, 10, kHorizontalFrame);
351 fMFrame = new TGCompositeFrame(this, 10, 10, kHorizontalFrame);
352 fRFrame = new TGCompositeFrame(this, 10, 10, kHorizontalFrame);
356
357 fWinIcon = new TGMdiTitleIcon(fLFrame, this,
358 fClient->GetPicture("mdi_default.xpm"),
359 16, 16);
361
362 fWinName = new TGLabel(fMFrame, new TGString(name));
365
366 fButtons = new TGMdiButtons(fRFrame, this);
368
369 MapWindow();
371 Layout();
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// TGMdiTitleBar destructor.
377
379{
380 if (!MustCleanup()) {
381 delete fLHint;
382 delete fLeftHint;
383 delete fMiddleHint;
384 delete fRightHint;
385 }
386}
387
388////////////////////////////////////////////////////////////////////////////////
389/// Recalculates the position of every enabled (displayed) buttons.
390
393{
395
396 if (buttonmask & kMdiSize) {
398 } else {
400 }
401
402 if (buttonmask & kMdiMenu) {
404 } else {
406 }
407
408 if (buttonmask & kMdiClose) {
411 } else {
414 }
415
416 if (buttonmask & kMdiHelp) {
418 } else {
420 }
421
422 if ((buttonmask & kMdiMaximize) && (!isMaximized)) {
425 } else {
428 }
429
430 if (isMinimized | isMaximized) {
435 } else {
438 }
439
440 if ((buttonmask & kMdiMinimize) && (!isMinimized)) {
443 } else {
446 }
447
448 Layout();
449}
450
451////////////////////////////////////////////////////////////////////////////////
452/// Set title bar color (blue or grey, depends on active state).
453
473
474////////////////////////////////////////////////////////////////////////////////
475/// Handle double click in title bar (maximize window)
476
478{
479 if ((event->fType == kButtonPress) && (event->fCode == kButton1)) {
481 }
482 return kTRUE;
483}
484
485////////////////////////////////////////////////////////////////////////////////
486/// Handle mouse click on title bar.
487
489{
490 if (event->fType == kButtonPress) {
491 void *ud;
493 gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kMove));
494 switch (event->fCode) {
495 case kButton1:
496 fX0 = event->fX;
497 fY0 = event->fY;
500 break;
501
502 case kButton2:
504 break;
505
506 case kButton3:
507 gVirtualX->LowerWindow(fParent->GetId());
509 break;
510 }
511 } else {
512 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);
513 gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kPointer));
514 switch (event->fCode) {
515
516 case kButton1:
517 //if (!fClient->IsEditable()) ((TGMainFrame *)((TGMdiMainFrame *)fMdiWin)->GetMainFrame())->Layout();
519 break;
520
521 case kButton2:
523 break;
524
525 case kButton3:
527 break;
528 }
529
530 TGFrame *f = GetFrameFromPoint(event->fX, event->fY);
531 if (f && (f != this)) {
532 TranslateCoordinates(f, event->fX, event->fY, event->fX, event->fY);
533 f->HandleButton(event);
534 }
535 }
536 return kTRUE;
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Process messages for title bar.
541
543{
544 switch (GET_MSG(msg)) {
545 case kC_COMMAND:
546 switch (GET_SUBMSG(msg)) {
547 case kCM_BUTTON:
548 case kCM_MENU:
550 fParent->GetId(), parm2);
551 break;
552 }
553 break;
554 }
555 return kTRUE;
556}
557
558////////////////////////////////////////////////////////////////////////////////
559/// Handle mouse motion events in title bar (used to move MDI window).
560
562{
563 if (event->fWindow != fId) return kTRUE;
564 if (!fLeftButPressed) return kTRUE;
565
566 Int_t x = ((TGFrame *)fParent)->GetX();
567 Int_t y = ((TGFrame *)fParent)->GetY();
568 ((TGFrame *)fParent)->Move(x + event->fX - fX0, y + event->fY - fY0);
569
570 return kTRUE;
571}
572
573
574////////////////////////////////////////////////////////////////////////////////
575/// This is called from TGMdiMainFrame on Restore().
576
586
587
588////////////////////////////////////////////////////////////////////////////////
589/// This is called from TGMdiMainFrame on Maximize().
590
596
597
598////////////////////////////////////////////////////////////////////////////////
599/// TGMdiButtons constructor.
600/// the TGMdiButtons is the frame containing MDI picture buttons like
601/// minimize, maximize, restore, close and help.
602
605{
606 fDefaultHint = new TGLayoutHints(kLHintsNormal, 0, 0, 1, 0);
607 fCloseHint = new TGLayoutHints(kLHintsNormal, 2, 0, 1, 0);
609 fMsgWindow = 0;
610
611 //--- Minimize button
612
613 fButton[0] = new TGPictureButton(this,
614 fClient->GetPicture("mdi_minimize.xpm"),
616 fButton[0]->SetToolTipText("Minimize");
620
621 //--- Restore button
622
623 fButton[1] = new TGPictureButton(this,
624 fClient->GetPicture("mdi_restore.xpm"),
626 fButton[1]->SetToolTipText("Restore");
630
631 //--- Maximize button
632
633 fButton[2] = new TGPictureButton(this,
634 fClient->GetPicture("mdi_maximize.xpm"),
636 fButton[2]->SetToolTipText("Maximize");
640
641 //--- Help button
642
643 fButton[3] = new TGPictureButton(this,
644 fClient->GetPicture("mdi_help.xpm"),
645 kMdiHelp);
646 fButton[3]->SetToolTipText("Help");
650
651 //--- Close button
652
653 fButton[4] = new TGPictureButton(this,
654 fClient->GetPicture("mdi_close.xpm"),
655 kMdiClose);
656 fButton[4]->SetToolTipText("Close");
661}
662
663////////////////////////////////////////////////////////////////////////////////
664/// TGMdiButtons destructor.
665
667{
668 if (!MustCleanup()) {
669 delete fDefaultHint;
670 delete fCloseHint;
671 }
672}
673
674////////////////////////////////////////////////////////////////////////////////
675/// TGMdiTitleIcon constructor.
676/// the TGMdiTitleIcon is the left icon used also for the MDI
677/// popup menu allowing access to MDI commands as : restore,
678/// move, size, minimize and close.
679
681 const TGPicture *pic, Int_t w, Int_t h) :
682 TGIcon(p, pic, w, h)
683{
686
687 //--- MDI system menu
688
689 fPopup = new TGPopupMenu(fClient->GetDefaultRoot());// fClient->GetRoot());
690 fPopup->AddEntry(new TGHotString("&Restore"), kMdiRestore);
691 fPopup->AddEntry(new TGHotString("&Move"), kMdiMove);
692 fPopup->AddEntry(new TGHotString("&Size"), kMdiSize);
693 fPopup->AddEntry(new TGHotString("Mi&nimize"), kMdiMinimize);
694 fPopup->AddEntry(new TGHotString("Ma&ximize"), kMdiMaximize);
696 fPopup->AddEntry(new TGHotString("&Close Ctrl+F4"), kMdiClose);
699
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// TGMdiTitleIcon destructor.
706
711
712////////////////////////////////////////////////////////////////////////////////
713/// Redraw icon.
714
716{
717 gVirtualX->ClearArea(fId, 0, 0, fWidth, fHeight);
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Handle double click event on MDI icon (close the window)
723
725{
726 if (event->fCode == kButton1) {
727 void *ud;
728 fPopup->EndMenu(ud);
729 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);
731 }
732 return kTRUE;
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Handle button event on MDI icon (popup menu)
737
739{
741
742 if (event->fType == kButtonPress) {
743 fPopup->PlaceMenu(event->fXRoot - event->fX,
744 event->fYRoot + (fHeight - event->fY),
745 kTRUE, kTRUE);
746 }
747 return kTRUE;
748}
749
750
751////////////////////////////////////////////////////////////////////////////////
752/// TGMdiWinResizer constructor.
753/// The TGMdiWinResizer is a frame allowing to resize MDI window.
754/// Could be horizontal, vertical or corner resizer (see derived classes
755/// TGMdiVerticalWinResizer, TGMdiHorizontalWinResizer, and
756/// TGMdiCornerWinResizer).
757
759 Int_t pos, const TGGC *boxgc, Int_t linew,
760 Int_t mdioptions, Int_t w, Int_t h, UInt_t options) :
761 TGFrame(p, w, h, options)
762{
763 fWinX = fWinY = fWinW = fWinH = fOldX = fOldY = fOldW = fOldH = 0;
764 fNewX = fNewY = fNewW = fNewH = fX0 = fY0 = 0;
765
767
768 fMdiWin = mdiwin;
770 fPos = pos;
771
772 fBoxGC = boxgc;
773 fLineW = linew;
774
775 fMinW = 50;
776 fMinH = 20;
777
779
780 gVirtualX->GrabButton(fId, kButton1, kAnyModifier,
782 kNone, kNone);
784}
785
786////////////////////////////////////////////////////////////////////////////////
787/// Handle button events in resizer (grab button and resize).
788
790{
791 if (!IsEnabled()) return kTRUE;
792
793 if (event->fType == kButtonPress) {
794 void *ud;
795 ((TGMdiDecorFrame *)fParent)->GetTitleBar()->GetWinIcon()->GetPopup()->EndMenu(ud);
796 switch (event->fCode) {
797 case kButton1:
799 fNewX = fOldX = fWinX = ((TGFrame *)fParent)->GetX();
800 fNewY = fOldY = fWinY = ((TGFrame *)fParent)->GetY();
801 fWinW = ((TGFrame *)fParent)->GetWidth();
802 fWinH = ((TGFrame *)fParent)->GetHeight();
803 fX0 = event->fXRoot;
804 fY0 = event->fYRoot;
805 fNewW = fWinW;
806 fNewH = fWinH;
807 if (fMdiOptions != kMdiOpaque) {
809 }
813 break;
814
815 case kButton2:
817 break;
818
819 case kButton3:
821 break;
822 }
823 } else {
824 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);
825 switch (event->fCode) {
826 case kButton1:
827 if (fMdiOptions != kMdiOpaque) {
829 ((TGFrame *)fParent)->MoveResize(fNewX, fNewY, fNewW, fNewH);
830 }
831 //if (!fClient->IsEditable()) ((TGMainFrame *)((TGMdiMainFrame *)fMdiWin)->GetMainFrame())->Layout();
833 break;
834
835 case kButton2:
837 break;
838
839 case kButton3:
841 break;
842 }
843 }
844 return kTRUE;
845}
846
847////////////////////////////////////////////////////////////////////////////////
848/// Draw resize box (rectangle).
849
851{
853
854 gVirtualX->DrawRectangle(m->GetContainer()->GetId(), fBoxGC->GetGC(),
855 x + fLineW / 2, y + fLineW / 2, width - fLineW, height - fLineW);
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Move (resize) parent MDI window.
860
862{
863 if (fMdiOptions == kMdiOpaque) {
864 ((TGFrame *)fParent)->MoveResize(fNewX, fNewY, fNewW, fNewH);
865 } else {
868 }
869}
870
871
872////////////////////////////////////////////////////////////////////////////////
873/// TGMdiVerticalWinResizer constructor.
874
883
884////////////////////////////////////////////////////////////////////////////////
885/// Handle motion events in resizer (resize associated MDI window).
886
888{
889 if (((TGMdiDecorFrame *)fParent)->IsMinimized()) return kTRUE;
890
891 fOldX = fNewX;
892 fOldY = fNewY;
893 fOldW = fNewW;
894 fOldH = fNewH;
895
896 Int_t dy = event->fYRoot - fY0;
897
898 if (!fLeftButPressed) return kTRUE;
899
900 switch (fPos) {
901 case kMdiResizerTop:
902 if (fWinH - dy < fMinH) dy = fWinH - fMinH;
903 fNewY = fWinY + dy;
904 fNewH = fWinH - dy;
905 break;
906
908 if (fWinH + dy < fMinH) dy = fMinH - fWinH;
909 fNewY = fWinY;
910 fNewH = fWinH + dy;
911 break;
912 }
913
914 MoveResizeIt();
915
916 return kTRUE;
917}
918
919////////////////////////////////////////////////////////////////////////////////
920/// Draw vertical resizer frame border.
921
923{
924 gVirtualX->ClearArea(fId, 0, 0, fWidth, fHeight);
925 if (fPos == kMdiResizerTop) {
926 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, 1, fWidth - 1, 1);
927 } else {
928 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, fHeight - 2, fWidth - 1,
929 fHeight - 2);
930 gVirtualX->DrawLine(fId, GetBlackGC()(), 0, fHeight - 1, fWidth - 1,
931 fHeight - 1);
932 }
933}
934
935
936////////////////////////////////////////////////////////////////////////////////
937/// TGMdiCornerWinResizer constructor.
938
940 const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew,
944{
947
948 switch (fPos) {
950 defaultCursor = gVirtualX->CreateCursor(kTopLeft);
951 break;
952
954 defaultCursor = gVirtualX->CreateCursor(kBottomLeft);
955 break;
956
958 defaultCursor = gVirtualX->CreateCursor(kTopRight);
959 break;
960
962 defaultCursor = gVirtualX->CreateCursor(kBottomRight);
963 break;
964 }
965 gVirtualX->SetCursor(fId, defaultCursor);
966}
967
968////////////////////////////////////////////////////////////////////////////////
969/// Handle motion events in resizer (resize associated MDI window).
970
972{
973 if (((TGMdiDecorFrame *)fParent)->IsMinimized()) return kTRUE;
974
975 fOldX = fNewX;
976 fOldY = fNewY;
977 fOldW = fNewW;
978 fOldH = fNewH;
979
980 Int_t dx = event->fXRoot - fX0;
981 Int_t dy = event->fYRoot - fY0;
982
983 if (!fLeftButPressed) return kTRUE;
984
985 switch (fPos) {
987 if (fWinW - dx < fMinW) dx = fWinW - fMinW;
988 if (fWinH - dy < fMinH) dy = fWinH - fMinH;
989 fNewX = fWinX + dx;
990 fNewW = fWinW - dx;
991 fNewY = fWinY + dy;
992 fNewH = fWinH - dy;
993 break;
994
996 if (fWinW - dx < fMinW) dx = fWinW - fMinW;
997 if (fWinH + dy < fMinH) dy = fMinH - fWinH;
998 fNewX = fWinX + dx;
999 fNewW = fWinW - dx;
1000 fNewY = fWinY;
1001 fNewH = fWinH + dy;
1002 break;
1003
1005 if (fWinW + dx < fMinW) dx = fMinW - fWinW;
1006 if (fWinH - dy < fMinH) dy = fWinH - fMinH;
1007 fNewX = fWinX;
1008 fNewW = fWinW + dx;
1009 fNewY = fWinY + dy;
1010 fNewH = fWinH - dy;
1011 break;
1012
1014 if (fWinW + dx < fMinW) dx = fMinW - fWinW;
1015 if (fWinH + dy < fMinH) dy = fMinH - fWinH;
1016 fNewX = fWinX;
1017 fNewW = fWinW + dx;
1018 fNewY = fWinY;
1019 fNewH = fWinH + dy;
1020 break;
1021 }
1022
1023 MoveResizeIt();
1024
1025 return kTRUE;
1026}
1027
1028////////////////////////////////////////////////////////////////////////////////
1029/// Draw corner resizer frame border.
1030
1032{
1033 gVirtualX->ClearArea(fId, 0, 0, fWidth, fHeight);
1034
1035 switch (fPos) {
1037 gVirtualX->DrawLine(fId, GetHilightGC()(), 1, 1, fWidth - 1, 1);
1038 gVirtualX->DrawLine(fId, GetHilightGC()(), 1, 1, 1, fHeight - 1);
1039 break;
1040
1042 gVirtualX->DrawLine(fId, GetHilightGC()(), 1, 0, 1, fHeight - 1);
1043 gVirtualX->DrawLine(fId, GetShadowGC()(), 1, fHeight - 2,
1044 fWidth - 1, fHeight - 2);
1045 gVirtualX->DrawLine(fId, GetBlackGC()(), 0, fHeight - 1,
1046 fWidth - 1, fHeight - 1);
1047 break;
1048
1050 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, 1, fWidth - 1, 1);
1051 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth - 2, 1,
1052 fWidth - 2, fHeight - 1);
1053 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth - 1, 0,
1054 fWidth - 1, fHeight - 1);
1055 break;
1056
1058 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth - 2, 0,
1059 fWidth - 2, fHeight - 2);
1060 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, fHeight - 2,
1061 fWidth - 1, fHeight - 2);
1062 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth - 1, 0,
1063 fWidth - 1, fHeight - 1);
1064 gVirtualX->DrawLine(fId, GetBlackGC()(), 0, fHeight - 1,
1065 fWidth - 1, fHeight - 1);
1066 break;
1067 }
1068}
1069
1070
1071////////////////////////////////////////////////////////////////////////////////
1072/// TGMdiHorizontalWinResizer constructor.
1073
1084
1085////////////////////////////////////////////////////////////////////////////////
1086/// Handle motion events in resizer (resize associated MDI window).
1087
1089{
1090 if (((TGMdiDecorFrame *)fParent)->IsMinimized()) return kTRUE;
1091
1092 fOldX = fNewX;
1093 fOldY = fNewY;
1094 fOldW = fNewW;
1095 fOldH = fNewH;
1096
1097 Int_t dx = event->fXRoot - fX0;
1098
1099 if (!fLeftButPressed) return kTRUE;
1100
1101 switch (fPos) {
1102 case (kMdiResizerLeft):
1103 if (fWinW - dx < fMinW) dx = fWinW - fMinW;
1104 fNewX = fWinX + dx;
1105 fNewW = fWinW - dx;
1106 break;
1107
1108 case (kMdiResizerRight):
1109 if (fWinW + dx < fMinW) dx = fMinW - fWinW;
1110 fNewX = fWinX;
1111 fNewW = fWinW + dx;
1112 break;
1113 }
1114
1115 MoveResizeIt();
1116
1117 return kTRUE;
1118}
1119
1120////////////////////////////////////////////////////////////////////////////////
1121/// Draw horizontal resizer frame border.
1122
1124{
1125 gVirtualX->ClearArea(fId, 0, 0, fWidth, fHeight);
1126 if (fPos == kMdiResizerLeft) {
1127 gVirtualX->DrawLine(fId, GetHilightGC()(), 1, 0, 1, fHeight - 1);
1128 } else {
1129 gVirtualX->DrawLine(fId, GetShadowGC()(), fWidth - 2, 0, fWidth - 2, fHeight - 1);
1130 gVirtualX->DrawLine(fId, GetBlackGC()(), fWidth - 1, 0, fWidth - 1, fHeight - 1);
1131 }
1132}
@ kButtonPress
Definition GuiTypes.h:60
@ kTopLeft
Definition GuiTypes.h:372
@ kBottomRight
Definition GuiTypes.h:372
@ kArrowVer
Definition GuiTypes.h:374
@ kMove
Definition GuiTypes.h:374
@ kTopRight
Definition GuiTypes.h:372
@ kBottomLeft
Definition GuiTypes.h:372
@ kArrowHor
Definition GuiTypes.h:374
@ kPointer
Definition GuiTypes.h:375
const Mask_t kButtonMotionMask
Definition GuiTypes.h:164
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kAnyModifier
Definition GuiTypes.h:210
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kVerticalFrame
Definition GuiTypes.h:381
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
@ kFixedSize
Definition GuiTypes.h:390
@ 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 kStructureNotifyMask
Definition GuiTypes.h:166
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton2
Definition GuiTypes.h:214
@ kButton3
Definition GuiTypes.h:214
@ kButton1
Definition GuiTypes.h:214
int main()
Definition Prototype.cxx:12
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
@ kDeepCleanup
Definition TGFrame.h:42
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsNormal
Definition TGLayout.h:32
@ kLHintsExpandX
Definition TGLayout.h:30
@ kMdiResizerRight
@ kMdiResizerLeft
@ kMdiResizerBottom
@ kMdiResizerTop
@ kMdiOpaque
@ kMdiMinimize
@ kMdiMove
@ kMdiHelp
@ kMdiMenu
@ kMdiSize
@ kMdiRestore
@ kMdiMaximize
@ kMdiClose
@ kMdiDefaultHints
@ kTextLeft
Definition TGWidget.h:23
@ kWidgetIsEnabled
Definition TGWidget.h:37
winID h TVirtualViewer3D TVirtualGLPainter p
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 TranslateCoordinates
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
#define gVirtualX
Definition TVirtualX.h:337
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Int_t GET_MSG(Long_t val)
EWidgetMessageTypes
WidgetMessageTypes.
@ kMDI_CLOSE
@ kCM_MENU
@ kC_COMMAND
@ kCM_BUTTON
@ kMDI_CURRENT
@ kMDI_MAXIMIZE
Int_t GET_SUBMSG(Long_t val)
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:439
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
virtual void SetHsbPosition(Int_t newPos)
Set position of horizontal scrollbar.
TGViewPort * GetViewPort() const
Definition TGCanvas.h:217
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition TGClient.cxx:233
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:356
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:380
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:289
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGFrame.h:318
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
TGFrame * GetFrameFromPoint(Int_t x, Int_t y) override
Get frame located at specified point.
Definition TGFrame.cxx:1300
Int_t MustCleanup() const override
Definition TGFrame.h:362
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
UInt_t GetDefaultHeight() const override
Definition TGFrame.h:316
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1249
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition TGFrame.cxx:1196
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1064
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition TGFrame.cxx:1141
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition TGFrame.cxx:1182
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:331
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:621
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:727
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:597
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
Definition TGFrame.cxx:340
UInt_t fHeight
frame height
Definition TGFrame.h:88
void ReparentWindow(const TGWindow *p, Int_t x=0, Int_t y=0) override
Reparent window, make p the new parent and position the window at position (x,y) in new parent.
Definition TGFrame.h:204
Int_t fBorderWidth
frame border width
Definition TGFrame.h:93
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:304
virtual void Activate(Bool_t)
Definition TGFrame.h:212
void MapWindow() override
map window
Definition TGFrame.h:206
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:747
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:675
void Move(Int_t x, Int_t y) override
Move frame.
Definition TGFrame.cxx:585
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
Definition TGFrame.cxx:637
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:757
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:227
UInt_t GetWidth() const
Definition TGFrame.h:226
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
This class handles GUI icons.
Definition TGIcon.h:22
virtual void SetPicture(const TGPicture *pic)
Set icon picture.
Definition TGIcon.cxx:78
void DoRedraw() override
Redraw picture.
Definition TGIcon.cxx:125
This class handles GUI labels.
Definition TGLabel.h:24
void SetTextJustify(Int_t tmode)
Set text justification.
Definition TGLabel.cxx:395
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition TGLabel.cxx:361
virtual void SetText(TGString *newText)
Set new text in label.
Definition TGLabel.cxx:179
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition TGLabel.cxx:323
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
~TGMdiButtons() override
TGMdiButtons destructor.
TGPictureButton * fButton[5]
MDI picture buttons.
TGPictureButton * GetButton(Int_t no) const
TGMdiButtons(const TGWindow *p, const TGWindow *titlebar)
TGMdiButtons constructor.
TGLayoutHints * fCloseHint
Layout hints.
TGLayoutHints * fDefaultHint
const TGWindow * fMsgWindow
window handling container messages
Bool_t HandleMotion(Event_t *event) override
Handle motion events in resizer (resize associated MDI window).
void DrawBorder() override
Draw corner resizer frame border.
TGMdiCornerWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=20, Int_t h=20)
TGMdiCornerWinResizer constructor.
This file contains all different MDI frame decoration classes.
Bool_t HandleConfigureNotify(Event_t *event) override
Handle configure notify event.
TGMdiTitleBar * fTitlebar
MDI window title bar.
~TGMdiDecorFrame() override
TGMdiDecorFrame destructor.
TGMdiVerticalWinResizer * fUpperHR
Bool_t IsMaximized() const
Bool_t IsMinimized() const
TGLayoutHints * fExpandHint
layout hints
TGMdiVerticalWinResizer * fLowerHR
upper and lower vertical resizers
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set resize mode (opaque or transparent)
ULong_t fButtonMask
mask used to display/hide buttons
TGMdiCornerWinResizer * fUpperLeftCR
void Layout() override
Recalculates the postion and the size of all decor frame components.
TGMdiHorizontalWinResizer * fLeftVR
TGLayoutHints * fLHint
Bool_t fIsMaximized
minimized and maximized flags
Bool_t fMinimizedUserPlacement
user placement flag
TGMdiMainFrame * fMdiMainFrame
MDI main frame.
void SetWindowName(const char *name) override
Set MDI Window name (appearing in the title bar)
void SetWindowIcon(const TGPicture *pic)
Set Window icon (appearing in the title bar)
TGMdiFrame * fFrame
parent (owner) MDI frame
TGMdiDecorFrame(TGMdiMainFrame *main, TGMdiFrame *frame, Int_t w, Int_t h, const TGGC *boxGC, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
TGMdiDecorFrame constructor.
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.
Int_t fMinimizedY
minimized position
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 * fLowerRightCR
upper right and lower right resizers
TGMdiCornerWinResizer * fUpperRightCR
Bool_t HandleButton(Event_t *event) override
Handle mouse button events.
void SetDecorBorderWidth(Int_t bw)
Set border width of the decor.
TGMdiCornerWinResizer * fLowerLeftCR
upper left and lower left resizers
TGMdiHorizontalWinResizer * fRightVR
left and right horizontal resizers
This file contains the TGMdiFrame class.
Definition TGMdiFrame.h:42
void DrawBorder() override
Draw horizontal resizer frame border.
TGMdiHorizontalWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=5, Int_t h=4)
TGMdiHorizontalWinResizer constructor.
Bool_t HandleMotion(Event_t *event) override
Handle motion events in resizer (resize associated MDI window).
This file contains the TGMdiMainFrame class.
void Layout() override
Recalculates the postion and the size of all MDI child windows.
Bool_t HandleButton(Event_t *event) override
Handle mouse click on title bar.
void LayoutButtons(UInt_t buttonmask, Bool_t isMinimized, Bool_t isMaximized)
Recalculates the position of every enabled (displayed) buttons.
TGMdiTitleIcon * GetWinIcon() const
TGLayoutHints * fLeftHint
void SetTitleBarColors(UInt_t fore, UInt_t back, TGFont *f)
Set title bar color (blue or grey, depends on active state).
TGLabel * GetWinName() const
TGLayoutHints * fMiddleHint
TGMdiTitleBar(const TGWindow *p, const TGWindow *mdiwin, const char *name="Untitled")
TGMdiTitleBar constructor.
void RemoveFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Maximize().
TGCompositeFrame * fLFrame
Int_t fY0
initial position of the mouse click
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process messages for title bar.
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click in title bar (maximize window)
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion events in title bar (used to move MDI window).
Bool_t fMidButPressed
mouse button pressed
void AddFrames(TGMdiTitleIcon *icon, TGMdiButtons *buttons)
This is called from TGMdiMainFrame on Restore().
TGLabel * fWinName
window name label
const TGWindow * fMdiWin
owner MDI window
~TGMdiTitleBar() override
TGMdiTitleBar destructor.
TGCompositeFrame * fMFrame
TGMdiTitleIcon * fWinIcon
title icon
TGMdiButtons * fButtons
MDI buttons.
TGCompositeFrame * fRFrame
the three parts of the title bar
TGLayoutHints * fLHint
TGLayoutHints * fRightHint
layout hints
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click event on MDI icon (close the window)
TGMdiTitleIcon(const TGWindow *p, const TGWindow *titlebar, const TGPicture *pic, Int_t w, Int_t h)
TGMdiTitleIcon constructor.
Bool_t HandleButton(Event_t *event) override
Handle button event on MDI icon (popup menu)
TGPopupMenu * GetPopup() const
void DoRedraw() override
Redraw icon.
~TGMdiTitleIcon() override
TGMdiTitleIcon destructor.
const TGWindow * fMsgWindow
window handling container messages
TGPopupMenu * fPopup
Popup menu associated to the title icon.
TGMdiVerticalWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=4, Int_t h=5)
TGMdiVerticalWinResizer constructor.
void DrawBorder() override
Draw vertical resizer frame border.
Bool_t HandleMotion(Event_t *event) override
Handle motion events in resizer (resize associated MDI window).
Int_t fPos
position of the resizer
const TGGC * fBoxGC
GC used for resizing rectangle.
TGMdiWinResizer(const TGWindow *p, const TGWindow *mdiwin, Int_t pos, const TGGC *boxGC, Int_t linew, Int_t mdioptions=kMdiDefaultResizeMode, Int_t w=1, Int_t h=1, UInt_t options=kOwnBackground)
TGMdiWinResizer constructor.
Int_t fNewH
new MDI win position and dimension
Bool_t HandleButton(Event_t *event) override
Handle button events in resizer (grab button and resize).
Int_t fMdiOptions
MDI options.
Int_t fLineW
line width of resizing rectangle
const TGWindow * fMdiWin
owner MDI Window
void MoveResizeIt()
Move (resize) parent MDI window.
void SetResizeMode(Int_t mode)
Int_t fY0
initial position of the mouse click
Bool_t fMidButPressed
mouse buttons flags
void SetMinSize(Int_t w=50, Int_t h=20)
void DrawBox(Int_t x, Int_t y, UInt_t width, UInt_t height)
Draw resize box (rectangle).
Int_t fWinH
MDI win position and dimension.
Int_t fOldH
old MDI win position and dimension
Int_t fMinH
Min width and height of the MDI Win.
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
Yield an action as soon as it is clicked.
Definition TGButton.h:228
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:1720
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition TGMenu.cxx:1701
virtual void Associate(const TGWindow *w)
Definition TGMenu.h:206
virtual Int_t EndMenu(void *&userData)
Close menu and return ID of selected menu item.
Definition TGMenu.cxx:1285
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1056
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:986
virtual void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode, Bool_t grab_pointer)
Popup a popup menu.
Definition TGMenu.cxx:1237
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
virtual void Associate(const TGWindow *w)
Definition TGWidget.h:72
Int_t fWidgetFlags
widget status flags (OR of EWidgetStatus)
Definition TGWidget.h:47
Bool_t IsEnabled() const
Definition TGWidget.h:69
ROOT GUI Window base class.
Definition TGWindow.h:23
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
virtual void DestroyWindow()
destroy window
Definition TGWindow.cxx:190
virtual void SetWindowName(const char *name=nullptr)
Set window name.
Definition TGWindow.cxx:127
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition TGWindow.cxx:293
virtual void RaiseWindow()
raise window
Definition TGWindow.cxx:206
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Int_t fXRoot
Definition GuiTypes.h:179
UInt_t fWidth
Definition GuiTypes.h:182
UInt_t fHeight
width and height of exposed area
Definition GuiTypes.h:182
Window_t fWindow
window reported event is relative to
Definition GuiTypes.h:176
Int_t fYRoot
coordinates relative to root
Definition GuiTypes.h:179
Int_t fX
Definition GuiTypes.h:178
UInt_t fCode
key or button code
Definition GuiTypes.h:180
TMarker m
Definition textangle.C:8