ROOT  6.06/09
Reference Guide
TGCanvas.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 11/01/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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  This source is based on Xclass95, a Win95-looking GUI toolkit.
14  Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15 
16  Xclass95 is free software; you can redistribute it and/or
17  modify it under the terms of the GNU Library General Public
18  License as published by the Free Software Foundation; either
19  version 2 of the License, or (at your option) any later version.
20 
21 **************************************************************************/
22 
23 //////////////////////////////////////////////////////////////////////////
24 // //
25 // TGCanvas and TGViewPort and TGContainer //
26 // //
27 // A TGCanvas is a frame containing two scrollbars (a horizontal and //
28 // a vertical) and a viewport. The viewport acts as the window through //
29 // which we look at the contents of the container frame. //
30 // //
31 // A TGContainer frame manages a content area. It can display and //
32 // control a hierarchy of multi-column items, and provides the ability //
33 // to add new items at any time. By default it doesn't map subwindows //
34 // which are items of the container. In this case subwindow must //
35 // provide DrawCopy method, see for example TGLVEntry class. //
36 // It is also possible to use option which allow to map subwindows. //
37 // This option has much slower drawing speed in case of more than 1000 //
38 // items placed in container. To activate this option the fMapSubwindows//
39 // data member must be set to kTRUE (for example TTVLVContainer class) //
40 // //
41 // The TGContainer class can handle the keys: //
42 // //
43 // o F7, Ctnrl-F - activate search dialog //
44 // o F3, Ctnrl-G - continue search //
45 // o End - go to the last item in container //
46 // o Home - go to the first item in container //
47 // o PageUp,PageDown,arrow keys - navigate inside container //
48 // o Return/Enter - equivalent to double click of the mouse button //
49 // o Contrl-A - select/activate all items. //
50 // o Space - invert selection. //
51 // //
52 //////////////////////////////////////////////////////////////////////////
53 
54 #include "TGCanvas.h"
55 #include "TGListView.h"
56 #include "TGScrollBar.h"
57 #include "TTimer.h"
58 #include "KeySymbols.h"
59 #include "TSystem.h"
60 #include "TGTextEditDialogs.h"
61 #include "TGMsgBox.h"
62 #include "TGResourcePool.h"
63 #include "TList.h"
64 #include "TClass.h"
65 #include "TGListView.h"
66 #include "TGMimeTypes.h"
67 #include "TKey.h"
68 #include "TKeyMapFile.h"
69 #include "TGDNDManager.h"
70 #include "Riostream.h"
71 #include "RConfigure.h"
72 #include <stdlib.h>
73 
74 
75 TGGC *TGContainer::fgLineGC = 0;
76 
78 const Int_t kAcceleration[kAutoScrollFudge+1] = {1,1,1,2,3,4,6,7,8,16,32};
79 const Int_t kKeyboardTime = 700;
80 
84 
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 
88 class TGContainerKeyboardTimer : public TTimer {
89 private:
90  TGContainer *fContainer;
91 public:
92  TGContainerKeyboardTimer(TGContainer *t) : TTimer(kKeyboardTime) { fContainer = t; }
93  Bool_t Notify();
94 };
95 
96 ////////////////////////////////////////////////////////////////////////////////
97 /// single shot timer
98 
100 {
101  fContainer->SearchPattern();
102  Reset();
103  if (gSystem) gSystem->RemoveTimer(this);
104  return kFALSE;
105 }
106 
107 ////////////////////////////////////////////////////////////////////////////////
108 
109 class TGContainerScrollTimer : public TTimer {
110 private:
111  TGContainer *fContainer;
112 public:
113  TGContainerScrollTimer(TGContainer *t) : TTimer(50) { fContainer = t; }
114  Bool_t Notify();
115 };
116 
117 ////////////////////////////////////////////////////////////////////////////////
118 /// on-timeout
119 
121 {
122  fContainer->OnAutoScroll();
123  Reset();
124  return kFALSE;
125 }
126 
127 
128 ////////////////////////////////////////////////////////////////////////////////
129 /// Create a viewport object.
130 
132  UInt_t options, ULong_t back) :
133  TGCompositeFrame(p, w, h, options, back)
134 {
135  fContainer = 0;
136  fX0 = fY0 = 0;
137 
139  SetWindowName();
141 }
142 
143 ////////////////////////////////////////////////////////////////////////////////
144 /// Add container frame to the viewport. We must make sure that the added
145 /// container is at least a TGCompositeFrame (TGCanvas::AddFrame depends
146 /// on it).
147 
149 {
150  if (!f) {
152  fContainer = 0;
153  return;
154  }
155 
156  if (!fContainer) {
157  fContainer = f;
158  AddFrame(f, 0);
160 
162  ((TGContainer*)fContainer)->fViewPort = this;
164  ((TGContainer*)fContainer)->fCanvas = (TGCanvas*)fParent;
165  }
166  }
167  }
168 }
169 
170 ////////////////////////////////////////////////////////////////////////////////
171 /// Moves content of container frame in horizontal direction.
172 
174 {
175  Int_t diff;
176 
177  if (!fContainer) return;
178 
180  fContainer->Move(fX0 = xpos, fY0);
181  return;
182  } else {
184  fContainer->Move(fX0 = xpos, fY0);
185  return;
186  }
187  }
188 
189  if (-xpos < 0) return;
190  else diff = xpos - fX0;
191 
192  if (!diff) return;
193 
194  fX0 = xpos;
195 
196 #if defined(R__HAS_COCOA)
197  //In the current version of cocoa back-end, it's very expensive
198  //to read window's pixels, skip "optimization".
199  ((TGContainer*)fContainer)->DrawRegion(0, 0, fWidth, fHeight);
200 #else
201  UInt_t adiff = TMath::Abs(diff);
202 
203  if (adiff < fWidth) {
204  if (diff < 0) {
205  gVirtualX->CopyArea(fContainer->GetId(), fContainer->GetId(), GetWhiteGC()(),
206  adiff, 0, fWidth - adiff, fHeight, 0, 0);
207  adiff += 20; // draw larger region
208  ((TGContainer*)fContainer)->DrawRegion(fWidth - adiff, 0, adiff, fHeight);
209  } else {
210  gVirtualX->CopyArea(fContainer->GetId(), fContainer->GetId(), GetWhiteGC()(),
211  0, 0, fWidth - adiff, fHeight, adiff, 0);
212  adiff += 20; // draw larger region
213  ((TGContainer*)fContainer)->DrawRegion(0, 0, adiff, fHeight);
214  }
215  } else {
216  ((TGContainer*)fContainer)->DrawRegion(0, 0, fWidth, fHeight);
217  }
218 #endif
219 }
220 
221 ////////////////////////////////////////////////////////////////////////////////
222 /// Moves content of container frame in vertical direction.
223 
225 {
226  Int_t diff;
227 
228  if (!fContainer) return;
229 
230  // for backward comatibility
232  fContainer->Move(fX0, fY0 = ypos);
233  return;
234  } else {
236  fContainer->Move(fX0, fY0 = ypos);
237  return;
238  }
239  }
240 
241  if (-ypos < 0) return;
242  else diff = ypos - fY0;
243 
244  if (!diff) return;
245 
246  fY0 = ypos;
247 
248 #if defined(R__HAS_COCOA)
249  //In the current version of cocoa back-end, it's very expensive
250  //to read window's pixels, skip "optimization".
251  ((TGContainer*)fContainer)->DrawRegion(0, 0, fWidth, fHeight);
252 #else
253  UInt_t adiff = TMath::Abs(diff);
254 
255  if (adiff < fHeight) {
256  if (diff < 0) {
257  gVirtualX->CopyArea(fContainer->GetId(), fContainer->GetId(), GetWhiteGC()(),
258  0, adiff, fWidth, fHeight - adiff, 0, 0);
259  adiff += 20; // draw larger region
260  ((TGContainer*)fContainer)->DrawRegion(0, fHeight - adiff, fWidth, adiff);
261  } else {
262  gVirtualX->CopyArea(fContainer->GetId(), fContainer->GetId(), GetWhiteGC()(),
263  0, 0, fWidth, fHeight - adiff, 0, adiff);
264  adiff += 20; // draw larger region
265  ((TGContainer*)fContainer)->DrawRegion(0, 0, fWidth, adiff);
266  }
267  } else {
268  ((TGContainer*)fContainer)->DrawRegion(0, 0, fWidth, fHeight);
269  }
270 #endif
271 }
272 
273 ////////////////////////////////////////////////////////////////////////////////
274 /// Goto new position.
275 
277 {
278  if (!fContainer) return;
279 
280  SetHPos(fX0 = xpos);
281  SetVPos(fY0 = ypos);
282 }
283 
284 ////////////////////////////////////////////////////////////////////////////////
285 /// Handle resize events.
286 
288 {
291  return kTRUE;
292  }
293 
295 
296  // protection
297  if ((event->fWidth > 32768) || (event->fHeight > 32768)) {
298  return kFALSE;
299  }
300 
301  cont->DrawRegion(event->fX, event->fY, event->fWidth, event->fHeight);
302 
303  return kTRUE;
304 }
305 
306 ////////////////////////////////////////////////////////////////////////////////
307 /// Create a canvas container. This is the (large) frame that contains
308 /// all the list items. It will be shown through a TGViewPort (which is
309 /// created by the TGCanvas).
310 
312  UInt_t options, ULong_t back) :
313  TGCompositeFrame(p, w, h, options, back)
314 {
315  fXp = fYp = fX0 = fY0 = fXf = fYf = fXDND = fYDND = 0;
316  fViewPort = 0;
317  fBdown = kFALSE;
318  fMsgWindow = p;
319  fDragging = kFALSE;
320  fTotal = fSelected = 0;
323  fLastActiveEl = 0;
324  fLastDir = kTRUE;
325  fLastCase = kTRUE;
327  fLastName = "";
331  fScrolling = kFALSE;
332  fCanvas = 0;
334 
335  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
338 
340  SetWindowName();
341 
342  SetWindowAttributes_t wattr;
344  wattr.fBitGravity = 1; // NorthWestGravity
345  wattr.fWinGravity = 1;
346  gVirtualX->ChangeWindowAttributes(fId, &wattr);
347 
349 }
350 
351 ////////////////////////////////////////////////////////////////////////////////
352 /// Create a canvas container. This is the (large) frame that contains
353 /// all the list items. It will be shown through a TGViewPort (which is
354 /// created by the TGCanvas).
355 
357  TGCompositeFrame(p->GetViewPort(), p->GetWidth(), p->GetHeight(), options, back)
358 {
359  fXp = fYp = fX0 = fY0 = fXf = fYf = fXDND = fYDND = 0;
360  fViewPort = 0;
361  fBdown = kFALSE;
362  fMsgWindow = p->GetViewPort();
363  fCanvas = p;
364  fCanvas->GetViewPort()->SetContainer(this);
365  p->GetViewPort()->SetBackgroundColor(back);
366 
367  fDragging = kFALSE;
368  fTotal = fSelected = 0;
371  fLastActiveEl = 0;
372  fLastDir = kTRUE;
373  fLastCase = kTRUE;
375  fLastName = "";
379  fScrolling = kFALSE;
381 
382  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
385 
387  SetWindowName();
388 
389  SetWindowAttributes_t wattr;
391  wattr.fBitGravity = 1; // NorthWestGravity
392  wattr.fWinGravity = 1;
393  gVirtualX->ChangeWindowAttributes(fId, &wattr);
394 
396 }
397 
398 ////////////////////////////////////////////////////////////////////////////////
399 /// Delete canvas container.
400 
402 {
405  }
406 
407  delete fScrollTimer;
408  fScrollTimer = 0;
409 
410  delete fKeyTimer;
411  fKeyTimer = 0;
412 }
413 
414 ////////////////////////////////////////////////////////////////////////////////
415 /// Layout container entries.
416 
418 {
421 
422  // clear content if positions of subframes changed after layout
423  if (lm && lm->IsModified()) ClearViewPort();
424 }
425 
426 ////////////////////////////////////////////////////////////////////////////////
427 /// Emit signal when current position changed.
428 
430 {
431  Long_t args[2];
432 
433  args[0] = x;
434  args[1] = y;
435 
436  Emit("CurrentChanged(Int_t,Int_t)",args);
437 }
438 
439 ////////////////////////////////////////////////////////////////////////////////
440 /// Emit signal when current selected frame changed.
441 
443 {
444  Emit("CurrentChanged(TGFrame*)", (Long_t)f);
445 }
446 
447 ////////////////////////////////////////////////////////////////////////////////
448 /// Signal emitted when keyboard key pressed
449 ///
450 /// frame - activated frame
451 /// keysym - defined in "KeySymbols.h"
452 /// mask - modifier key mask, defined in "GuiTypes.h"
453 ///
454 /// const Mask_t kKeyShiftMask = BIT(0);
455 /// const Mask_t kKeyLockMask = BIT(1);
456 /// const Mask_t kKeyControlMask = BIT(2);
457 /// const Mask_t kKeyMod1Mask = BIT(3); // typically the Alt key
458 /// const Mask_t kButton1Mask = BIT(8);
459 /// const Mask_t kButton2Mask = BIT(9);
460 /// const Mask_t kButton3Mask = BIT(10);
461 /// const Mask_t kButton4Mask = BIT(11);
462 /// const Mask_t kButton5Mask = BIT(12);
463 /// const Mask_t kAnyModifier = BIT(15);
464 
465 void TGContainer::KeyPressed(TGFrame *frame, UInt_t keysym, UInt_t mask)
466 {
467  Long_t args[3];
468  args[0] = (Long_t)frame;
469  args[1] = (Long_t)keysym;
470  args[2] = (Long_t)mask;
471  Emit("KeyPressed(TGFrame*,UInt_t,UInt_t)", args);
473 }
474 
475 ////////////////////////////////////////////////////////////////////////////////
476 /// Signal emitted when Return/Enter key pressed.
477 /// It's equivalent to "double click" of mouse button.
478 
480 {
481  Emit("ReturnPressed(TGFrame*)", (Long_t)f);
482 }
483 
484 ////////////////////////////////////////////////////////////////////////////////
485 /// Signal emitted when space key pressed.
486 /// Pressing space key inverts selection.
487 
489 {
490  Emit("SpacePressed(TGFrame*)", (Long_t)f);
491 }
492 
493 ////////////////////////////////////////////////////////////////////////////////
494 /// Signal emitted when pointer is over entry.
495 
497 {
498  if (!fOnMouseOver) Emit("OnMouseOver(TGFrame*)", (Long_t)f);
500 }
501 
502 ////////////////////////////////////////////////////////////////////////////////
503 /// Emit Clicked() signal.
504 
506 {
507  Long_t args[2];
508 
509  args[0] = (Long_t)entry;
510  args[1] = btn;
511 
512  Emit("Clicked(TGFrame*,Int_t)", args);
513 }
514 
515 ////////////////////////////////////////////////////////////////////////////////
516 /// Emit Clicked() signal.
517 
519 {
520  Long_t args[4];
521 
522  args[0] = (Long_t)entry;
523  args[1] = btn;
524  args[2] = x;
525  args[3] = y;
526 
527  Emit("Clicked(TGFrame*,Int_t,Int_t,Int_t)", args);
528 }
529 
530 ////////////////////////////////////////////////////////////////////////////////
531 /// Emit DoubleClicked() signal.
532 
534 {
535  Long_t args[2];
536 
537  args[0] = (Long_t)entry;
538  args[1] = btn;
539 
540  Emit("DoubleClicked(TGFrame*,Int_t)", args);
541 }
542 
543 ////////////////////////////////////////////////////////////////////////////////
544 /// Emit DoubleClicked() signal.
545 
547 {
548  Long_t args[4];
549 
550  args[0] = (Long_t)entry;
551  args[1] = btn;
552  args[2] = x;
553  args[3] = y;
554 
555  Emit("DoubleClicked(TGFrame*,Int_t,Int_t,Int_t)", args);
556 }
557 
558 ////////////////////////////////////////////////////////////////////////////////
559 /// Select all items in the container.
560 /// SelectAll() signal emitted.
561 
563 {
564  TIter next(fList);
565  TGFrameElement *el;
566  TGFrame *fr;
567  TGPosition pos = GetPagePosition();
568 
569  while ((el = (TGFrameElement *) next())) {
570  fr = el->fFrame;
571  if (!fr->IsActive()) {
572  ActivateItem(el);
573  }
574  }
575  fSelected = fTotal;
577  fTotal, fSelected);
578 
579  Emit("SelectAll()");
580 }
581 
582 ////////////////////////////////////////////////////////////////////////////////
583 /// Unselect all items in the container.
584 
586 {
587  TIter next(fList);
588  TGFrameElement *el;
589  TGPosition pos = GetPagePosition();
590  TGFrame *fr;
591 
592  while ((el = (TGFrameElement *) next())) {
593  fr = el->fFrame;
594  if (fr->IsActive()) {
595  DeActivateItem(el);
596  }
597  }
598  fLastActiveEl = 0;
599  fSelected = 0;
600 
602  fTotal, fSelected);
603 
604  Emit("UnSelectAll()");
605 }
606 
607 ////////////////////////////////////////////////////////////////////////////////
608 /// Invert the selection, all selected items become unselected and
609 /// vice versa.
610 
612 {
613  int selected = 0;
614 
615  TIter next(fList);
616  TGFrameElement *el;
617 
618  while ((el = (TGFrameElement *) next())) {
619  if (!el->fFrame->IsActive()) {
620  ActivateItem(el);
621  ++selected;
622  } else {
623  DeActivateItem(el);
624  }
625  }
626  ClearViewPort(); // full redraw
627  fSelected = selected;
628 
630  fTotal, fSelected);
631 
632  Emit("InvertSelection()");
633 }
634 
635 ////////////////////////////////////////////////////////////////////////////////
636 /// Remove all items from the container.
637 
639 {
640  TGFrameElement *el;
641  TIter next(fList);
642 
643  while ((el = (TGFrameElement *) next())) {
644  el->fFrame->DestroyWindow();
645  delete el->fFrame;
646  fList->Remove(el);
647  delete el;
648  }
649  fLastActiveEl = 0;
650  fSelected = fTotal = 0;
651  ClearViewPort(); // full redraw
652 }
653 
654 ////////////////////////////////////////////////////////////////////////////////
655 /// Remove item from container.
656 
658 {
659  TGFrameElement *el;
660  TIter next(fList);
661  while ((el = (TGFrameElement *) next())) {
662  if (item == el->fFrame) {
663  if (fLastActiveEl && item == fLastActiveEl->fFrame) fLastActiveEl = 0;
664  item->DestroyWindow();
665  delete item;
666  fList->Remove(el);
667  delete el;
668  break;
669  }
670  }
671  ClearViewPort(); // fill redraw
672 }
673 
674 ////////////////////////////////////////////////////////////////////////////////
675 /// Return the next selected item. If the "current" pointer is 0, the first
676 /// selected item will be returned.
677 
678 const TGFrame *TGContainer::GetNextSelected(void **current)
679 {
680  TGFrame *f;
681  TObjLink *lnk = (TObjLink *) *current;
682 
683  lnk = (lnk == 0) ? fList->FirstLink() : lnk->Next();
684  while (lnk) {
685  f = (TGFrame *) ((TGFrameElement *) lnk->GetObject())->fFrame;
686  if (f->IsActive()) {
687  *current = (void *) lnk;
688  return f;
689  }
690  lnk = lnk->Next();
691  }
692  return 0;
693 }
694 
695 ////////////////////////////////////////////////////////////////////////////////
696 /// Activate item.
697 
699 {
700  TGFrame *fr = el->fFrame;
701  fr->Activate(kTRUE);
702 
703  if (fLastActiveEl != el) {
704  fLastActiveEl = el;
707  fSelected++;
708  }
709 
710  if (!fSelected) fSelected = 1;
711 
713 
714  TGPosition pos = GetPagePosition();
715  DrawRegion(fr->GetX() - pos.fX, fr->GetY() - pos.fY, fr->GetWidth(), fr->GetHeight());
716 }
717 
718 ////////////////////////////////////////////////////////////////////////////////
719 /// DeActivate item.
720 
722 {
723  TGFrame *fr = el->fFrame;
724  fr->Activate(kFALSE);
726 
727  TGPosition pos = GetPagePosition();
728  DrawRegion(fr->GetX() - pos.fX, fr->GetY() - pos.fY, fr->GetWidth(), fr->GetHeight());
729 }
730 
731 ////////////////////////////////////////////////////////////////////////////////
732 /// Returns page position.
733 
735 {
736  TGPosition ret;
737  if (!fViewPort) return ret;
738 
739  ret.fX = -fViewPort->GetHPos();
740  ret.fY = -fViewPort->GetVPos();
741 
742  return ret;
743 }
744 
745 ////////////////////////////////////////////////////////////////////////////////
746 /// Returns page dimension.
747 
749 {
750  TGDimension ret;
751  if (!fViewPort) return ret;
752 
753  ret.fWidth = fViewPort->GetWidth();
754  ret.fHeight = fViewPort->GetHeight();
755  return ret;
756 }
757 
758 ////////////////////////////////////////////////////////////////////////////////
759 /// Set page position.
760 
762 {
763  if (!fViewPort) return;
764  fViewPort->SetPos(pos.fX, pos.fY);
765 }
766 
767 ////////////////////////////////////////////////////////////////////////////////
768 /// Set page position.
769 
771 {
772  if (!fViewPort) return;
773  fViewPort->SetPos(x, y);
774 }
775 
776 ////////////////////////////////////////////////////////////////////////////////
777 /// Set page dimension.
778 
780 {
781  if (!fViewPort) return;
782  fViewPort->Resize(dim);
783 }
784 
785 ////////////////////////////////////////////////////////////////////////////////
786 /// Set page dimension.
787 
789 {
790  if (!fViewPort) return;
791  fViewPort->Resize(w, h);
792 }
793 
794 ////////////////////////////////////////////////////////////////////////////////
795 /// Redraw content of container in the viewport region.
796 
798 {
799 #ifdef R__HAS_COCOA
800  DrawRegion(0, 0, GetWidth(), GetHeight());
801 #else
802  if (!fExposedRegion.IsEmpty()) {
805 
807  }
808 #endif
809 }
810 
811 ////////////////////////////////////////////////////////////////////////////////
812 /// Draw a region of container in viewport.
813 /// x, y, w, h are position and dimension of area to be
814 /// redrawn in viewport coordinates.
815 
817 {
818  static GContext_t gcBg = 0;
819  Pixmap_t pixmap = 0;
820 
821  if (!fViewPort) return;
822  // sanity checks
823  if ((x > (Int_t)fViewPort->GetWidth()) || (y > (Int_t)fViewPort->GetHeight())) {
824  return;
825  }
826  x = x < 0 ? 0 : x;
827  y = y < 0 ? 0 : y;
828 
829  w = x + w > fViewPort->GetWidth() ? fViewPort->GetWidth() - x : w;
830  h = y + h > fViewPort->GetHeight() ? fViewPort->GetHeight() - y : h;
831 
832  if (((Int_t)w < 1) || ((Int_t)h < 1)) {
833  return;
834  }
835 
836  if (!fMapSubwindows) {
837  pixmap = gVirtualX->CreatePixmap(fId, w, h);
838 
839  if (!gcBg) {
840  GCValues_t gcValues;
841  gcValues.fForeground = fBackground;
842  gcValues.fBackground = fBackground;
843  gcValues.fGraphicsExposures = kTRUE;
845  gcBg = gVirtualX->CreateGC(fId, &gcValues);
846  }
847 
848  gVirtualX->SetForeground(gcBg, fBackground);
849  gVirtualX->FillRectangle(pixmap, gcBg, 0, 0, w, h);
850  }
851 
852  TGPosition pos = GetPagePosition();
853 
854  // translate coordinates in viewport into coordinates in container
855  Int_t xx = pos.fX + x;
856  Int_t yy = pos.fY + y;
857 
858  TIter next(fList);
859  TGFrameElement *el;
860 
861  while ((el = (TGFrameElement *) next())) {
862  if ((Int_t(el->fFrame->GetY()) > yy - (Int_t)el->fFrame->GetHeight()) &&
863  (Int_t(el->fFrame->GetX()) > xx - (Int_t)el->fFrame->GetWidth()) &&
864  (Int_t(el->fFrame->GetY()) < yy + Int_t(h + el->fFrame->GetHeight())) &&
865  (Int_t(el->fFrame->GetX()) < xx + Int_t(w + el->fFrame->GetWidth()))) {
866 
867  // draw either in container window or in double-buffer
868  if (!fMapSubwindows) {
869  Int_t fx = el->fFrame->GetX() - xx;
870  Int_t fy = el->fFrame->GetY() - yy;
871  el->fFrame->DrawCopy(pixmap, fx, fy);
872  } else {
873  fClient->NeedRedraw(el->fFrame);
874  }
875  }
876  }
877 
878  if (fMapSubwindows) return;
879 
880  gVirtualX->CopyArea(pixmap, fId, gcBg, 0, 0, w, h, x, y);
881  gVirtualX->DeletePixmap(pixmap);
882  gVirtualX->Update(kFALSE);
883 }
884 
885 ////////////////////////////////////////////////////////////////////////////////
886 /// Clear view port and redraw full content
887 
889 {
890  if (!fViewPort) return;
894  fClient->NeedRedraw(this);
895 }
896 
897 ////////////////////////////////////////////////////////////////////////////////
898 /// Handle expose events. Do not use double buffer.
899 
901 {
903 
904  if (event->fWindow == GetId()) {
905  TGPosition pos(event->fX, event->fY);
906  TGDimension dim(event->fWidth, event->fHeight);
907  TGRectangle rect(pos, dim);
908 
909  if (fExposedRegion.IsEmpty()) {
910  fExposedRegion = rect;
911  } else {
912  fExposedRegion.Merge(rect);
913  }
914 
915  fClient->NeedRedraw(this);
916  } else {
918  }
919 
920  return kTRUE;
921 }
922 
923 ////////////////////////////////////////////////////////////////////////////////
924 /// Handle mouse button event in container.
925 
927 {
928  Int_t total, selected, page = 0;
929 
930  TGPosition pos = GetPagePosition();
932  Int_t newpos;
933  page = dim.fHeight/4;
934 
935  if (event->fCode == kButton4) {
936  //scroll up
937  newpos = pos.fY - page;
938  if (newpos < 0) newpos = 0;
939  fCanvas->SetVsbPosition(newpos);
940  return kTRUE;
941  }
942  if (event->fCode == kButton5) {
943  // scroll down
944  newpos = fCanvas->GetVsbPosition() + page;
945  fCanvas->SetVsbPosition(newpos);
946  return kTRUE;
947  }
948 
949  Int_t xx = pos.fX + event->fX; // translate coordinates
950  Int_t yy = pos.fY + event->fY;
951 
952  if (event->fType == kButtonPress) {
953  gVirtualX->SetInputFocus(fId);
954 
955  fXp = pos.fX + event->fX;
956  fYp = pos.fY + event->fY;
957 
958  fXDND = event->fX;
959  fYDND = event->fY;
960  fBdown = kTRUE;
961 
962  UnSelectAll();
963  total = selected = 0;
964 
965  TGFrameElement *el;
966  TIter next(fList);
967  Bool_t select_frame = kFALSE;
968 
969  while ((el = (TGFrameElement *) next())) {
970  select_frame = kFALSE;
971 
972  if (!fMapSubwindows) {
973  if ((Int_t(el->fFrame->GetY()) + (Int_t)el->fFrame->GetHeight() > yy ) &&
974  (Int_t(el->fFrame->GetX()) + (Int_t)el->fFrame->GetWidth() > xx ) &&
975  (Int_t(el->fFrame->GetY()) < yy) &&
976  (Int_t(el->fFrame->GetX()) < xx)) {
977  select_frame = kTRUE;
978  }
979  } else {
980  if (el->fFrame->GetId() == (Window_t)event->fUser[0]) {
981  select_frame = kTRUE;
982  }
983  }
984 
985  if (select_frame) {
986  selected++;
987  ActivateItem(el);
988  Clicked(el->fFrame, event->fCode);
989  Clicked(el->fFrame, event->fCode, event->fXRoot, event->fYRoot);
990  }
991  total++;
992  }
993 
994  if (fTotal != total || fSelected != selected) {
995  fTotal = total;
996  fSelected = selected;
998  fTotal, fSelected);
999  }
1000 
1001  if ( selected == 0 ) {
1002  fDragging = kTRUE;
1003  fX0 = fXf = fXp;
1004  fY0 = fYf = fYp;
1005  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0-pos.fX, fY0-pos.fY,
1006  fXf-fX0, fYf-fY0);
1007  }
1008  }
1009 
1010  if (event->fType == kButtonRelease) {
1011  gVirtualX->SetInputFocus(fId);
1012 
1013  fBdown = kFALSE;
1014  if (fDragging) {
1015  fDragging = kFALSE;
1016  fScrolling = kFALSE;
1017 
1019  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0-pos.fX, fY0-pos.fY,
1020  fXf-fX0, fYf-fY0);
1021  ClearViewPort();
1022 
1023  } else {
1025  event->fCode, (event->fYRoot << 16) | event->fXRoot);
1026  }
1027  }
1028  DoRedraw();
1029  return kTRUE;
1030 }
1031 
1032 ////////////////////////////////////////////////////////////////////////////////
1033 /// Retrieve icons associated with class "name". Association is made
1034 /// via the user's ~/.root.mimes file or via $ROOTSYS/etc/root.mimes.
1035 
1037 {
1038  TObject *obj = 0;
1039  TClass *cl;
1040  const TGPicture *pic=0;
1041  const char *iconname = 0;
1042 
1043  if (f->InheritsFrom("TGLVEntry")) {
1044  obj = (TObject *)((TGLVEntry *)f)->GetUserData();
1045  if (obj) {
1046  if (obj->IsA() == TKey::Class()) {
1047  cl = TClass::GetClass(((TKey *)obj)->GetClassName());
1048  } else if (obj->IsA() == TKeyMapFile::Class()) {
1049  cl = TClass::GetClass(((TKeyMapFile *)obj)->GetTitle());
1050  } else {
1051  cl = obj->IsA();
1052  }
1053  const char *name = obj->GetIconName();
1054  if (((name == 0) || (!name[0])) && (cl != 0))
1055  name = cl->GetName();
1056  iconname = ((name != 0) && (strlen(name) > 0)) ? name : obj->GetName();
1057 
1058  if (obj->IsA()->InheritsFrom("TGeoVolume")) {
1059  iconname = obj->GetIconName() ? obj->GetIconName() : obj->IsA()->GetName();
1060  }
1061  pic = fClient->GetMimeTypeList()->GetIcon(iconname, kFALSE);
1062  }
1063  }
1064  if (pic == 0) {
1065  if (obj && obj->IsFolder()) {
1066  pic = fClient->GetPicture("folder_s.xpm");
1067  } else {
1068  pic = fClient->GetPicture("doc_s.xpm");
1069  }
1070  }
1071  return pic;
1072 }
1073 
1074 ////////////////////////////////////////////////////////////////////////////////
1075 /// Set drag window pixmaps and hotpoint.
1076 
1078 {
1079  Pixmap_t pic, mask;
1080  TGPicture *selpic = new TGSelectedPicture(gClient, p);
1081  pic = selpic->GetPicture();
1082  mask = selpic->GetMask();
1083 
1084  if (gDNDManager) {
1085  gDNDManager->SetDragPixmap(pic, mask, p->GetWidth()/2, 2+p->GetHeight()/2);
1086  } else {
1087  gVirtualX->DeletePixmap(pic);
1088  gVirtualX->DeletePixmap(mask);
1089  }
1090 }
1091 
1092 ////////////////////////////////////////////////////////////////////////////////
1093 /// Handle double click mouse event.
1094 
1096 {
1097  TGFrameElement *el;
1098  TIter next(fList);
1099 
1100  TGPosition pos = GetPagePosition();
1101 
1102  Int_t xx = pos.fX + event->fX; // translate coordinates
1103  Int_t yy = pos.fY + event->fY;
1104 
1105  Bool_t select_frame = kFALSE;
1106 
1107  while ((el = (TGFrameElement *) next())) {
1108  select_frame = kFALSE;
1109 
1110  if (!fMapSubwindows) {
1111  if ((Int_t(el->fFrame->GetY()) + (Int_t)el->fFrame->GetHeight() > yy) &&
1112  (Int_t(el->fFrame->GetX()) + (Int_t)el->fFrame->GetWidth() > xx) &&
1113  (Int_t(el->fFrame->GetY()) < yy) &&
1114  (Int_t(el->fFrame->GetX()) < xx)) {
1115  select_frame = kTRUE;
1116  }
1117  } else {
1118  if (el->fFrame->GetId() == (Window_t)event->fUser[0]) {
1119  select_frame = kTRUE;
1120  }
1121  }
1122 
1123  if (select_frame) {
1125  event->fCode, (event->fYRoot << 16) | event->fXRoot);
1126 
1127  DoubleClicked(el->fFrame, event->fCode);
1128  DoubleClicked(el->fFrame, event->fCode, event->fXRoot, event->fYRoot);
1129  return kTRUE;
1130  }
1131  }
1132  return kTRUE;
1133 }
1134 
1135 ////////////////////////////////////////////////////////////////////////////////
1136 /// Handle mouse motion events.
1137 
1139 {
1140  int xf0, yf0, xff, yff, total, selected;
1141 
1142  TGPosition pos = GetPagePosition();
1143  TGDimension dim = GetPageDimension();
1144  Int_t x = pos.fX + event->fX;
1145  Int_t y = pos.fY + event->fY;
1146  TGFrameElement *el = 0;
1147  TGFrame *f = 0;
1148  fOnMouseOver = kFALSE;
1149 
1150  Bool_t wasScrolling = fScrolling;
1151 
1152  if (gDNDManager->IsDragging()) {
1153  gDNDManager->Drag(event->fXRoot, event->fYRoot,
1155  }
1156  else if (fDragging) {
1157 
1158  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0-pos.fX, fY0-pos.fY,
1159  fXf-fX0, fYf-fY0);
1160  fX0 = TMath::Min(fXp,x);
1161  fY0 = TMath::Min(fYp,y);
1162  fXf = TMath::Max(fXp,x);
1163  fYf = TMath::Max(fYp,y);
1164 
1165  total = selected = 0;
1166 
1167  if (event->fX > Int_t(dim.fWidth) - kAutoScrollFudge) {
1168  //fCanvas->SetHsbPosition(x - dim.fWidth);
1169  fScrolling = kTRUE;
1170  } else if (event->fX < kAutoScrollFudge) {
1171  //fCanvas->SetHsbPosition(x);
1172  fScrolling = kTRUE;
1173  } else if (event->fY > Int_t(dim.fHeight) - kAutoScrollFudge) {
1174  //fCanvas->SetVsbPosition(y - dim.fHeight);
1175  fScrolling = kTRUE;
1176  } else if (event->fY < kAutoScrollFudge) {
1177  //fCanvas->SetVsbPosition(y);
1178  fScrolling = kTRUE;
1179  }
1180  else {
1181  fScrolling = kFALSE;
1182  }
1183 
1184  TIter next(fList);
1185 
1186  while ((el = (TGFrameElement *) next())) {
1187  f = el->fFrame;
1188  ++total;
1189  xf0 = f->GetX() + (f->GetWidth() >> 3);
1190  yf0 = f->GetY() + (f->GetHeight() >> 3);
1191  xff = xf0 + f->GetWidth() - (f->GetWidth() >> 2);
1192  yff = yf0 + f->GetHeight() - (f->GetHeight() >> 2);
1193 
1194  if (((xf0 > fX0 && xf0 < fXf) ||
1195  (xff > fX0 && xff < fXf)) &&
1196  ((yf0 > fY0 && yf0 < fYf) ||
1197  (yff > fY0 && yff < fYf))) {
1198  if (!el->fFrame->IsActive())
1199  ActivateItem(el);
1200  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kHand));
1201  OnMouseOver(f);
1202  ++selected;
1203  } else {
1204  if (el->fFrame->IsActive())
1205  DeActivateItem(el);
1206  }
1207  }
1208 
1209  if (fTotal != total || fSelected != selected) {
1210  fTotal = total;
1211  fSelected = selected;
1213  fTotal, fSelected);
1214  }
1215  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0-pos.fX, fY0-pos.fY,
1216  fXf-fX0, fYf-fY0);
1217  }
1218  else {
1219  TGFrame *over_frame = 0;
1220 
1221  TIter next(fList);
1222 
1223  while ((el = (TGFrameElement *) next())) {
1224  if (!fMapSubwindows) {
1225  if ((Int_t(el->fFrame->GetY()) + (Int_t)el->fFrame->GetHeight() > y) &&
1226  (Int_t(el->fFrame->GetX()) + (Int_t)el->fFrame->GetWidth() > x) &&
1227  (Int_t(el->fFrame->GetY()) < y) &&
1228  (Int_t(el->fFrame->GetX()) < x)) {
1229  over_frame = el->fFrame;
1230  break;
1231  }
1232  } else {
1233  if (el->fFrame->GetId() == (Window_t)event->fUser[0]) {
1234  over_frame = el->fFrame;
1235  break;
1236  }
1237  }
1238  }
1239  if (over_frame) {
1240  if (!gDNDManager->IsDragging()) {
1241  if (fBdown && ((abs(event->fX - fXDND) > 2) || (abs(event->fY - fYDND) > 2))) {
1242  if (gDNDManager && over_frame->IsDNDSource()) {
1243  const TGPicture *drag_pic = GetObjPicture(over_frame);
1244  if (drag_pic) SetDragPixmap(drag_pic);
1245  gDNDManager->StartDrag(over_frame, event->fXRoot, event->fYRoot);
1246  }
1247  }
1248  }
1249  if (gDNDManager->IsDragging()) {
1250  gDNDManager->Drag(event->fXRoot, event->fYRoot,
1252  } else {
1253  OnMouseOver(over_frame);
1254  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kHand));
1255  }
1256  } else {
1257  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kPointer));
1258  }
1259  }
1260 
1261  if (!wasScrolling && fScrolling) {
1262  if (gSystem) {
1263  fScrollTimer->Reset();
1265  }
1266  }
1267 
1268  return kTRUE;
1269 }
1270 
1271 ////////////////////////////////////////////////////////////////////////////////
1272 /// The key press event handler converts a key press to some line editor
1273 /// action.
1274 
1276 {
1277  char input[10];
1278  Int_t n;
1279  UInt_t keysym;
1280 
1281  if (event->fType == kGKeyPress) {
1282  gVirtualX->LookupString(event, input, sizeof(input), keysym);
1283  n = strlen(input);
1284 
1285  KeyPressed(fLastActiveEl?fLastActiveEl->fFrame:0, keysym, event->fState);
1286 
1287  switch ((EKeySym)keysym) {
1288  case kKey_Enter:
1289  case kKey_Return:
1290  // treat 'Enter' and 'Return' as a double click
1292  kButton1, (event->fYRoot << 16) | event->fXRoot);
1294  break;
1295  case kKey_Shift:
1296  case kKey_Control:
1297  case kKey_Meta:
1298  case kKey_Alt:
1299  case kKey_CapsLock:
1300  case kKey_NumLock:
1301  case kKey_ScrollLock:
1302  return kTRUE;
1303  case kKey_Space:
1304  if (fLastActiveEl) {
1307  }
1308  break;
1309  default:
1310  break;
1311  }
1312 
1313  if (event->fState & kKeyControlMask) { // Cntrl key modifier pressed
1314  switch((EKeySym)keysym & ~0x20) { // treat upper and lower the same
1315  case kKey_A:
1316  SelectAll();
1317  break;
1318  case kKey_B:
1319  LineLeft();
1320  break;
1321  case kKey_C:
1322  return kTRUE;
1323  case kKey_D:
1324  break;
1325  case kKey_E:
1326  End();
1327  break;
1328  case kKey_F:
1329  Search();
1330  break;
1331  case kKey_G:
1332  RepeatSearch();
1333  break;
1334  case kKey_H:
1335  LineLeft();
1336  break;
1337  case kKey_K:
1338  End();
1339  break;
1340  case kKey_U:
1341  Home();
1342  break;
1343  case kKey_V:
1344  case kKey_Y:
1345  return kTRUE;
1346  case kKey_X:
1347  return kTRUE;
1348  default:
1349  return kTRUE;
1350  }
1351  }
1352  if (n && keysym >= 32 && keysym < 127 && // printable keys
1353  !(event->fState & kKeyControlMask) &&
1354  (EKeySym)keysym != kKey_Delete &&
1355  (EKeySym)keysym != kKey_Backspace) {
1356 
1357  if (fKeyTimerActive) {
1358  fKeyInput += input;
1359  } else {
1360  fKeyInput = input;
1362  fKeyTimer->Reset();
1364  }
1365  } else {
1366 
1367  switch ((EKeySym)keysym) {
1368  case kKey_F3:
1369  RepeatSearch();
1370  break;
1371  case kKey_F5:
1372  Layout();
1373  break;
1374  case kKey_F7:
1375  Search();
1376  break;
1377  case kKey_Left:
1378  LineLeft(event->fState & kKeyShiftMask);
1379  break;
1380  case kKey_Right:
1381  LineRight(event->fState & kKeyShiftMask);
1382  break;
1383  case kKey_Up:
1384  LineUp(event->fState & kKeyShiftMask);
1385  break;
1386  case kKey_Down:
1387  LineDown(event->fState & kKeyShiftMask);
1388  break;
1389  case kKey_PageUp:
1390  PageUp(event->fState & kKeyShiftMask);
1391  break;
1392  case kKey_PageDown:
1393  PageDown(event->fState & kKeyShiftMask);
1394  break;
1395  case kKey_Home:
1396  Home(event->fState & kKeyShiftMask);
1397  break;
1398  case kKey_End:
1399  End(event->fState & kKeyShiftMask);
1400  break;
1401  default:
1402  break;
1403  }
1404  }
1405  }
1406  DoRedraw();
1407  return kTRUE;
1408 }
1409 
1410 ////////////////////////////////////////////////////////////////////////////////
1411 /// Find frame by name.
1412 
1414 {
1415  if (!IsMapped()) return 0;
1416 
1417  Bool_t direction = kTRUE;
1418  Bool_t caseSensitive = kFALSE;
1419  Bool_t subString = kFALSE;
1420 
1422  caseSensitive = TGSearchDialog::SearchDialog()->GetType()->fCaseSensitive;
1424  }
1425  TString sname(name);
1426  if (sname.Contains("*")) {
1427  subString = kTRUE;
1428  sname.ReplaceAll("*", "");
1429  }
1430 
1431  TGFrameElement *fe = (TGFrameElement*)FindItem(sname.Data(), direction,
1432  caseSensitive, subString);
1433  if (!fe) { // find again
1435  fLastActiveEl = 0;
1437 
1438  if (!fe) {
1440  TString msg = "Couldn't find \"" + fLastName + '\"';
1441  gVirtualX->Bell(20);
1442  new TGMsgBox(fClient->GetDefaultRoot(), fCanvas, "Container", msg.Data(),
1444  }
1445  return 0;
1446  } else {
1448  ActivateItem(fe);
1449  AdjustPosition();
1450  return fe->fFrame;
1451  }
1452  } else {
1454  ActivateItem(fe);
1455  AdjustPosition();
1456  return fe->fFrame;
1457  }
1458  return 0;
1459 }
1460 
1461 ////////////////////////////////////////////////////////////////////////////////
1462 /// Invokes search dialog. Looks for item with the entered name.
1463 
1465 {
1466  static TGSearchType *srch = 0;
1467  Int_t ret = 0;
1468 
1469  if (!srch) srch = new TGSearchType;
1470  srch->fClose = close;
1471  srch->fBuffer = 0;
1472 
1473  if (!close) {
1476  fCanvas, 400, 150, srch, &ret);
1477  }
1478  TGSearchDialog::SearchDialog()->Connect("TextEntered(char *)", "TGContainer", this,
1479  "FindFrameByName(char *)");
1481  } else {
1482  new TGSearchDialog(fClient->GetDefaultRoot(), fCanvas, 400, 150, srch, &ret);
1483  if (ret) {
1484  FindFrameByName(srch->fBuffer);
1485  }
1486  }
1487 }
1488 
1489 ////////////////////////////////////////////////////////////////////////////////
1490 /// Autoscroll while close to & beyond The Wall
1491 
1493 {
1494  TGFrameElement *el = 0;
1495  TGFrame *f = 0;
1496  int xf0, yf0, xff, yff, total, selected;
1497 
1498  TGDimension dim = GetPageDimension();
1499  TGPosition pos = GetPagePosition();
1500 
1501  Window_t dum1, dum2;
1502  Event_t ev;
1503  ev.fType = kButtonPress;
1504  Int_t x,y;
1505 
1506  // Autoscroll while close to the wall
1507  Int_t dx = 0;
1508  Int_t dy = 0;
1509 
1510  // Where's the cursor?
1511  gVirtualX->QueryPointer(fId,dum1,dum2,ev.fXRoot,ev.fYRoot,x,y,ev.fState);
1512 
1513  // Figure scroll amount x
1514  if (x < kAutoScrollFudge)
1515  dx = kAutoScrollFudge - x;
1516  else if ((Int_t)dim.fWidth-kAutoScrollFudge <= x)
1517  dx = dim.fWidth - kAutoScrollFudge - x;
1518 
1519  // Figure scroll amount y
1520  if (y < kAutoScrollFudge)
1521  dy = kAutoScrollFudge - y;
1522  else if ((Int_t)dim.fHeight - kAutoScrollFudge <= y)
1523  dy = dim.fHeight - kAutoScrollFudge - y;
1524 
1525  if (dx || dy) {
1526  if (dx) dx /= 5;
1527  if (dy) dy /= 5;
1528  Int_t adx = TMath::Abs(dx);
1529  Int_t ady = TMath::Abs(dy);
1530  if (adx > kAutoScrollFudge) adx = kAutoScrollFudge;
1531  if (ady > kAutoScrollFudge) ady = kAutoScrollFudge;
1532 
1533  dx *= kAcceleration[adx];
1534  dy *= kAcceleration[ady];
1535 
1536  Int_t nx = pos.fX-dx;
1537  Int_t ny = pos.fY-dy;
1538 
1539  fCanvas->SetHsbPosition(nx);
1540  fCanvas->SetVsbPosition(ny);
1541 
1542  // position inside container
1543  x += pos.fX;
1544  y += pos.fY;
1545 
1546  fX0 = TMath::Min(fXp, x);
1547  fY0 = TMath::Min(fYp, y);
1548  fXf = TMath::Max(fXp, x);
1549  fYf = TMath::Max(fYp ,y);
1550 
1551  total = selected = 0;
1552 
1553  TIter next(fList);
1554 
1555  while ((el = (TGFrameElement *) next())) {
1556  f = el->fFrame;
1557  ++total;
1558  xf0 = f->GetX() + (f->GetWidth() >> 3);
1559  yf0 = f->GetY() + (f->GetHeight() >> 3);
1560  xff = xf0 + f->GetWidth() - (f->GetWidth() >> 2);
1561  yff = yf0 + f->GetHeight() - (f->GetHeight() >> 2);
1562 
1563  if (((xf0 > fX0 && xf0 < fXf) ||
1564  (xff > fX0 && xff < fXf)) &&
1565  ((yf0 > fY0 && yf0 < fYf) ||
1566  (yff > fY0 && yff < fYf))) {
1567  if (!el->fFrame->IsActive())
1568  ActivateItem(el);
1569  ++selected;
1570  } else {
1571  if (el->fFrame->IsActive())
1572  DeActivateItem(el);
1573  }
1574  }
1575  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0-pos.fX, fY0-pos.fY,
1576  fXf-fX0, fYf-fY0);
1577 
1578  if (fTotal != total || fSelected != selected) {
1579  fTotal = total;
1580  fSelected = selected;
1582  fTotal, fSelected);
1583  }
1584  ClearViewPort();
1585  DoRedraw();
1586  gVirtualX->DrawRectangle(fId, GetLineGC()(), fX0-pos.fX, fY0-pos.fY,
1587  fXf-fX0, fYf-fY0);
1588  }
1589 }
1590 
1591 ////////////////////////////////////////////////////////////////////////////////
1592 /// Search for entry which name begins with pattern.
1593 
1595 {
1596  TGFrameElement *fe = 0;
1597  TIter next(fList);
1598  TString str;
1599 
1600  while ((fe=( TGFrameElement*)next())) {
1601  str = fe->fFrame->GetTitle();
1602 
1604  if (fLastActiveEl && (fLastActiveEl!=fe) ) {
1606  }
1607  ActivateItem(fe);
1608  AdjustPosition();
1609  break;
1610  }
1611  }
1612 
1613  fKeyInput = ""; //clear
1615 }
1616 
1617 ////////////////////////////////////////////////////////////////////////////////
1618 /// Repeats search.
1619 
1621 {
1622  TGFrameElement *fe = 0;
1623 
1624  if (fLastName == "")
1625  return Search();
1626 
1628 
1629  if (!fe) {
1631  fLastActiveEl = 0;
1633 
1634  if (!fe) {
1635  TString msg = "Couldn't find \"" + fLastName + '\"';
1636  gVirtualX->Bell(50);
1637  new TGMsgBox(fClient->GetDefaultRoot(), fCanvas, "Container", msg.Data(),
1639  } else {
1641  ActivateItem(fe);
1642  AdjustPosition();
1643  }
1644  } else {
1646  ActivateItem(fe);
1647  AdjustPosition();
1648  }
1649 }
1650 
1651 ////////////////////////////////////////////////////////////////////////////////
1652 /// Find frame located int container at position x,y.
1653 
1655 {
1656  TIter next(fList);
1657  TGFrameElement *el;
1658  TGFrameElement *ret = 0;
1659  Int_t dx = 0;
1660  Int_t dy = 0;
1661  Int_t d = 0;
1662  Int_t dd;
1663 
1664  el = (TGFrameElement *) next();
1665  if (!el) return 0;
1666 
1667  dx = TMath::Abs(el->fFrame->GetX()-x);
1668  dy = TMath::Abs(el->fFrame->GetY()-y);
1669  d = dx + dy;
1670 
1671  while ((el = (TGFrameElement *) next())) {
1672  if (exclude && (el==fLastActiveEl) ) continue;
1673  dx = TMath::Abs(el->fFrame->GetX()-x);
1674  dy = TMath::Abs(el->fFrame->GetY()-y);
1675  dd = dx+dy;
1676 
1677  if (dd<d) {
1678  d = dd;
1679  ret = el;
1680  }
1681  }
1682  return ret;
1683 }
1684 
1685 ////////////////////////////////////////////////////////////////////////////////
1686 
1687 void *TGContainer::FindItem(const TString& name, Bool_t direction,
1688  Bool_t caseSensitive, Bool_t subString)
1689 {
1690  // Find a frame which assosiated object has a name containing a "name"
1691  // string.
1692 
1693  if (name.IsNull()) return 0;
1694  int idx = kNPOS;
1695 
1696  TGFrameElement *el = 0;
1697  TString str;
1699 
1700  fLastDir = direction;
1701  fLastCase = caseSensitive;
1702  fLastName = name;
1703  fLastSubstring = subString;
1704 
1705  if (fLastActiveEl) {
1706  el = fLastActiveEl;
1707 
1708  if (direction) {
1709  el = (TGFrameElement *)fList->After(el);
1710  } else {
1711  el = (TGFrameElement *)fList->Before(el);
1712  }
1713  } else {
1714  if (direction) el = (TGFrameElement *)fList->First();
1715  else el = (TGFrameElement *)fList->Last();
1716  }
1717 
1718  while (el) {
1719  str = el->fFrame->GetTitle();
1720  idx = str.Index(name, 0, cmp);
1721 
1722  if (idx != kNPOS) {
1723  if (subString) {
1724  return el;
1725  } else {
1726  if (str.Length() == name.Length()) return el;
1727  }
1728  }
1729 
1730  if (direction) {
1731  el = (TGFrameElement *)fList->After(el);
1732  } else {
1733  el = (TGFrameElement *)fList->Before(el);
1734  }
1735  }
1736  return 0;
1737 }
1738 
1739 ////////////////////////////////////////////////////////////////////////////////
1740 /// returns pointer to hor. scroll bar
1741 
1743 {
1744  return fCanvas ? fCanvas->GetHScrollbar() : 0;
1745 }
1746 
1747 ////////////////////////////////////////////////////////////////////////////////
1748 /// returns pointer to vert. scroll bar
1749 
1751 {
1752  return fCanvas ? fCanvas->GetVScrollbar() : 0;
1753 }
1754 
1755 ////////////////////////////////////////////////////////////////////////////////
1756 /// Set position of vertical scrollbar.
1757 
1759 {
1760  if (!fViewPort) return;
1761  TGVScrollBar *vb = GetVScrollbar();
1762 
1763  if (vb && vb->IsMapped()) {
1765  vb->SetPosition(newPos);
1766  } else {
1767  fViewPort->SetVPos(0);
1768  }
1769 }
1770 
1771 ////////////////////////////////////////////////////////////////////////////////
1772 /// set new hor. position
1773 
1775 {
1776  if (!fViewPort) return;
1777  TGHScrollBar *hb = GetHScrollbar();
1778 
1779  if (hb && hb->IsMapped()) {
1781  hb->SetPosition(newPos);
1782  } else {
1783  fViewPort->SetHPos(0);
1784  }
1785 }
1786 
1787 ////////////////////////////////////////////////////////////////////////////////
1788 /// Move content to position of highlighted/activated frame.
1789 
1791 {
1792  if (!fViewPort) return;
1793  if (!fLastActiveEl) return;
1795 
1796  Int_t vh = 0;
1797  Int_t v = 0;
1798 
1799  TGHScrollBar *hb = GetHScrollbar();
1800  TGVScrollBar *vb = GetVScrollbar();
1801  Int_t pos = GetPagePosition().fY;
1802  Int_t pg;
1803 
1804 
1805  if (vb && vb->IsMapped()) {
1806  pg = (vb->GetPageSize()*GetHeight())/fViewPort->GetHeight();
1807  vh = pos + (Int_t)fViewPort->GetHeight();
1808 
1809  if (f->GetY() < pos) {
1810  v = TMath::Max(0, f->GetY() - (Int_t)fViewPort->GetHeight()/2);
1811  v = (v*pg)/GetHeight();
1812 
1813  SetVsbPosition(v);
1814  } else if (f->GetY() + (Int_t)f->GetHeight() > vh) {
1816  f->GetY() + (Int_t)f->GetHeight() - (Int_t)fViewPort->GetHeight()/2);
1817  v = (v*pg)/GetHeight();
1818  SetVsbPosition(v);
1819  }
1820  }
1821 
1822  Int_t hw = 0;
1823  Int_t h = 0;
1824 
1825  if (hb && hb->IsMapped() && (!vb || (vb && !vb->IsMapped()))) {
1826  pg = (hb->GetPageSize()*GetWidth())/fViewPort->GetWidth();
1827  pos =GetPagePosition().fX;
1828  hw = pos + (Int_t)fViewPort->GetWidth();
1829 
1830  if (f->GetX() < pos) {
1831  h = TMath::Max(0, f->GetX() - (Int_t)fViewPort->GetWidth()/2);
1832  h = (h*pg)/GetWidth();
1833 
1834  SetHsbPosition(h);
1835  } else if (f->GetX() + (Int_t)f->GetWidth() > hw) {
1837  f->GetX() + (Int_t)f->GetWidth() - (Int_t)fViewPort->GetWidth()/2);
1838  h = (h*pg)/GetWidth();
1839 
1840  SetHsbPosition(h);
1841  }
1842  }
1843 }
1844 
1845 ////////////////////////////////////////////////////////////////////////////////
1846 /// Move current position one column left.
1847 
1849 {
1850  TGPosition pos = GetPagePosition();
1851  TGDimension dim = GetPageDimension();
1852 
1854  if (!fe) return; // empty list
1855 
1857 
1858  if (old) DeActivateItem(old); //
1859  else fLastActiveEl = fe;
1860 
1862  Int_t dx = la->fLayout->GetPadLeft() + la->fLayout->GetPadRight();
1863  Int_t dy = la->fLayout->GetPadTop() + la->fLayout->GetPadBottom();
1864  Int_t y = la->fFrame->GetY();
1865  Int_t x = la->fFrame->GetX() - dx;
1866 
1867  Int_t hw = pos.fX + dim.fWidth;
1868 
1869  TGHScrollBar *hb = GetHScrollbar();
1870  if (x<=0 && (hb && !hb->IsMapped())) { // move to previous line
1871  x = hw;
1872  y = y - la->fFrame->GetDefaultHeight() - dy;
1873  }
1874 
1875  fe = FindFrame(x, y);
1876  if (!fe) fe = (TGFrameElement*)fList->First();
1877 
1878  if (!select) fSelected=1;
1879 
1880  ActivateItem(fe);
1881  AdjustPosition();
1882 }
1883 
1884 ////////////////////////////////////////////////////////////////////////////////
1885 /// Move current position one column right.
1886 
1888 {
1889  TGPosition pos = GetPagePosition();
1890  TGDimension dim = GetPageDimension();
1891 
1893  if (!fe) return;
1894 
1896 
1897  if (old) DeActivateItem(old);
1899 
1904 
1905  Int_t hw = pos.fX + dim.fWidth - dx;
1906 
1907  TGHScrollBar *hb = GetHScrollbar();
1908  if (x >= hw && (hb && !hb->IsMapped())) { // move one line down
1909  x = 0;
1910  y = y + fLastActiveEl->fFrame->GetDefaultHeight() + dy;
1911  }
1912 
1913  fe = FindFrame(x, y);
1914  if (!fe) fe = (TGFrameElement*)fList->Last();
1915  if (!select) fSelected = 1;
1916 
1917  ActivateItem(fe);
1918  AdjustPosition();
1919 }
1920 
1921 ////////////////////////////////////////////////////////////////////////////////
1922 /// Make current position first line in window by scrolling up.
1923 
1925 {
1927  if (!fe) return;
1928 
1930 
1931  if (old) {
1932  DeActivateItem(old);
1933  } else {
1935  }
1936 
1938  Int_t y = fLastActiveEl->fFrame->GetY() - dy;
1940 
1941  fe = FindFrame(x, y);
1942  if (!fe) fe = (TGFrameElement*)fList->First();
1943  if (fe->fFrame->GetY() > fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1944  if (!select) fSelected = 1;
1945 
1946  ActivateItem(fe);
1947  AdjustPosition();
1948 }
1949 
1950 ////////////////////////////////////////////////////////////////////////////////
1951 /// Move one line down.
1952 
1954 {
1956  if (!fe) return;
1957 
1959 
1960  if (old) DeActivateItem(old);
1962 
1964  Int_t y = fLastActiveEl->fFrame->GetY() +
1965  fLastActiveEl->fFrame->GetHeight() + dy;
1967 
1968  fe = FindFrame(x, y);
1969  if (!fe) fe = (TGFrameElement*)fList->Last();
1970  if (fe->fFrame->GetY() < fLastActiveEl->fFrame->GetY()) fe = fLastActiveEl;
1971  if (!select) fSelected = 1;
1972 
1973  ActivateItem(fe);
1974  AdjustPosition();
1975 }
1976 
1977 ////////////////////////////////////////////////////////////////////////////////
1978 /// Move position one page up.
1979 
1981 {
1982  TGDimension dim = GetPageDimension();
1983 
1985  if (!fe) return;
1986 
1988 
1989  if (old) DeActivateItem(old);
1991 
1994 
1995  TGVScrollBar *vb = GetVScrollbar();
1996  TGHScrollBar *hb = GetHScrollbar();
1997 
1998  if (vb && vb->IsMapped()) {
1999  y -= dim.fHeight;
2000  } else {
2001  if (hb && hb->IsMapped()) {
2002  x -= dim.fWidth;
2003  } else {
2004  Home();
2005  return;
2006  }
2007  }
2008 
2009  fe = FindFrame(x, y);
2010 
2011  if (!fe || fe->fFrame->GetY()>fLastActiveEl->fFrame->GetY()) {
2012  fe = (TGFrameElement*)fList->First();
2013  }
2014 
2015  if (!select) fSelected = 1;
2016 
2017  ActivateItem(fe);
2018  AdjustPosition();
2019 }
2020 
2021 ////////////////////////////////////////////////////////////////////////////////
2022 /// Move position one page down.
2023 
2025 {
2026  TGDimension dim = GetPageDimension();
2027 
2028  TList *li = GetList();
2030  if (!fe) return;
2031 
2033 
2034  if (old) DeActivateItem(old);
2036 
2039 
2040  TGVScrollBar *vb = GetVScrollbar();
2041  TGHScrollBar *hb = GetHScrollbar();
2042 
2043  if (vb && vb->IsMapped()) {
2044  y += dim.fHeight;
2045  } else {
2046  if (hb && hb->IsMapped()) {
2047  x += dim.fWidth;
2048  } else {
2049  End();
2050  return;
2051  }
2052  }
2053 
2054  fe = FindFrame(x, y);
2055  if (!fe || fe->fFrame->GetY()<fLastActiveEl->fFrame->GetY() ) {
2056  fe = (TGFrameElement*)li->Last();
2057  }
2058 
2059  if (!select) fSelected = 1;
2060 
2061  ActivateItem(fe);
2062  AdjustPosition();
2063 }
2064 
2065 ////////////////////////////////////////////////////////////////////////////////
2066 /// Move to upper-left corner of container.
2067 
2069 {
2071  if (!fe) return;
2072 
2074  if (old) DeActivateItem(old);
2075 
2076  if (!select) fSelected = 1;
2077 
2078  ActivateItem(fe);
2079  AdjustPosition();
2080 }
2081 
2082 ////////////////////////////////////////////////////////////////////////////////
2083 /// Move to the bottom-right corner of container.
2084 
2086 {
2088  if (!fe) return;
2089 
2091  if (old) DeActivateItem(old);
2092 
2093  if (!select) fSelected = 1;
2094 
2095  ActivateItem(fe);
2096  AdjustPosition();
2097 }
2098 
2099 ////////////////////////////////////////////////////////////////////////////////
2100 /// Get graphics context for line drawing.
2101 
2103 {
2104  if (!fgLineGC) {
2105  GCValues_t gval;
2110  gval.fBackground = fgWhitePixel;
2111  gval.fFunction = kGXxor;
2112  gval.fLineWidth = 0;
2113  gval.fLineStyle = kLineOnOffDash;
2114  gval.fFillStyle = kFillSolid;
2116  gval.fGraphicsExposures = kFALSE;
2117  fgLineGC = gClient->GetGC(&gval, kTRUE);
2118  fgLineGC->SetDashOffset(0);
2119  fgLineGC->SetDashList("\x1\x1", 2);
2120  }
2121  return *fgLineGC;
2122 }
2123 
2124 ////////////////////////////////////////////////////////////////////////////////
2125 /// Create a canvas object.
2126 
2128  UInt_t options, ULong_t back) :
2129  TGFrame(p, w, h, options, back)
2130 {
2131  fVport = new TGViewPort(this, w-4, h-4, kChildFrame | kOwnBackground,
2132  fgWhitePixel);
2135 
2137 
2138  fHScrollbar->Associate(this);
2139  fVScrollbar->Associate(this);
2140 
2142 
2143  SetWindowName();
2144 
2147 }
2148 
2149 ////////////////////////////////////////////////////////////////////////////////
2150 /// Delete canvas.
2151 
2153 {
2154  delete fHScrollbar;
2155  delete fVScrollbar;
2156  delete fVport;
2157 }
2158 
2159 ////////////////////////////////////////////////////////////////////////////////
2160 /// Map all canvas sub windows.
2161 
2163 {
2166 
2167  if (fVport) {
2168  TGFrame *container = fVport->GetContainer();
2169  if (!container) {
2170  Error("MapSubwindows", "no canvas container set yet");
2171  return;
2172  }
2173  container->MapSubwindows();
2174  fVport->MapSubwindows();
2175  fVport->MapWindow();
2176  }
2177  Layout();
2178 }
2179 
2180 ////////////////////////////////////////////////////////////////////////////////
2181 /// Adding a frame to a canvas is actually adding the frame to the
2182 /// viewport container. The viewport container must be at least a
2183 /// TGCompositeFrame for this method to succeed.
2184 
2186 {
2187  TGFrame *container = fVport->GetContainer();
2188  if (!container) {
2189  Error("AddFrame", "no canvas container set yet");
2190  return;
2191  }
2192  if (container->InheritsFrom(TGCompositeFrame::Class()))
2193  ((TGCompositeFrame*)container)->AddFrame(f, l);
2194  else
2195  Error("AddFrame", "canvas container must inherit from TGCompositeFrame");
2196 }
2197 
2198 ////////////////////////////////////////////////////////////////////////////////
2199 /// Draw canvas border.
2200 
2202 {
2203  switch (fOptions & (kSunkenFrame | kRaisedFrame | kDoubleBorder)) {
2204  case kSunkenFrame | kDoubleBorder:
2205  gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
2206  gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
2207  gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, fWidth-3, 1);
2208  gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, 1, fHeight-3);
2209  if (gClient->GetStyle() > 1) break;
2210  gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, fWidth-1, fHeight-1);
2211  gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, fHeight-1, fWidth-1, 0);
2212  gVirtualX->DrawLine(fId, GetBckgndGC()(), 1, fHeight-2, fWidth-2, fHeight-2);
2213  gVirtualX->DrawLine(fId, GetBckgndGC()(), fWidth-2, 1, fWidth-2, fHeight-2);
2214  break;
2215 
2216  default:
2218  break;
2219  }
2220 }
2221 
2222 ////////////////////////////////////////////////////////////////////////////////
2223 /// Create layout for canvas. Depending on the size of the container
2224 /// we need to add the scrollbars.
2225 
2227 {
2228  Bool_t need_vsb, need_hsb;
2229  UInt_t cw, ch, tcw, tch;
2230 
2231  need_vsb = need_hsb = kFALSE;
2232 
2233  TGFrame *container = fVport->GetContainer();
2234  if (!container) {
2235  Error("Layout", "no canvas container set yet");
2236  return;
2237  }
2238 
2239  Bool_t fixedw = container->IsLayoutBroken() || (container->GetOptions() & kFixedWidth) ?
2240  kTRUE : kFALSE;
2241  Bool_t fixedh = container->IsLayoutBroken() || (container->GetOptions() & kFixedHeight) ?
2242  kTRUE : kFALSE;
2243 
2244  // test whether we need scrollbars
2245  cw = fWidth - UInt_t(fBorderWidth << 1);
2246  ch = fHeight - UInt_t(fBorderWidth << 1);
2247 
2248  if (!fixedw) container->SetWidth(cw);
2249  if (!fixedh) container->SetHeight(ch);
2250 
2251  if (container->GetDefaultWidth() > cw) {
2253  need_hsb = kTRUE;
2254  ch -= fHScrollbar->GetDefaultHeight();
2255  if ((Int_t) ch < 0) {
2256  //Warning("Layout", "height would become too small, setting to 10");
2257  ch = 10;
2258  }
2259  if (!fixedh) container->SetHeight(ch);
2260  }
2261  }
2262 
2263  if (container->GetDefaultHeight() > ch) {
2265  need_vsb = kTRUE;
2266  cw -= fVScrollbar->GetDefaultWidth();
2267  if ((Int_t) cw < 0) {
2268  //Warning("Layout", "width would become too small, setting to 10");
2269  cw = 10;
2270  }
2271  if (!fixedw) container->SetWidth(cw);
2272  }
2273  }
2274 
2275  // re-check again (putting the vertical scrollbar could have changed things)
2276 
2277  if (container->GetDefaultWidth() > cw) {
2278  if (!need_hsb) {
2280  need_hsb = kTRUE;
2281  ch -= fHScrollbar->GetDefaultHeight();
2282  if ((Int_t) ch < 0) {
2283  //Warning("Layout", "height would become too small, setting to 10");
2284  ch = 10;
2285  }
2286  if (!fixedh) container->SetHeight(ch);
2287  }
2288  }
2289  }
2290 
2292 
2293  tcw = TMath::Max(container->GetDefaultWidth(), cw);
2294  tch = TMath::Max(container->GetDefaultHeight(), ch);
2295  UInt_t curw = container->GetDefaultWidth();
2296 
2297  container->SetWidth(0); // force a resize in TGFrame::Resize
2298 
2299  if (fixedw && fixedh) {
2300  container->Resize(curw, container->GetDefaultHeight());
2301  } else if (fixedw) {
2302  container->Resize(curw, tch);
2303  } else if (fixedh) {
2304  container->Resize(tcw, container->GetDefaultHeight());
2305  } else {
2306  container->Resize(tcw, tch);
2307  }
2308 
2309  if (fHScrollbar) {
2310  if (need_hsb) {
2312  fHScrollbar->SetRange((Int_t)container->GetWidth(), (Int_t)fVport->GetWidth());
2314  } else {
2317  if (container->IsLayoutBroken()) {
2318  container->Resize(fVport->GetWidth(), container->GetHeight());
2319  }
2320  }
2321  }
2322 
2323  if (fVScrollbar) {
2324  if (need_vsb) {
2326  fVScrollbar->SetRange((Int_t)container->GetHeight(), (Int_t)fVport->GetHeight());
2328  } else {
2331  if (container->IsLayoutBroken()) {
2332  container->Resize(container->GetWidth(), fVport->GetHeight());
2333  }
2334  }
2335  }
2336 }
2337 
2338 ////////////////////////////////////////////////////////////////////////////////
2339 /// Handle message generated by the canvas scrollbars.
2340 
2342 {
2343  switch (GET_MSG(msg)) {
2344  case kC_HSCROLL:
2345  switch (GET_SUBMSG(msg)) {
2346  case kSB_SLIDERTRACK:
2347  case kSB_SLIDERPOS:
2348  fVport->SetHPos((Int_t)-parm1);
2349  break;
2350  }
2351  break;
2352 
2353  case kC_VSCROLL:
2354  switch (GET_SUBMSG(msg)) {
2355  case kSB_SLIDERTRACK:
2356  case kSB_SLIDERPOS:
2357  fVport->SetVPos((Int_t)-parm1);
2358  break;
2359  }
2360  break;
2361 
2362  default:
2363  break;
2364  }
2365  return kTRUE;
2366 }
2367 
2368 ////////////////////////////////////////////////////////////////////////////////
2369 /// Get position of horizontal scrollbar.
2370 
2372 {
2373  if (fHScrollbar && fHScrollbar->IsMapped())
2374  return fHScrollbar->GetPosition();
2375  return 0;
2376 }
2377 
2378 ////////////////////////////////////////////////////////////////////////////////
2379 /// Get position of vertical scrollbar.
2380 
2382 {
2383  if (fVScrollbar && fVScrollbar->IsMapped())
2384  return fVScrollbar->GetPosition();
2385  return 0;
2386 }
2387 
2388 ////////////////////////////////////////////////////////////////////////////////
2389 /// Set position of horizontal scrollbar.
2390 
2392 {
2393  if (fHScrollbar && fHScrollbar->IsMapped()) {
2394  TGFrame *container = fVport->GetContainer();
2395  fHScrollbar->SetRange((Int_t)container->GetWidth(), (Int_t)fVport->GetWidth());
2396  fHScrollbar->SetPosition(newPos);
2397  } else {
2398  fVport->SetHPos(0);
2399  }
2400 }
2401 
2402 ////////////////////////////////////////////////////////////////////////////////
2403 /// Set position of vertical scrollbar.
2404 
2406 {
2407  if (fVScrollbar && fVScrollbar->IsMapped()) {
2408  TGFrame *container = fVport->GetContainer();
2409  fVScrollbar->SetRange((Int_t)container->GetHeight(), (Int_t)fVport->GetHeight());
2410  fVScrollbar->SetPosition(newPos);
2411  } else {
2412  fVport->SetVPos(0);
2413  }
2414 }
2415 
2416 ////////////////////////////////////////////////////////////////////////////////
2417 /// Set scrolling policy. Use values defined by the enum: kCanvasNoScroll,
2418 /// kCanvasScrollHorizontal, kCanvasScrollVertical, kCanvasScrollBoth.
2419 
2421 {
2422  if (scrolling != fScrolling) {
2423  fScrolling = scrolling;
2424  Layout();
2425  }
2426 }
2427 
2428 ////////////////////////////////////////////////////////////////////////////////
2429 /// Clear view port and redraw content.
2430 
2432 {
2433  TGFrame *cont = GetContainer();
2434  if (!cont) return;
2435 
2436  gVirtualX->ClearArea(cont->GetId(), 0, 0, fVport->GetWidth(), fVport->GetHeight());
2437  fClient->NeedRedraw(cont);
2438 }
2439 
2440 ////////////////////////////////////////////////////////////////////////////////
2441 /// Save a canvas widget as a C++ statement(s) on output stream out.
2442 
2443 void TGCanvas::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
2444 {
2445  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
2446 
2447  out << std::endl << " // canvas widget" << std::endl;
2448 
2449  out << " TGCanvas *";
2450  out << GetName() << " = new TGCanvas("<< fParent->GetName()
2451  << "," << GetWidth() << "," << GetHeight();
2452 
2454  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
2455  out << ");" << std::endl;
2456  } else {
2457  out << "," << GetOptionString() << ");" << std::endl;
2458  }
2459  } else {
2460  out << "," << GetOptionString() << ",ucolor);" << std::endl;
2461  }
2462  if (option && strstr(option, "keep_names"))
2463  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
2464 
2465  TGViewPort *vp = GetViewPort();
2466  out << std::endl << " // canvas viewport" << std::endl;
2467  out << " TGViewPort *" << vp->GetName() << " = " << GetName()
2468  << "->GetViewPort();" << std::endl;
2469 
2470  TGContainer *cont = (TGContainer*)GetContainer();
2471  cont->SavePrimitive(out, option);
2472 
2473  out << " " << vp->GetName() << "->AddFrame(" << cont->GetName()
2474  << ");" << std::endl;
2475 
2476  out << " " << cont->GetName() << "->SetLayoutManager(";
2477  cont->GetLayoutManager()->SavePrimitive(out, option);
2478  out << ");"<< std::endl;
2479 
2480  out << " " << cont->GetName() << "->MapSubwindows();" << std::endl;
2481 
2482  out << " " << GetName() << "->SetContainer(" << cont->GetName()
2483  << ");" << std::endl;
2484 
2485  out << " " << GetName() << "->MapSubwindows();" << std::endl;
2486 
2487  if (fHScrollbar && fHScrollbar->IsMapped())
2488  out << " " << GetName() << "->SetHsbPosition(" << GetHsbPosition()
2489  << ");" << std::endl;
2490 
2491 
2492  if (fVScrollbar && fVScrollbar->IsMapped())
2493  out << " " << GetName() << "->SetVsbPosition(" << GetVsbPosition()
2494  << ");" << std::endl;
2495 
2496 }
2497 
2498 ////////////////////////////////////////////////////////////////////////////////
2499 /// Save a canvas container as a C++ statement(s) on output stream out.
2500 
2501 void TGContainer::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
2502 {
2503  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
2504 
2505  out << std::endl << " // canvas container" << std::endl;
2506 
2508  out << GetName() << " = new TGContainer(" << GetCanvas()->GetName();
2509  } else {
2510  out << GetName() << " = new TGContainer(" << fParent->GetName();
2511  out << "," << GetWidth() << "," << GetHeight();
2512  }
2513 
2515  if (GetOptions() == (kSunkenFrame | kDoubleBorder)) {
2516  out <<");" << std::endl;
2517  } else {
2518  out << "," << GetOptionString() <<");" << std::endl;
2519  }
2520  } else {
2521  out << "," << GetOptionString() << ",ucolor);" << std::endl;
2522  }
2523  if (option && strstr(option, "keep_names"))
2524  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
2525 }
const int nx
Definition: kalman.C:16
Int_t GetPadTop() const
Definition: TGLayout.h:96
Int_t GetVPos() const
Definition: TGCanvas.h:197
virtual void ReturnPressed(TGFrame *)
Signal emitted when Return/Enter key pressed.
Definition: TGCanvas.cxx:479
virtual ~TGCanvas()
Delete canvas.
Definition: TGCanvas.cxx:2152
virtual TGDimension GetPageDimension() const
Returns page dimension.
Definition: TGCanvas.cxx:748
Int_t fLineStyle
Definition: GuiTypes.h:231
Int_t fYf
Definition: TGCanvas.h:58
const TGWindow * fParent
Definition: TGWindow.h:43
virtual void PageDown(Bool_t select=kFALSE)
Move position one page down.
Definition: TGCanvas.cxx:2024
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void SetPosition(Int_t pos)
Set logical slider position of vertical scrollbar.
TGHScrollBar * GetHScrollbar() const
Definition: TGCanvas.h:230
virtual void LineLeft(Bool_t select=kFALSE)
Move current position one column left.
Definition: TGCanvas.cxx:1848
virtual void MapSubwindows()
Definition: TGFrame.h:263
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:221
virtual void CurrentChanged(Int_t x, Int_t y)
Emit signal when current position changed.
Definition: TGCanvas.cxx:429
virtual const TGFrame * GetNextSelected(void **current)
Return the next selected item.
Definition: TGCanvas.cxx:678
Int_t fSelected
Definition: TGCanvas.h:61
TGVScrollBar * GetVScrollbar() const
Definition: TGCanvas.h:231
Utility class for browsing TMapFile objects.
Definition: TKeyMapFile.h:22
virtual void RemoveAll()
Remove all items from the container.
Definition: TGCanvas.cxx:638
virtual Bool_t IsActive() const
Definition: TGFrame.h:274
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGFrame.cxx:611
Int_t fY
Definition: TGDimension.h:53
Int_t fBorderWidth
Definition: TGFrame.h:156
virtual Int_t GetPageSize() const
Definition: TGScrollBar.h:135
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:487
const TGWindow * GetParent() const
Definition: TGWindow.h:87
void Reset()
Reset the timer.
Definition: TTimer.cxx:155
const Int_t kAutoScrollFudge
Definition: TGCanvas.cxx:77
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Ssiz_t Length() const
Definition: TString.h:390
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:321
const char Option_t
Definition: RtypesCore.h:62
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
virtual void SetPageDimension(const TGDimension &dim)
Set page dimension.
Definition: TGCanvas.cxx:779
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:196
void Merge(const TGRectangle &r)
R__EXTERN void * gTQSender
Definition: TQObject.h:49
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
Definition: TGCanvas.cxx:2405
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a canvas widget as a C++ statement(s) on output stream out.
Definition: TGCanvas.cxx:2443
Int_t fX0
Definition: TGCanvas.h:173
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
Int_t GetPadRight() const
Definition: TGLayout.h:99
virtual void End(Bool_t select=kFALSE)
Move to the bottom-right corner of container.
Definition: TGCanvas.cxx:2085
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:737
virtual Int_t GetPosition() const
Definition: TGScrollBar.h:134
TGCanvas(const TGCanvas &)
Bool_t fBdown
Definition: TGCanvas.h:73
TH1 * h
Definition: legend2.C:5
UInt_t GetWidth() const
Definition: TGFrame.h:287
virtual void SetVPos(Int_t ypos)
Moves content of container frame in vertical direction.
Definition: TGCanvas.cxx:224
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handle resize events.
Definition: TGCanvas.cxx:287
static const TGGC & GetLineGC()
Get graphics context for line drawing.
Definition: TGCanvas.cxx:2102
const Mask_t kWABitGravity
Definition: GuiTypes.h:145
Int_t fY
Definition: GuiTypes.h:179
Handle_t GContext_t
Definition: GuiTypes.h:39
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:403
Basic string class.
Definition: TString.h:137
virtual TList * GetList() const
Definition: TGFrame.h:385
Pixel_t fBackground
Definition: TGFrame.h:158
#define gClient
Definition: TGClient.h:174
static Pixel_t fgWhitePixel
Definition: TGFrame.h:166
const Mask_t kGCLineStyle
Definition: GuiTypes.h:292
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:170
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual TTimer * RemoveTimer(TTimer *t)
Remove timer from list of system timers.
Definition: TSystem.cxx:485
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
Definition: TObject.cxx:517
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void AdjustPosition()
Move content to position of highlighted/activated frame.
Definition: TGCanvas.cxx:1790
TGCanvas * fCanvas
Definition: TGCanvas.h:53
Int_t GetY() const
Definition: TGFrame.h:295
virtual TGVScrollBar * GetVScrollbar() const
returns pointer to vert. scroll bar
Definition: TGCanvas.cxx:1750
Int_t fFillStyle
Definition: GuiTypes.h:235
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move and/or resize the frame.
Definition: TGScrollBar.h:138
UInt_t GetHeight() const
Definition: TGFrame.h:288
static TGSearchDialog *& SearchDialog()
Return global search dialog.
virtual void MapRaised()
Definition: TGFrame.h:268
const TGWindow * fMsgWindow
Definition: TGCanvas.h:54
Window_t fWindow
Definition: GuiTypes.h:177
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:558
Int_t GetPadLeft() const
Definition: TGLayout.h:98
Short_t Abs(Short_t d)
Definition: TMathBase.h:110
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
EGraphicsFunction fFunction
Definition: GuiTypes.h:226
virtual void OnAutoScroll()
Autoscroll while close to & beyond The Wall.
Definition: TGCanvas.cxx:1492
static Atom_t GetDNDActionCopy()
Int_t fY0
Definition: TGCanvas.h:57
virtual void RemoveFrame(TGFrame *f)
Remove frame from composite frame.
Definition: TGFrame.cxx:1131
R__EXTERN TGDNDManager * gDNDManager
Definition: TGDNDManager.h:205
virtual void Home(Bool_t select=kFALSE)
Move to upper-left corner of container.
Definition: TGCanvas.cxx:2068
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:164
const char * Data() const
Definition: TString.h:349
virtual TGFrameElement * FindFrame(Int_t x, Int_t y, Bool_t exclude=kTRUE)
Find frame located int container at position x,y.
Definition: TGCanvas.cxx:1654
TGLayoutHints * fLayout
Definition: TGLayout.h:127
Double_t x[n]
Definition: legend1.C:17
virtual TObject * After(const TObject *obj) const
Returns the object after object obj.
Definition: TList.cxx:288
Bool_t IsDNDSource() const
Definition: TGFrame.h:335
void Class()
Definition: Class.C:29
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
virtual void SetHsbPosition(Int_t newPos)
set new hor. position
Definition: TGCanvas.cxx:1774
virtual UInt_t GetOptions() const
Definition: TGFrame.h:260
TGFrameElement * fLastActiveEl
Definition: TGCanvas.h:55
virtual void SelectAll()
Select all items in the container.
Definition: TGCanvas.cxx:562
const int ny
Definition: kalman.C:17
virtual void SetRange(Int_t range, Int_t page_size)
Set range of horizontal scrollbar.
virtual void PageUp(Bool_t select=kFALSE)
Move position one page up.
Definition: TGCanvas.cxx:1980
const TGPicture * GetObjPicture(TGFrame *f)
Retrieve icons associated with class "name".
Definition: TGCanvas.cxx:1036
ULong_t fForeground
Definition: GuiTypes.h:228
UInt_t GetWidth() const
Definition: TGPicture.h:73
Int_t fXRoot
Definition: GuiTypes.h:180
const Mask_t kGCLineWidth
Definition: GuiTypes.h:291
static Pixel_t fgBlackPixel
Definition: TGFrame.h:167
ECaseCompare
Definition: TString.h:257
static Vc_ALWAYS_INLINE Vector< T > abs(const Vector< T > &x)
Definition: vector.h:450
virtual Int_t GetHsbPosition() const
Get position of horizontal scrollbar.
Definition: TGCanvas.cxx:2371
const TGWindow * GetMessageWindow() const
Definition: TGCanvas.h:112
virtual Bool_t HandleExpose(Event_t *event)
Definition: TGWindow.h:107
const Mask_t kGCGraphicsExposures
Definition: GuiTypes.h:303
virtual void ClearViewPort()
Clear view port and redraw content.
Definition: TGCanvas.cxx:2431
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:627
virtual void Activate(Bool_t)
Definition: TGFrame.h:273
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:294
TGVScrollBar * fVScrollbar
Definition: TGCanvas.h:209
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Adding a frame to a canvas is actually adding the frame to the viewport container.
Definition: TGCanvas.cxx:2185
TTimer * fScrollTimer
Definition: TGCanvas.h:62
virtual const char * GetIconName() const
Returns mime type name of object.
Definition: TObject.cxx:425
virtual void LineDown(Bool_t select=kFALSE)
Move one line down.
Definition: TGCanvas.cxx:1953
virtual void MapSubwindows()
Definition: TGScrollBar.h:145
TTimer * fKeyTimer
Definition: TGCanvas.h:68
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:30
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t subString=kFALSE)
Definition: TGCanvas.cxx:1687
UInt_t fHeight
Definition: TGDimension.h:32
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:253
char * out
Definition: TBase64.cxx:29
virtual void RemoveItem(TGFrame *item)
Remove item from container.
Definition: TGCanvas.cxx:657
TString fLastName
Definition: TGCanvas.h:67
Bool_t fMapSubwindows
Definition: TGFrame.h:370
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:559
virtual void Layout()
Layout container entries.
Definition: TGCanvas.cxx:417
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a canvas container as a C++ statement(s) on output stream out.
Definition: TGCanvas.cxx:2501
virtual Bool_t Notify()
Notify when timer times out.
Definition: TTimer.cxx:141
virtual void SetPosition(Int_t pos)
Set logical slider position of horizontal scrollbar.
virtual void OnMouseOver(TGFrame *)
Signal emitted when pointer is over entry.
Definition: TGCanvas.cxx:496
A doubly linked list.
Definition: TList.h:47
virtual Bool_t HandleExpose(Event_t *event)
Handle expose events. Do not use double buffer.
Definition: TGCanvas.cxx:900
TGRectangle fExposedRegion
Definition: TGCanvas.h:74
const Mask_t kButtonPressMask
Definition: GuiTypes.h:162
virtual void DoubleClicked(TGFrame *f, Int_t btn)
Emit DoubleClicked() signal.
Definition: TGCanvas.cxx:533
const Mask_t kKeyPressMask
Definition: GuiTypes.h:160
virtual UInt_t GetEditDisabled() const
Definition: TGWindow.h:118
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1135
Bool_t fGraphicsExposures
Definition: GuiTypes.h:245
UInt_t fWidth
Definition: TGDimension.h:31
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click mouse event.
Definition: TGCanvas.cxx:1095
TList * fList
Definition: TGFrame.h:367
Int_t fYp
Definition: TGCanvas.h:56
virtual Bool_t HandleKey(Event_t *event)
The key press event handler converts a key press to some line editor action.
Definition: TGCanvas.cxx:1275
UInt_t fOptions
Definition: TGFrame.h:157
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
virtual TObject * Before(const TObject *obj) const
Returns the object before object obj.
Definition: TList.cxx:321
Time_t fTime
Definition: GuiTypes.h:178
SVector< double, 2 > v
Definition: Dict.h:5
EGEventType fType
Definition: GuiTypes.h:176
virtual void MapSubwindows()
Map all canvas sub windows.
Definition: TGCanvas.cxx:2162
UInt_t fHeight
Definition: GuiTypes.h:183
Int_t GET_SUBMSG(Long_t val)
virtual TGHScrollBar * GetHScrollbar() const
returns pointer to hor. scroll bar
Definition: TGCanvas.cxx:1742
void SetContainer(TGFrame *f)
Add container frame to the viewport.
Definition: TGCanvas.cxx:148
virtual void InvertSelection()
Invert the selection, all selected items become unselected and vice versa.
Definition: TGCanvas.cxx:611
static const TGGC & GetWhiteGC()
Get white graphics context.
Definition: TGFrame.cxx:727
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:90
Int_t fYDND
Definition: TGCanvas.h:72
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:674
virtual void SetDragPixmap(const TGPicture *pic)
Set drag window pixmaps and hotpoint.
Definition: TGCanvas.cxx:1077
virtual void SpacePressed(TGFrame *)
Signal emitted when space key pressed.
Definition: TGCanvas.cxx:488
Bool_t fKeyTimerActive
Definition: TGCanvas.h:70
UInt_t GetHeight() const
Definition: TGPicture.h:74
Bool_t Notify()
Definition: TTimer.cxx:65
Int_t fX0
Definition: TGCanvas.h:57
TGCanvas * GetCanvas() const
Definition: TGCanvas.h:111
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void LineRight(Bool_t select=kFALSE)
Move current position one column right.
Definition: TGCanvas.cxx:1887
TGFrame * GetContainer() const
Definition: TGCanvas.h:228
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw a region of container in viewport.
Definition: TGCanvas.cxx:816
const Handle_t kNone
Definition: GuiTypes.h:89
Int_t fXf
Definition: TGCanvas.h:58
TGFrame * fFrame
Definition: TGLayout.h:125
Int_t fYRoot
Definition: GuiTypes.h:180
TLine * l
Definition: textangle.C:4
TGViewPort(const TGViewPort &)
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:57
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle message generated by the canvas scrollbars.
Definition: TGCanvas.cxx:2341
virtual TGFrame * FindFrameByName(const char *name)
Find frame by name.
Definition: TGCanvas.cxx:1413
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
const std::string sname
Definition: testIO.cxx:45
Int_t fX
Definition: TGDimension.h:52
void SetDragPixmap(Pixmap_t pic, Pixmap_t mask, Int_t hot_x, Int_t hot_y)
Set drag window pixmaps and hotpoint.
Bool_t IsNull() const
Definition: TString.h:387
virtual TObjLink * FirstLink() const
Definition: TList.h:101
void Reset(Detail::TBranchProxy *x)
virtual void Search(Bool_t close=kTRUE)
Invokes search dialog. Looks for item with the entered name.
Definition: TGCanvas.cxx:1464
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:717
friend class TGContainerKeyboardTimer
Definition: TGCanvas.h:47
Long64_t entry
Int_t GetPadBottom() const
Definition: TGLayout.h:97
virtual ~TGContainer()
Delete canvas container.
Definition: TGCanvas.cxx:401
#define gVirtualX
Definition: TVirtualX.h:362
TGViewPort * fVport
Definition: TGCanvas.h:207
void SetScrolling(Int_t scrolling)
Set scrolling policy.
Definition: TGCanvas.cxx:2420
UInt_t fWidth
Definition: TGFrame.h:150
TGMimeTypes * GetMimeTypeList() const
Definition: TGClient.h:163
void SetPos(Int_t xpos, Int_t ypos)
Goto new position.
Definition: TGCanvas.cxx:276
virtual void ClearViewPort()
Clear view port and redraw full content.
Definition: TGCanvas.cxx:888
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition: TGFrame.cxx:575
Int_t GET_MSG(Long_t val)
Int_t fScrolling
Definition: TGCanvas.h:210
EKeySym
Definition: KeySymbols.h:27
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
Definition: TGFrame.cxx:425
static unsigned int total
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:580
long Long_t
Definition: RtypesCore.h:50
Int_t fXp
Definition: TGCanvas.h:56
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:232
static TGGC * fgLineGC
Definition: TGCanvas.h:76
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:309
Int_t fXDND
Definition: TGCanvas.h:72
Bool_t fLastCase
Definition: TGCanvas.h:65
TGContainer(const TGContainer &)
TGHScrollBar * fHScrollbar
Definition: TGCanvas.h:208
ULong_t fBackground
Definition: GuiTypes.h:229
TString fKeyInput
Definition: TGCanvas.h:69
virtual void SetPagePosition(const TGPosition &pos)
Set page position.
Definition: TGCanvas.cxx:761
#define ClassImp(name)
Definition: Rtypes.h:279
virtual void DrawCopy(Handle_t, Int_t, Int_t)
Definition: TGFrame.h:272
double f(double x)
const Mask_t kGCFillStyle
Definition: GuiTypes.h:295
virtual void RepeatSearch()
Repeats search.
Definition: TGCanvas.cxx:1620
Pixmap_t GetPicture() const
Definition: TGPicture.h:75
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:167
virtual void DrawBorder()
Draw canvas border.
Definition: TGCanvas.cxx:2201
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:163
const Int_t kKeyboardTime
Definition: TGCanvas.cxx:79
UInt_t fCode
Definition: GuiTypes.h:181
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:287
virtual void SetVsbPosition(Int_t newPos)
Set position of vertical scrollbar.
Definition: TGCanvas.cxx:1758
virtual void SetRange(Int_t range, Int_t page_size)
Set range of vertical scrollbar.
Pixmap_t GetMask() const
Definition: TGPicture.h:76
unsigned long ULong_t
Definition: RtypesCore.h:51
friend class TGContainerScrollTimer
Definition: TGCanvas.h:48
Double_t y[n]
Definition: legend1.C:17
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
Definition: TGWindow.cxx:180
const Mask_t kGCFunction
Definition: GuiTypes.h:287
const Mask_t kWAWinGravity
Definition: GuiTypes.h:146
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1293
virtual void UnSelectAll()
Unselect all items in the container.
Definition: TGCanvas.cxx:585
const Mask_t kGCForeground
Definition: GuiTypes.h:289
UInt_t fHeight
Definition: TGFrame.h:151
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
Int_t GetX() const
Definition: TGFrame.h:294
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2881
virtual TGPosition GetPagePosition() const
Returns page position.
Definition: TGCanvas.cxx:734
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events.
Definition: TGCanvas.cxx:1138
Long_t fUser[5]
Definition: GuiTypes.h:188
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
Handle_t fId
Definition: TGObject.h:40
#define name(a, b)
Definition: linkTestLib0.cpp:5
TGViewPort * fViewPort
Definition: TGCanvas.h:52
Bool_t Drag(Int_t x_root, Int_t y_root, Atom_t action, Time_t timestamp)
Process drag event.
Mother of all ROOT objects.
Definition: TObject.h:58
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:556
UInt_t fWidth
Definition: GuiTypes.h:183
Handle_t Window_t
Definition: GuiTypes.h:30
virtual void UnmapWindow()
Definition: TGFrame.h:269
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition: TGWindow.h:119
TGFrame * fContainer
Definition: TGCanvas.h:174
Mask_t fMask
Definition: GuiTypes.h:252
virtual void Layout()
Create layout for canvas.
Definition: TGCanvas.cxx:2226
virtual void SetHPos(Int_t xpos)
Moves content of container frame in horizontal direction.
Definition: TGCanvas.cxx:173
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:254
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:310
Bool_t fLastDir
Definition: TGCanvas.h:64
Bool_t IsEmpty() const
Definition: TGDimension.h:150
const Ssiz_t kNPOS
Definition: Rtypes.h:115
const Mask_t kGCSubwindowMode
Definition: GuiTypes.h:302
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Definition: TSystem.cxx:475
virtual void MapWindow()
Definition: TGFrame.h:267
TGClient * fClient
Definition: TGObject.h:41
const Mask_t kGCBackground
Definition: GuiTypes.h:290
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:202
virtual void LineUp(Bool_t select=kFALSE)
Make current position first line in window by scrolling up.
Definition: TGCanvas.cxx:1924
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
Handle_t Pixmap_t
Definition: GuiTypes.h:31
virtual void ActivateItem(TGFrameElement *el)
Activate item.
Definition: TGCanvas.cxx:698
Int_t fLineWidth
Definition: GuiTypes.h:230
virtual void KeyPressed(TGFrame *, UInt_t keysym, UInt_t mask)
Signal emitted when keyboard key pressed.
Definition: TGCanvas.cxx:465
Int_t fTotal
Definition: TGCanvas.h:60
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:370
Bool_t IsDragging() const
Definition: TGDNDManager.h:177
UInt_t fState
Definition: GuiTypes.h:182
UInt_t fEditDisabled
Definition: TGWindow.h:47
virtual Bool_t IsLayoutBroken() const
Definition: TGFrame.h:279
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2433
virtual void DoRedraw()
Redraw content of container in the viewport region.
Definition: TGCanvas.cxx:797
virtual void SetHsbPosition(Int_t newPos)
Set position of horizontal scrollbar.
Definition: TGCanvas.cxx:2391
void SetDashOffset(Int_t v)
Patterned/dashed line offset.
Definition: TGGC.cxx:475
Int_t GetHPos() const
Definition: TGCanvas.h:196
Int_t fSubwindowMode
Definition: GuiTypes.h:244
virtual Bool_t IsModified() const
Definition: TGLayout.h:159
Bool_t StartDrag(TGFrame *src, Int_t x_root, Int_t y_root, Window_t grabWin=kNone)
Start dragging.
TGFrame * GetContainer() const
Definition: TGCanvas.h:185
const Mask_t kKeyControlMask
Definition: GuiTypes.h:198
TGContainerKeyboardTimer(TGContainer *t)
Definition: TGCanvas.cxx:92
Bool_t fOnMouseOver
Definition: TGCanvas.h:63
Int_t fY0
Definition: TGCanvas.h:173
virtual void SearchPattern()
Search for entry which name begins with pattern.
Definition: TGCanvas.cxx:1594
Bool_t fLastSubstring
Definition: TGCanvas.h:66
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:582
void Empty()
Definition: TGDimension.h:149
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:459
const Mask_t kAnyModifier
Definition: GuiTypes.h:211
TObject * obj
virtual void DeActivateItem(TGFrameElement *el)
DeActivate item.
Definition: TGCanvas.cxx:721
virtual TGSearchType * GetType() const
Handle_t GetId() const
Definition: TGObject.h:52
const Int_t kAcceleration[kAutoScrollFudge+1]
Definition: TGCanvas.cxx:78
Definition: TGGC.h:35
const Int_t n
Definition: legend1.C:16
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2460
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:747
Int_t fX
Definition: GuiTypes.h:179
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:757
virtual void DestroyWindow()
Definition: TGWindow.h:94
void SetDashList(const char v[], Int_t len)
Set dash pattern. First use SetDashOffset() if not 0.
Definition: TGGC.cxx:486
virtual TGLayoutManager * GetLayoutManager() const
Definition: TGFrame.h:413
virtual Int_t GetVsbPosition() const
Get position of vertical scrollbar.
Definition: TGCanvas.cxx:2381
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:118
Bool_t fDragging
Definition: TGCanvas.h:59
Definition: TGMsgBox.h:52
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:229
virtual void Clicked(TGFrame *f, Int_t btn)
Emit Clicked() signal.
Definition: TGCanvas.cxx:505
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in container.
Definition: TGCanvas.cxx:926
Bool_t fScrolling
Definition: TGCanvas.h:71
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TObject.cxx:702