Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGedPatternSelect.cxx
Go to the documentation of this file.
1 // @(#)root/ged:$Id$
2 // Author: Marek Biskup, Ilka Antcheva 22/07/03
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, 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 // //
15 // TGedPatternFrame, TGedPatternSelector, TGedPatternPopup //
16 // and TGedPatternColor //
17 // //
18 // The TGedPatternFrame is a small frame with border showing //
19 // a specific pattern (fill style. //
20 // //
21 // The TGedPatternSelector is a composite frame with TGedPatternFrames //
22 // of all diferent styles //
23 // //
24 // The TGedPatternPopup is a popup containing a TGedPatternSelector. //
25 // //
26 // The TGedPatternSelect widget is a button with pattern area with //
27 // a little down arrow. When clicked on the arrow the //
28 // TGedPatternPopup pops up. //
29 // //
30 // Selecting a pattern in this widget will generate the event: //
31 // kC_PATTERNSEL, kPAT_SELCHANGED, widget id, style. //
32 // //
33 // and the signal: //
34 // PatternSelected(Style_t pattern) //
35 // //
36 // TGedSelect is button that shows popup window when clicked. //
37 // TGedPopup is a popup window. //
38 // //
39 //////////////////////////////////////////////////////////////////////////
40 
41 #include "TGResourcePool.h"
42 #include "TGedPatternSelect.h"
43 #include "RConfigure.h"
44 #include "TGToolTip.h"
45 #include "TGButton.h"
46 #include "Riostream.h"
47 #include "RStipples.h"
48 
49 ClassImp(TGedPopup);
50 ClassImp(TGedSelect);
51 ClassImp(TGedPatternFrame);
52 ClassImp(TGedPatternSelector);
53 ClassImp(TGedPatternPopup);
54 ClassImp(TGedPatternSelect);
55 
56 TGGC* TGedPatternFrame::fgGC = 0;
57 
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Pattern select ctor.
61 
62 TGedPatternFrame::TGedPatternFrame(const TGWindow *p, Style_t pattern,
63  int width, int height)
64  : TGFrame(p, width, height, kOwnBackground)
65 {
66  Pixel_t white;
67  gClient->GetColorByName("white", white); // white background
68  SetBackgroundColor(white);
69 
70  // special case: solid
71  if (pattern == 1001)
72  SetBackgroundColor(0); // if solid then black
73 
74  fPattern = pattern;
75 
76  AddInput(kButtonPressMask | kButtonReleaseMask);
77  fMsgWindow = p;
78  fActive = kFALSE;
79  snprintf(fTipText, sizeof(fTipText), "%d", pattern);
80 
81  // solid and hollow must be treated separately
82  if (pattern != 0 && pattern != 1001)
83  fTip = new TGToolTip(fClient->GetDefaultRoot(), this, fTipText, 1000);
84  else if (pattern == 0)
85  fTip = new TGToolTip(fClient->GetDefaultRoot(), this, "0 - hollow", 1000);
86  else // pattern == 1001
87  fTip = new TGToolTip(fClient->GetDefaultRoot(), this, "1001 - solid", 1000);
88 
89  AddInput(kEnterWindowMask | kLeaveWindowMask);
90 
91  if (!fgGC) {
92  GCValues_t gcv;
93  gcv.fMask = kGCLineStyle | kGCLineWidth | kGCFillStyle |
94  kGCForeground | kGCBackground;
95  gcv.fLineStyle = kLineSolid;
96  gcv.fLineWidth = 0;
97  gcv.fFillStyle = 0;
98  gcv.fBackground = white;
99  gcv.fForeground = 0; // black foreground
100  fgGC = gClient->GetGC(&gcv, kTRUE);
101  }
102 }
103 
104 ////////////////////////////////////////////////////////////////////////////////
105 /// Handle mouse crossing event.
106 
107 Bool_t TGedPatternFrame::HandleCrossing(Event_t *event)
108 {
109  if (fTip) {
110  if (event->fType == kEnterNotify)
111  fTip->Reset();
112  else
113  fTip->Hide();
114  }
115  return kTRUE;
116 }
117 
118 ////////////////////////////////////////////////////////////////////////////////
119 /// Handle mouse button event.
120 
121 Bool_t TGedPatternFrame::HandleButton(Event_t *event)
122 {
123  if (event->fType == kButtonPress) {
124  SendMessage(fMsgWindow, MK_MSG(kC_PATTERNSEL, kPAT_CLICK), event->fCode, fPattern);
125  } else { // kButtonRelease
126  SendMessage(fMsgWindow, MK_MSG(kC_PATTERNSEL, kPAT_SELCHANGED), event->fCode, fPattern);
127  }
128 
129  return kTRUE;
130 }
131 
132 ////////////////////////////////////////////////////////////////////////////////
133 /// Draw border.
134 
135 void TGedPatternFrame::DrawBorder()
136 {
137  gVirtualX->DrawRectangle(fId, GetBckgndGC()(), 0, 0, fWidth, fHeight);
138  Draw3dRectangle(kDoubleBorder | kSunkenFrame, 0, 0, fWidth, fHeight);
139 }
140 
141 ////////////////////////////////////////////////////////////////////////////////
142 /// Redraw selected pattern.
143 
144 void TGedPatternFrame::DoRedraw()
145 {
146  TGFrame::DoRedraw();
147 
148  if (fPattern > 3000 && fPattern < 3026) {
149  SetFillStyle(fgGC, fPattern);
150  gVirtualX->FillRectangle(fId, fgGC->GetGC(), 0, 0, fWidth, fHeight);
151  }
152  DrawBorder();
153 }
154 
155 ////////////////////////////////////////////////////////////////////////////////
156 /// Set fill area style.
157 /// fstyle : compound fill area interior style
158 /// fstyle = 1000*interiorstyle + styleindex
159 /// this function should be in TGGC !!!
160 
161 void TGedPatternFrame::SetFillStyle(TGGC* gc, Style_t fstyle)
162 {
163  Int_t style = fstyle/1000;
164  Int_t fasi = fstyle%1000;
165  Int_t stn = (fasi >= 1 && fasi <=25) ? fasi : 2;
166 
167  static Pixmap_t fillPattern = 0;
168 
169  switch (style) {
170  case 1: // solid
171  gc->SetFillStyle(kFillSolid);
172  break;
173  case 2: // pattern
174  break;
175  case 3: // hatch
176  gc->SetFillStyle(kFillStippled);
177  if (fillPattern != 0) {
178  gVirtualX->DeletePixmap(fillPattern);
179  fillPattern = 0;
180  }
181  fillPattern = gVirtualX->CreateBitmap(gClient->GetDefaultRoot()->GetId(),
182  (const char*)gStipples[stn], 16, 16);
183  gc->SetStipple(fillPattern);
184  break;
185  default:
186  break;
187  }
188 }
189 
190 ////////////////////////////////////////////////////////////////////////////////
191 /// Create pattern popup window.
192 
193 TGedPatternSelector::TGedPatternSelector(const TGWindow *p) :
194  TGCompositeFrame(p, 124, 190)
195 {
196  SetLayoutManager(new TGTileLayout(this, 1));
197 
198  Int_t i;
199  for (i = 1; i <= 25; i++)
200  fCe[i-1] = new TGedPatternFrame(this, 3000 + i);
201 
202  fCe[25] = new TGedPatternFrame(this, 0);
203  fCe[26] = new TGedPatternFrame(this, 1001);
204 
205  for (i = 0; i < 27; i++)
206  AddFrame(fCe[i], new TGLayoutHints(kLHintsNoHints));
207 
208  fMsgWindow = p;
209  fActive = -1;
210 }
211 
212 ////////////////////////////////////////////////////////////////////////////////
213 /// Delete pattern popup window.
214 
215 TGedPatternSelector::~TGedPatternSelector()
216 {
217  Cleanup();
218 }
219 
220 ////////////////////////////////////////////////////////////////////////////////
221 /// Set selected the current style.
222 
223 void TGedPatternSelector::SetActive(Int_t newat)
224 {
225  if (fActive != newat) {
226  if ((fActive >= 0) && (fActive < 27)) {
227  fCe[fActive]->SetActive(kFALSE);
228  }
229  fActive = newat;
230  if ((fActive >= 0) && (fActive < 27)) {
231  fCe[fActive]->SetActive(kTRUE);
232  }
233  }
234 }
235 
236 ////////////////////////////////////////////////////////////////////////////////
237 /// Process message generated by pattern popup window.
238 
239 Bool_t TGedPatternSelector::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
240 {
241  switch (GET_MSG(msg)) {
242  case kC_PATTERNSEL:
243  switch (GET_SUBMSG(msg)) {
244  case kPAT_SELCHANGED:
245  switch (parm1) {
246  case kButton1:
247  SendMessage(fMsgWindow, MK_MSG(kC_PATTERNSEL,
248  kPAT_SELCHANGED), parm1, parm2);
249  break;
250  }
251  break;
252  case kPAT_CLICK:
253  switch (parm1) {
254  case kButton1:
255  SetActive(parm2);
256  break;
257  }
258  break;
259  }
260  }
261 
262  return kTRUE;
263 }
264 
265 ////////////////////////////////////////////////////////////////////////////////
266 /// Create a popup frame.
267 
268 TGedPopup::TGedPopup(const TGWindow *p, const TGWindow *m, UInt_t w, UInt_t h,
269  UInt_t options, Pixel_t back)
270  : TGCompositeFrame(p, w, h, options, back)
271 {
272  fMsgWindow = m;
273  SetWindowAttributes_t wattr;
274 
275  wattr.fMask = kWAOverrideRedirect | kWASaveUnder ;
276  wattr.fOverrideRedirect = kTRUE;
277  wattr.fSaveUnder = kTRUE;
278  gVirtualX->ChangeWindowAttributes(fId, &wattr);
279 
280  AddInput(kStructureNotifyMask);
281 }
282 
283 ////////////////////////////////////////////////////////////////////////////////
284 /// Ungrab pointer and unmap popup window.
285 
286 void TGedPopup::EndPopup()
287 {
288  gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);
289  UnmapWindow();
290 }
291 
292 ////////////////////////////////////////////////////////////////////////////////
293 /// Place popup window at the specified place.
294 
295 void TGedPopup::PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
296 {
297  Int_t rx, ry;
298  UInt_t rw, rh;
299 
300  // Parent is root window for the popup:
301  gVirtualX->GetWindowSize(fParent->GetId(), rx, ry, rw, rh);
302 
303  if (gVirtualX->InheritsFrom("TGWin32")) {
304  if ((x > 0) && ((x + abs(rx) + (Int_t)fWidth) > (Int_t)rw))
305  x = rw - abs(rx) - fWidth;
306  if ((y > 0) && (y + abs(ry) + (Int_t)fHeight > (Int_t)rh))
307  y = rh - fHeight;
308  } else {
309  if (x < 0) x = 0;
310  if (x + fWidth > rw) x = rw - fWidth;
311  if (y < 0) y = 0;
312  if (y + fHeight > rh) y = rh - fHeight;
313  }
314 
315  MoveResize(x, y, w, h);
316  MapSubwindows();
317  Layout();
318  MapRaised();
319 
320  gVirtualX->GrabPointer(fId, kButtonPressMask | kButtonReleaseMask |
321  kPointerMotionMask, kNone,
322  fClient->GetResourcePool()->GetGrabCursor());
323  gClient->WaitForUnmap(this);
324  EndPopup();
325 }
326 
327 ////////////////////////////////////////////////////////////////////////////////
328 /// Handle mouse button event in popup window.
329 
330 Bool_t TGedPopup::HandleButton(Event_t *event)
331 {
332  if ((event->fX < 0) || (event->fX >= (Int_t) fWidth) ||
333  (event->fY < 0) || (event->fY >= (Int_t) fHeight)) {
334 
335  if (event->fType == kButtonRelease) EndPopup();
336 
337  } else {
338  TGFrame *f = GetFrameFromPoint(event->fX, event->fY);
339  if (f && f != this) {
340  TranslateCoordinates(f, event->fX, event->fY, event->fX, event->fY);
341  f->HandleButton(event);
342  }
343  }
344  return kTRUE;
345 }
346 
347 ////////////////////////////////////////////////////////////////////////////////
348 /// Process messages generated by popup window.
349 
350 Bool_t TGedPopup::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
351 {
352  switch (GET_MSG(msg)) {
353  case kC_POPUP:
354  switch (GET_SUBMSG(msg)) {
355  case kPOP_HIDE:
356  EndPopup();
357  SendMessage(fMsgWindow, MK_MSG(kC_POPUP, kPOP_HIDE),
358  parm1, parm2);
359  break;
360  default:
361  break;
362  }
363  break;
364  }
365  return kTRUE;
366 }
367 
368 ////////////////////////////////////////////////////////////////////////////////
369 /// Pattern popup constructor.
370 
371 TGedPatternPopup::TGedPatternPopup(const TGWindow *p, const TGWindow *m, Style_t pattern)
372  : TGedPopup(p, m, 10, 10, kDoubleBorder | kRaisedFrame | kOwnBackground,
373  GetDefaultFrameBackground())
374 {
375  fCurrentPattern = pattern;
376 
377  TGedPatternSelector *ps = new TGedPatternSelector(this);
378  AddFrame(ps, new TGLayoutHints(kLHintsCenterX, 1, 1, 1, 1));
379 
380  MapSubwindows();
381  Resize(ps->GetDefaultWidth() + 6, ps->GetDefaultHeight());
382 }
383 
384 ////////////////////////////////////////////////////////////////////////////////
385 /// Destructor of pattern popup window.
386 
387 TGedPatternPopup::~TGedPatternPopup()
388 {
389  Cleanup();
390 }
391 
392 ////////////////////////////////////////////////////////////////////////////////
393 /// Process messages generated by pattern popup window.
394 
395 Bool_t TGedPatternPopup::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
396 {
397  switch (GET_MSG(msg)) {
398  case kC_PATTERNSEL:
399  switch (GET_SUBMSG(msg)) {
400  case kPAT_SELCHANGED:
401  SendMessage(fMsgWindow, MK_MSG(kC_PATTERNSEL, kPAT_SELCHANGED),
402  parm1, parm2);
403  UnmapWindow();
404  break;
405 
406  default:
407  break;
408  }
409  break;
410  }
411  return kTRUE;
412 }
413 
414 ////////////////////////////////////////////////////////////////////////////////
415 /// Create pattern select button.
416 
417 TGedSelect::TGedSelect(const TGWindow *p, Int_t id)
418  : TGCheckButton(p, "", id)
419 {
420  fPopup = 0;
421 
422  GCValues_t gcv;
423  gcv.fMask = kGCLineStyle | kGCLineWidth | kGCFillStyle |
424  kGCForeground | kGCBackground;
425  gcv.fLineStyle = kLineSolid;
426  gcv.fLineWidth = 0;
427  gcv.fFillStyle = 0;
428  Pixel_t white;
429  gClient->GetColorByName("white", white); // white background
430  gcv.fBackground = white;
431  gcv.fForeground = 0; // black foreground
432  fDrawGC = gClient->GetGC(&gcv, kTRUE);
433 
434  Enable();
435  SetState(kButtonUp);
436  AddInput(kButtonPressMask | kButtonReleaseMask);
437 }
438 
439 ////////////////////////////////////////////////////////////////////////////////
440 /// Destructor of pattern select button.
441 
442 TGedSelect::~TGedSelect()
443 {
444  if (fPopup)
445  delete fPopup;
446  fClient->FreeGC(fDrawGC);
447 }
448 
449 ////////////////////////////////////////////////////////////////////////////////
450 /// Handle mouse button events in pattern select button.
451 
452 Bool_t TGedSelect::HandleButton(Event_t *event)
453 {
454  TGFrame::HandleButton(event);
455 
456  if (!IsEnabled()) return kTRUE;
457 
458  if (event->fCode != kButton1) return kFALSE;
459 
460  if ((event->fType == kButtonPress) && HasFocus()) WantFocus();
461 
462  if (event->fType == kButtonPress) {
463  if (fState != kButtonDown) {
464  fPrevState = fState;
465  SetState(kButtonDown);
466  }
467  } else {
468  if (fState != kButtonUp) {
469  SetState(kButtonUp);
470  Window_t wdummy;
471  Int_t ax, ay;
472  if (fPopup) {
473  gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(),
474  0, fHeight, ax, ay, wdummy);
475 #ifdef R__HAS_COCOA
476  gVirtualX->SetWMTransientHint(fPopup->GetId(), GetId());
477 #endif
478  fPopup->PlacePopup(ax, ay, fPopup->GetDefaultWidth(),
479  fPopup->GetDefaultHeight());
480  }
481  }
482  }
483  return kTRUE;
484 }
485 
486 ////////////////////////////////////////////////////////////////////////////////
487 /// Set widget state flag (kTRUE=enabled, kFALSE=disabled).
488 
489 void TGedSelect::Enable()
490 {
491  SetFlags(kWidgetIsEnabled);
492  fClient->NeedRedraw(this);
493 }
494 
495 ////////////////////////////////////////////////////////////////////////////////
496 /// Clear widget state flag.
497 
498 void TGedSelect::Disable()
499 {
500  ClearFlags(kWidgetIsEnabled);
501  fClient->NeedRedraw(this);
502 }
503 
504 ////////////////////////////////////////////////////////////////////////////////
505 /// Draw separator and arrow.
506 
507 void TGedSelect::DoRedraw()
508 {
509  Int_t x, y;
510  UInt_t h;
511 
512  TGButton::DoRedraw();
513 
514  if (IsEnabled()) {
515 
516  // separator
517  x = fWidth - 6 - fBorderWidth - 6;
518  y = fBorderWidth + 1;
519  h = fHeight - fBorderWidth - 1; // actually y1
520 
521  if (fState == kButtonDown) { ++x; ++y; }
522 
523  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
524  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
525  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
526 
527  // arrow
528 
529  x = fWidth - 6 - fBorderWidth - 2;
530  y = (fHeight - 4) / 2 + 1;
531 
532  if (fState == kButtonDown) { ++x; ++y; }
533 
534  DrawTriangle(GetBlackGC()(), x, y);
535 
536  } else {
537 
538  // separator
539  x = fWidth - 6 - fBorderWidth - 6;
540  y = fBorderWidth + 1;
541  h = fHeight - fBorderWidth - 1; // actually y1
542 
543  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
544  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
545  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
546 
547  // sunken arrow
548 
549  x = fWidth - 6 - fBorderWidth - 2;
550  y = (fHeight - 4) / 2 + 1;
551 
552  DrawTriangle(GetHilightGC()(), x + 1, y + 1);
553  DrawTriangle(GetShadowGC()(), x, y);
554  }
555 }
556 
557 ////////////////////////////////////////////////////////////////////////////////
558 /// Draw small triangle.
559 
560 void TGedSelect::DrawTriangle(GContext_t gc, Int_t x, Int_t y)
561 {
562  Point_t points[3];
563 
564 #ifdef R__HAS_COCOA
565  points[0].fX = x;
566  points[0].fY = y;
567  points[1].fX = x + 6;
568  points[1].fY = y;
569  points[2].fX = x + 3;
570  points[2].fY = y + 3;
571 #else
572  points[0].fX = x;
573  points[0].fY = y;
574  points[1].fX = x + 5;
575  points[1].fY = y;
576  points[2].fX = x + 2;
577  points[2].fY = y + 3;
578 #endif
579 
580  gVirtualX->FillPolygon(fId, gc, points, 3);
581 }
582 
583 
584 ////////////////////////////////////////////////////////////////////////////////
585 /// Create and pop up pattern select window.
586 
587 TGedPatternSelect::TGedPatternSelect(const TGWindow *p, Style_t pattern, Int_t id)
588  : TGedSelect(p, id)
589 {
590  fPattern = pattern;
591  SetPopup(new TGedPatternPopup(gClient->GetDefaultRoot(), this, fPattern));
592  SetPattern(fPattern);
593 }
594 
595 ////////////////////////////////////////////////////////////////////////////////
596 /// Process message according to the user input.
597 
598 Bool_t TGedPatternSelect::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
599 {
600  if (GET_MSG(msg) == kC_PATTERNSEL && GET_SUBMSG(msg) == kPAT_SELCHANGED)
601  {
602  SetPattern(parm2);
603  parm1 = (Long_t)fWidgetId;
604  SendMessage(fMsgWindow, MK_MSG(kC_PATTERNSEL, kPAT_SELCHANGED),
605  parm1, parm2);
606  }
607  return kTRUE;
608 }
609 
610 ////////////////////////////////////////////////////////////////////////////////
611 /// Draw selected pattern as current one.
612 
613 void TGedPatternSelect::DoRedraw()
614 {
615  TGedSelect::DoRedraw();
616 
617  Int_t x, y;
618  UInt_t w, h;
619 
620  if (IsEnabled()) { // pattern rectangle
621 
622  x = fBorderWidth + 2;
623  y = fBorderWidth + 2; // 1;
624  h = fHeight - (fBorderWidth * 2) - 4; // -3; // 14
625  w = h * 2;
626  if (fState == kButtonDown) { ++x; ++y; }
627 
628 #ifdef R__HAS_COCOA
629  TGedPatternFrame::SetFillStyle(fDrawGC, 1001);
630 
631  Pixel_t white;
632  gClient->GetColorByName("white", white); // white background
633  fDrawGC->SetForeground(white);
634  gVirtualX->FillRectangle(fId, fDrawGC->GetGC(), x + 1, y + 1, w - 1, h - 1);
635 
636  if (fPattern != 0) {
637  fDrawGC->SetForeground(0);
638  TGedPatternFrame::SetFillStyle(fDrawGC, fPattern);
639  gVirtualX->FillRectangle(fId, fDrawGC->GetGC(), x + 1, y + 1, w - 1, h - 1);
640  }
641 
642  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x + 1, y + 1, w - 1, h - 1);
643 #else
644  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x, y, w - 1, h - 1);
645 
646  TGedPatternFrame::SetFillStyle(fDrawGC, 1001);
647 
648  Pixel_t white;
649  gClient->GetColorByName("white", white); // white background
650  fDrawGC->SetForeground(white);
651  gVirtualX->FillRectangle(fId, fDrawGC->GetGC(), x + 1, y + 1, w - 2, h - 2);
652 
653  if (fPattern != 0) {
654  fDrawGC->SetForeground(0);
655  TGedPatternFrame::SetFillStyle(fDrawGC, fPattern);
656  gVirtualX->FillRectangle(fId, fDrawGC->GetGC(), x + 1, y + 1, w - 2, h - 2);
657  }
658 #endif
659  } else { // sunken rectangle
660 
661  x = fBorderWidth + 2;
662  y = fBorderWidth + 2; // 1;
663  w = 42;
664  h = fHeight - (fBorderWidth * 2) - 4; // 3;
665  Draw3dRectangle(kSunkenFrame, x, y, w, h);
666  }
667 }
668 
669 ////////////////////////////////////////////////////////////////////////////////
670 /// Set pattern.
671 
672 void TGedPatternSelect::SetPattern(Style_t pattern, Bool_t emit)
673 {
674  fPattern = pattern;
675  gClient->NeedRedraw(this);
676  if (emit)
677  PatternSelected(fPattern);
678 }
679 
680 ////////////////////////////////////////////////////////////////////////////////
681 /// Save the pattern select widget as a C++ statement(s) on output stream out
682 
683 void TGedPatternSelect::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
684 {
685  out <<" TGedPatternSelect *";
686  out << GetName() << " = new TGedPatternSelect(" << fParent->GetName()
687  << "," << fPattern << "," << WidgetId() << ");" << std::endl;
688 }