Logo ROOT   6.12/07
Reference Guide
TGColorSelect.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Bertrand Bellenot + Fons Rademakers 22/08/02
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  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 // TGColorFrame, TG16ColorSelector, TGColorPopup and TGColorSelect. //
26 // //
27 // The TGColorFrame is a small frame with border showing a specific //
28 // color. //
29 // //
30 // The TG16ColorSelector is a composite frame with 16 TGColorFrames. //
31 // //
32 // The TGColorPopup is a popup containing a TG16ColorSelector and a //
33 // "More..." button which popups up a TGColorDialog allowing custom //
34 // color selection. //
35 // //
36 // The TGColorSelect widget is like a checkbutton but instead of the //
37 // check mark there is color area with a little down arrow. When //
38 // clicked on the arrow the TGColorPopup pops up. //
39 // //
40 // Selecting a color in this widget will generate the event: //
41 // kC_COLORSEL, kCOL_SELCHANGED, widget id, pixel. //
42 // and the signal: //
43 // ColorSelected(Pixel_t color) //
44 // //
45 //////////////////////////////////////////////////////////////////////////
46 
47 #include "TGClient.h"
48 #include "TGMsgBox.h"
49 #include "TGGC.h"
50 #include "TGColorSelect.h"
51 #include "TGColorDialog.h"
52 #include "TGResourcePool.h"
53 #include "RConfigure.h"
54 #include "TG3DLine.h"
55 #include "TColor.h"
56 #include "Riostream.h"
57 
62 
63 
64 ////////////////////////////////////////////////////////////////////////////////
65 /// TGColorFrame constructor.
66 /// The TGColorFrame is a small frame with border showing a specific color.
67 
69  TGFrame(p, 20, 20, kOwnBackground, color)
70 {
71  SetBackgroundColor(color);
72 
73  fPixel = fColor = color;
74 
76  fMsgWindow = p;
77  fActive = kFALSE;
78 
79  fGrayGC = GetShadowGC()();
81 }
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Handle button events in TGColorFrame.
85 
87 {
88  if (event->fType == kButtonPress) {
90  } else { // kButtonRelease
92  }
93 
94  return kTRUE;
95 }
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// Draw TGColorFrame border.
99 
101 {
102  gVirtualX->DrawRectangle(fId, GetBckgndGC()(), 0, 0, fWidth - 1, fHeight - 1);
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// TG16ColorSelector constructor.
108 /// The TG16ColorSelector is a composite frame with 16 TGColorFrames.
109 
111  TGCompositeFrame(p, 10, 10)
112 {
113  SetLayoutManager(new TGMatrixLayout(this, 4, 4, 1, 1));
114 
115  fCe[0] = new TGColorFrame(this, TColor::Number2Pixel(0), 0);
116  fCe[1] = new TGColorFrame(this, TColor::Number2Pixel(1), 1);
117  fCe[2] = new TGColorFrame(this, TColor::Number2Pixel(2), 2);
118  fCe[3] = new TGColorFrame(this, TColor::Number2Pixel(3), 3);
119  fCe[4] = new TGColorFrame(this, TColor::Number2Pixel(4), 4);
120  fCe[5] = new TGColorFrame(this, TColor::Number2Pixel(5), 5);
121  fCe[6] = new TGColorFrame(this, TColor::Number2Pixel(6), 6);
122  fCe[7] = new TGColorFrame(this, TColor::Number2Pixel(7), 7);
123  fCe[8] = new TGColorFrame(this, TColor::Number2Pixel(8), 8);
124  fCe[9] = new TGColorFrame(this, TColor::Number2Pixel(9), 9);
125  fCe[10] = new TGColorFrame(this, TColor::Number2Pixel(30), 10);
126  fCe[11] = new TGColorFrame(this, TColor::Number2Pixel(38), 11);
127  fCe[12] = new TGColorFrame(this, TColor::Number2Pixel(41), 12);
128  fCe[13] = new TGColorFrame(this, TColor::Number2Pixel(42), 13);
129  fCe[14] = new TGColorFrame(this, TColor::Number2Pixel(50), 14);
130  fCe[15] = new TGColorFrame(this, TColor::Number2Pixel(51), 15);
131 
132  for (Int_t i = 0; i < 16; i++)
134 
135  fMsgWindow = p;
136  fActive = -1;
137 
139 }
140 
141 ////////////////////////////////////////////////////////////////////////////////
142 /// TG16ColorSelector destructor.
143 
145 {
146  Cleanup();
147 }
148 
149 ////////////////////////////////////////////////////////////////////////////////
150 /// Set active color frame.
151 
153 {
154  if (fActive != newat) {
155  if ((fActive >= 0) && (fActive < 16)) {
157  }
158  fActive = newat;
159  if ((fActive >= 0) && (fActive < 16)) {
161  }
162  }
163 }
164 
165 ////////////////////////////////////////////////////////////////////////////////
166 /// Process messages for TG16ColorSelector.
167 
169 {
170  switch (GET_MSG(msg)) {
171  case kC_COLORSEL:
172  switch (GET_SUBMSG(msg)) {
173  case kCOL_SELCHANGED:
174  switch (parm1) {
175  case kButton1:
178  parm1, parm2);
179  break;
180  }
181  break;
182 
183  case kCOL_CLICK:
184  switch (parm1) {
185  case kButton1:
186  SetActive(parm2);
187  break;
188  }
189  break;
190  }
191  }
192 
193  return kTRUE;
194 }
195 
196 ////////////////////////////////////////////////////////////////////////////////
197 /// TGColorPopup constructor.
198 /// The TGColorPopup is a popup containing a TG16ColorSelector and a "More..."
199 /// button which popups up a TGColorDialog allowing custom color selection.
200 
204 {
205  fMsgWindow = m;
206  fCurrentColor = color;
207 
208  SetWindowAttributes_t wattr;
209 
210  wattr.fMask = kWAOverrideRedirect; // | kWASaveUnder ;
211  wattr.fOverrideRedirect = kTRUE;
212  //wattr.fSaveUnder = kTRUE;
213  gVirtualX->ChangeWindowAttributes(fId, &wattr);
214 
216 
217  fActive = -1;
219 
220  TG16ColorSelector *cs = new TG16ColorSelector(this);
221  AddFrame(cs, new TGLayoutHints(kLHintsCenterX, 1, 1, 1, 1));
222  AddFrame(new TGHorizontal3DLine(this),
223  new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 2, 2, 2));
224  TGTextButton *other = new TGTextButton(this, "Other...", 102);
225  other->SetToolTipText("Popups up Color Selector");
226  other->Associate(this);
227  AddFrame(other, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 2, 2, 2, 2));
228 
229  MapSubwindows();
230 
231  Resize(cs->GetDefaultWidth() + 6, cs->GetDefaultHeight() +
232  other->GetDefaultHeight());
234 }
235 
236 ////////////////////////////////////////////////////////////////////////////////
237 /// TGColorPopup destructor.
238 
240 {
241  Cleanup();
242 }
243 
244 ////////////////////////////////////////////////////////////////////////////////
245 /// Ungrab pointer and unmap window.
246 
248 {
249  gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
250  UnmapWindow();
251 }
252 
253 ////////////////////////////////////////////////////////////////////////////////
254 /// Popup TGColorPopup at x,y position
255 
257 {
258  Int_t rx, ry;
259  UInt_t rw, rh;
260 
261  // Parent is root window for the popup:
262  gVirtualX->GetWindowSize(fParent->GetId(), rx, ry, rw, rh);
263 
264  if (x < 0) x = 0;
265  if (x + fWidth > rw) x = rw - fWidth;
266  if (y < 0) y = 0;
267  if (y + fHeight > rh) y = rh - fHeight;
268 
269  MoveResize(x, y, w, h);
270  MapSubwindows();
271  Layout();
272  MapRaised();
273 
277 
279 
280  gClient->WaitForUnmap(this);
281  EndPopup();
282 
283  if (fLaunchDialog) {
284  Int_t retc;
285  ULong_t color = fCurrentColor;
286 
287  new TGColorDialog(gClient->GetDefaultRoot(), this, &retc, &color);
288 
289  if (retc == kMBOk) {
290  fCurrentColor = color;
292  -1, color);
293  }
294  }
295  DeleteWindow();
296 }
297 
298 ////////////////////////////////////////////////////////////////////////////////
299 /// Handle mouse button events for TGColorPopup.
300 
302 {
303  if (event->fX < 0 || event->fX >= (Int_t) fWidth ||
304  event->fY < 0 || event->fY >= (Int_t) fHeight) {
305  if (event->fType == kButtonRelease)
306  UnmapWindow();
307  } else {
308  TGFrame *f = GetFrameFromPoint(event->fX, event->fY);
309  if (f && f != this) {
310  TranslateCoordinates(f, event->fX, event->fY, event->fX, event->fY);
311  f->HandleButton(event);
312  }
313  }
314  return kTRUE;
315 }
316 
317 ////////////////////////////////////////////////////////////////////////////////
318 /// Process messages for TGColorPopup.
319 
321 {
322  switch (GET_MSG(msg)) {
323  case kC_COLORSEL:
324  switch (GET_SUBMSG(msg)) {
325  case kCOL_SELCHANGED:
327  parm1, parm2);
328  UnmapWindow();
329  break;
330 
331  default:
332  break;
333  }
334  break;
335 
336  case kC_COMMAND:
337  switch (GET_SUBMSG(msg)) {
338  case kCM_BUTTON:
339  if (parm1 == 102) {
341  UnmapWindow();
342  }
343  break;
344  }
345  break;
346  }
347  return kTRUE;
348 }
349 
350 ////////////////////////////////////////////////////////////////////////////////
351 /// Emit a signal to see preview.
352 
354 {
355  if (fClient->IsEditable()) return;
356 
357  fCurrentColor = color;
359 }
360 
361 ////////////////////////////////////////////////////////////////////////////////
362 /// Emit a signal to see preview.
363 
365 {
366  if (fClient->IsEditable()) return;
367 
368  TColor *tcolor = (TColor *)color;
369  fCurrentColor = tcolor->GetPixel();
371 }
372 
373 ////////////////////////////////////////////////////////////////////////////////
374 /// TGColorSelect constructor.
375 /// The TGColorSelect widget is like a checkbutton but instead of the check
376 /// mark there is color area with a little down arrow.
377 /// When clicked on the arrow the TGColorPopup pops up.
378 
380  TGCheckButton(p, "", id)
381 {
382  if (!p && fClient->IsEditable() && !color) {
383  color = TColor::Number2Pixel(6); // magenta
384  }
385 
386  fColor = color;
387  fColorPopup = 0;
389 
390  Enable();
393  SetColor(fColor);
394 
396 }
397 
398 ////////////////////////////////////////////////////////////////////////////////
399 /// TGColorSelect destructor.
400 
402 {
403  delete fColorPopup;
404 }
405 
406 ////////////////////////////////////////////////////////////////////////////////
407 /// Process messages for TGColorSelect.
408 
410 {
411  switch (GET_MSG(msg)) {
412  case kC_COLORSEL:
413  switch (GET_SUBMSG(msg)) {
414  case kCOL_SELCHANGED:
415  {
416  if (parm1 == 0) {
417  SetAlphaColor((ULong_t)parm2);
418  parm1 = (Long_t)fWidgetId; // parm1 needs to pass the widget Id
420  parm1, parm2);
421  }
422  else {
423  SetColor(parm2);
424  parm1 = (Long_t)fWidgetId; // parm1 needs to pass the widget Id
426  parm1, parm2);
427  }
428  }
429  break;
430 
431  default:
432  break;
433  }
434  break;
435  }
436  return kTRUE;
437 }
438 
439 ////////////////////////////////////////////////////////////////////////////////
440 /// Handle button events for TGColorSelect.
441 
443 {
444  TGFrame::HandleButton(event);
445  if (!IsEnabled()) return kTRUE;
446 
447  if (event->fCode != kButton1) return kFALSE;
448 
449  if ((event->fType == kButtonPress) && HasFocus())
450  WantFocus();
451 
452  if (event->fType == kButtonPress) {
453  fPressPos.fX = fX;
454  fPressPos.fY = fY;
455 
456  if (fState != kButtonDown) {
457  fPrevState = fState;
459  }
460  } else {
461  if (fState != kButtonUp) {
463 
464  // case when it was dragged during guibuilding
465  if ((fPressPos.fX != fX) || (fPressPos.fY != fY)) {
466  return kFALSE;
467  }
468  Window_t wdummy;
469  Int_t ax, ay;
470 
471  if (!fColorPopup)
472  fColorPopup = new TGColorPopup(gClient->GetDefaultRoot(), this, fColor);
473 
474  gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(),
475  0, fHeight, ax, ay, wdummy);
476 
477 #ifdef R__HAS_COCOA
478  gVirtualX->SetWMTransientHint(fColorPopup->GetId(), GetId());
479 #endif
482  fColorPopup = 0;
483  }
484  }
485  return kTRUE;
486 }
487 
488 ////////////////////////////////////////////////////////////////////////////////
489 /// Set state of widget as enabled.
490 
492 {
493  if (on) {
495  } else {
497  }
498  fClient->NeedRedraw(this);
499 }
500 
501 ////////////////////////////////////////////////////////////////////////////////
502 /// Set state of widget as disabled.
503 
505 {
507  fClient->NeedRedraw(this);
508 }
509 
510 ////////////////////////////////////////////////////////////////////////////////
511 /// Redraw TGColorSelect widget.
512 
514 {
515  Int_t x, y;
516  UInt_t w, h;
517 
519 
520  if (IsEnabled()) {
521 
522  // color rectangle
523 
524  x = fBorderWidth + 2;
525  y = fBorderWidth + 2; // 1;
526  w = 22;
527  h = fHeight - (fBorderWidth * 2) - 4; // -3; // 14
528 
529  if (fState == kButtonDown) { ++x; ++y; }
530 
531 #ifdef R__HAS_COCOA
532  //Adjustment for Quartz 2D is required:
533  //first, I DO not try to fit filled rectangle into outline - this
534  //simply DOES NOT work (with retina/non-retina display, for example.
535  //First - fill rectable, then draw outline.
536  gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 1, h - 1);
537  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x + 1, y + 1, w - 1, h - 1);
538 #else
539  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x, y, w - 1, h - 1);
540  gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 2, h - 2);
541 #endif
542 
543  // separator
544 
545  x = fWidth - 6 - fBorderWidth - 6;
546  y = fBorderWidth + 1;
547  h = fHeight - fBorderWidth - 1; // actually y1
548 
549  if (fState == kButtonDown) { ++x; ++y; }
550 
551  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
552  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
553  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
554 
555  // arrow
556 
557  x = fWidth - 6 - fBorderWidth - 2;
558  y = (fHeight - 4) / 2 + 1;
559 
560  if (fState == kButtonDown) { ++x; ++y; }
561 
562  DrawTriangle(GetBlackGC()(), x, y);
563 
564  } else {
565 
566  // sunken rectangle
567 
568  x = fBorderWidth + 2;
569  y = fBorderWidth + 2; // 1;
570  w = 22;
571  h = fHeight - (fBorderWidth * 2) - 4; // 3;
572 
573  Draw3dRectangle(kSunkenFrame, x, y, w, h);
574 
575  // separator
576 
577  x = fWidth - 6 - fBorderWidth - 6;
578  y = fBorderWidth + 1;
579  h = fHeight - fBorderWidth - 1; // actually y1
580 
581  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
582  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
583  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
584 
585  // sunken arrow
586 
587  x = fWidth - 6 - fBorderWidth - 2;
588  y = (fHeight - 4) / 2 + 1;
589 
590  DrawTriangle(GetHilightGC()(), x + 1, y + 1);
591  DrawTriangle(GetShadowGC()(), x, y);
592  }
593 }
594 
595 ////////////////////////////////////////////////////////////////////////////////
596 /// Draw triangle (arrow) on which user can click to open TGColorPopup.
597 
599 {
600  Point_t points[3];
601 
602 #ifdef R__HAS_COCOA
603  //When it comes to tiny pixel-precise objects like this,
604  //Quartz is not really good: triangle is ugly and wrong.
605  //I have to adjust pixels manually.
606  points[0].fX = x;
607  points[0].fY = y;
608  points[1].fX = x + 6;
609  points[1].fY = y;
610  points[2].fX = x + 3;
611  points[2].fY = y + 3;
612 #else
613  points[0].fX = x;
614  points[0].fY = y;
615  points[1].fX = x + 5;
616  points[1].fY = y;
617  points[2].fX = x + 2;
618  points[2].fY = y + 3;
619 #endif
620 
621  gVirtualX->FillPolygon(fId, gc, points, 3);
622 }
623 
624 ////////////////////////////////////////////////////////////////////////////////
625 /// Set color.
626 
628 {
629  fColor = color;
630  fDrawGC.SetForeground(color);
631  gClient->NeedRedraw(this);
632  if (emit)
633  ColorSelected(fColor); // emit a signal
634 }
635 
636 ////////////////////////////////////////////////////////////////////////////////
637 /// Set color.
638 
640 {
641  if (emit) {
642  AlphaColorSelected(color); //emit opacity signal
643  }
644 }
645 
646 
647 ////////////////////////////////////////////////////////////////////////////////
648 /// Save a color select widget as a C++ statement(s) on output stream out
649 
650 void TGColorSelect::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
651 {
652  char quote = '"';
653  static Int_t nn = 1;
654  TString cvar = TString::Format("ColPar%d",nn);
655 
656  ULong_t color = GetColor();
657  const char *colorname = TColor::PixelAsHexString(color);
658  gClient->GetColorByName(colorname, color);
659 
660  out << std::endl << " // color select widget" << std::endl;
661  out << " ULong_t " << cvar.Data() << ";" << std::endl;
662  out << " gClient->GetColorByName(" << quote << colorname << quote
663  << ", " << cvar.Data() << ");" << std::endl;
664 
665  out <<" TGColorSelect *";
666  out << GetName() << " = new TGColorSelect(" << fParent->GetName()
667  << ", " << cvar.Data() << ", " << WidgetId() << ");" << std::endl;
668  nn++;
669 
670  if (option && strstr(option, "keep_names"))
671  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
672 
673  if (!IsEnabled()) {
674  out << " " << GetName() << "->Disable();" << std::endl;
675  }
676  out << std::endl;
677 }
678 
void SetAlphaColor(ULong_t color, Bool_t emit=kTRUE)
Set color.
void SetActive(Int_t newat)
Set active color frame.
const TGWindow * fParent
Definition: TGWindow.h:37
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
Cursor_t GetGrabCursor() const
void SetActive(Bool_t in)
Definition: TGColorSelect.h:65
auto * m
Definition: textangle.C:8
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:51
Int_t fBorderWidth
Definition: TGFrame.h:140
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:321
void EndPopup()
Ungrab pointer and unmap window.
const char Option_t
Definition: RtypesCore.h:62
virtual Bool_t HandleButton(Event_t *event)
Handle button events in TGColorFrame.
void SetForeground(Pixel_t v)
Set foreground color.
Definition: TGGC.cxx:276
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
Popup TGColorPopup at x,y position.
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:737
TGColorFrame * fCe[16]
Definition: TGColorSelect.h:78
TH1 * h
Definition: legend2.C:5
Int_t WidgetId() const
Definition: TGWidget.h:80
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
Int_t fY
Definition: TGFrame.h:133
Int_t SetFlags(Int_t flags)
Definition: TGWidget.h:70
Pixel_t fPixel
Definition: TGColorSelect.h:49
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:133
virtual void AlphaColorSelected(ULong_t colptr=0)
virtual Bool_t TranslateCoordinates(TGFrame *child, Int_t x, Int_t y, Int_t &fx, Int_t &fy)
Translate coordinates to child frame.
Definition: TGFrame.cxx:1314
Int_t fY
Definition: GuiTypes.h:177
Handle_t GContext_t
Definition: GuiTypes.h:37
Basic string class.
Definition: TString.h:125
#define gClient
Definition: TGClient.h:166
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:982
Int_t fLaunchDialog
Short_t fX
Definition: GuiTypes.h:356
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Pixel_t fCurrentColor
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:373
virtual ~TGColorPopup()
TGColorPopup destructor.
TGColorPopup * fColorPopup
virtual void MapRaised()
Definition: TGFrame.h:252
void Disable()
Set state of widget as disabled.
Int_t fWidgetId
Definition: TGWidget.h:58
Handle_t GetId() const
Definition: TGObject.h:47
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
const TGGC * GetFrameGC() const
virtual void DrawBorder()
Draw TGColorFrame border.
TGPosition fPressPos
Bool_t fActive
Definition: TGColorSelect.h:50
static const char * PixelAsHexString(ULong_t pixel)
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::Ge...
Definition: TColor.cxx:2083
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:412
virtual ~TG16ColorSelector()
TG16ColorSelector destructor.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a color select widget as a C++ statement(s) on output stream out.
Double_t x[n]
Definition: legend1.C:17
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2365
ULong_t Pixel_t
Definition: GuiTypes.h:39
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
TGColorSelect(const TGColorSelect &)
Int_t fX
Definition: TGFrame.h:132
void PreviewColor(Pixel_t color)
Emit a signal to see preview.
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 SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:294
EButtonState fPrevState
Definition: TGButton.h:272
virtual Bool_t HandleButton(Event_t *event)
Handle button events for TGColorSelect.
TG16ColorSelector(const TG16ColorSelector &)
const TGWindow * fMsgWindow
Definition: TGWidget.h:60
const TGWindow * fMsgWindow
point * points
Definition: X3DBuffer.c:20
const Mask_t kButtonPressMask
Definition: GuiTypes.h:160
Bool_t fOverrideRedirect
Definition: GuiTypes.h:106
const TGWindow * fMsgWindow
Definition: TGColorSelect.h:77
virtual TGFrame * GetFrameFromPoint(Int_t x, Int_t y)
Get frame located at specified point.
Definition: TGFrame.cxx:1290
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:371
Bool_t IsEditable() const
Definition: TGClient.h:98
Pixel_t GetColor() const
Int_t ClearFlags(Int_t flags)
Definition: TGWidget.h:71
EGEventType fType
Definition: GuiTypes.h:174
Int_t GET_SUBMSG(Long_t val)
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:221
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition: TColor.cxx:1421
unsigned int UInt_t
Definition: RtypesCore.h:42
const Handle_t kNone
Definition: GuiTypes.h:87
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for TGColorSelect.
Int_t fX
Definition: TGDimension.h:50
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:717
#define gVirtualX
Definition: TVirtualX.h:350
UInt_t fWidth
Definition: TGFrame.h:134
Int_t GET_MSG(Long_t val)
const Bool_t kFALSE
Definition: RtypesCore.h:88
TGColorFrame(const TGColorFrame &)
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1990
long Long_t
Definition: RtypesCore.h:50
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
Bool_t HasFocus() const
Definition: TGWidget.h:82
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1004
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:165
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:161
UInt_t fCode
Definition: GuiTypes.h:179
void PreviewAlphaColor(ULong_t color)
Emit a signal to see preview.
const Mask_t kWAOverrideRedirect
Definition: GuiTypes.h:148
unsigned long ULong_t
Definition: RtypesCore.h:51
Pixel_t fColor
Definition: TGColorSelect.h:52
Double_t y[n]
Definition: legend1.C:17
virtual Bool_t HandleButton(Event_t *)
Definition: TGFrame.h:208
The color creation and management class.
Definition: TColor.h:19
UInt_t fHeight
Definition: TGFrame.h:135
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events for TGColorPopup.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
TGColorPopup(const TGColorPopup &)
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
Bool_t IsEnabled() const
Definition: TGWidget.h:81
Handle_t fId
Definition: TGObject.h:36
Handle_t Window_t
Definition: GuiTypes.h:28
virtual void UnmapWindow()
Definition: TGFrame.h:253
GContext_t fGrayGC
Definition: TGColorSelect.h:51
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for TGColorPopup.
TGClient * fClient
Definition: TGObject.h:37
void DrawTriangle(GContext_t gc, Int_t x, Int_t y)
Draw triangle (arrow) on which user can click to open TGColorPopup.
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for TG16ColorSelector.
virtual void ColorSelected(Pixel_t color=0)
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:370
virtual ~TGColorSelect()
TGColorSelect destructor.
UInt_t fEditDisabled
Definition: TGWindow.h:41
EButtonState fState
Definition: TGButton.h:75
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
void Enable(Bool_t on=kTRUE)
Set state of widget as enabled.
virtual void Draw3dRectangle(UInt_t type, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw 3D rectangle on the frame border.
Definition: TGFrame.cxx:339
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
virtual void DoRedraw()
Redraw TGColorSelect widget.
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:747
Int_t fX
Definition: GuiTypes.h:177
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:757
const TGWindow * fMsgWindow
Definition: TGColorSelect.h:48
Definition: TGMsgBox.h:44
const char * Data() const
Definition: TString.h:345
Bool_t WantFocus() const
Definition: TGWidget.h:83
Short_t fY
Definition: GuiTypes.h:356