Logo ROOT   master
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 "TVirtualX.h"
57 #include "Riostream.h"
58 
63 
64 
65 ////////////////////////////////////////////////////////////////////////////////
66 /// TGColorFrame constructor.
67 /// The TGColorFrame is a small frame with border showing a specific color.
68 
70  TGFrame(p, 20, 20, kOwnBackground, color)
71 {
72  SetBackgroundColor(color);
73 
74  fPixel = fColor = color;
75 
77  fMsgWindow = p;
78  fActive = kFALSE;
79 
80  fGrayGC = GetShadowGC()();
82 }
83 
84 ////////////////////////////////////////////////////////////////////////////////
85 /// Handle button events in TGColorFrame.
86 
88 {
89  if (event->fType == kButtonPress) {
91  } else { // kButtonRelease
93  }
94 
95  return kTRUE;
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// Draw TGColorFrame border.
100 
102 {
103  gVirtualX->DrawRectangle(fId, GetBckgndGC()(), 0, 0, fWidth - 1, fHeight - 1);
105 }
106 
107 ////////////////////////////////////////////////////////////////////////////////
108 /// TG16ColorSelector constructor.
109 /// The TG16ColorSelector is a composite frame with 16 TGColorFrames.
110 
112  TGCompositeFrame(p, 10, 10)
113 {
114  SetLayoutManager(new TGMatrixLayout(this, 4, 4, 1, 1));
115 
116  fCe[0] = new TGColorFrame(this, TColor::Number2Pixel(0), 0);
117  fCe[1] = new TGColorFrame(this, TColor::Number2Pixel(1), 1);
118  fCe[2] = new TGColorFrame(this, TColor::Number2Pixel(2), 2);
119  fCe[3] = new TGColorFrame(this, TColor::Number2Pixel(3), 3);
120  fCe[4] = new TGColorFrame(this, TColor::Number2Pixel(4), 4);
121  fCe[5] = new TGColorFrame(this, TColor::Number2Pixel(5), 5);
122  fCe[6] = new TGColorFrame(this, TColor::Number2Pixel(6), 6);
123  fCe[7] = new TGColorFrame(this, TColor::Number2Pixel(7), 7);
124  fCe[8] = new TGColorFrame(this, TColor::Number2Pixel(8), 8);
125  fCe[9] = new TGColorFrame(this, TColor::Number2Pixel(9), 9);
126  fCe[10] = new TGColorFrame(this, TColor::Number2Pixel(30), 10);
127  fCe[11] = new TGColorFrame(this, TColor::Number2Pixel(38), 11);
128  fCe[12] = new TGColorFrame(this, TColor::Number2Pixel(41), 12);
129  fCe[13] = new TGColorFrame(this, TColor::Number2Pixel(42), 13);
130  fCe[14] = new TGColorFrame(this, TColor::Number2Pixel(50), 14);
131  fCe[15] = new TGColorFrame(this, TColor::Number2Pixel(51), 15);
132 
133  for (Int_t i = 0; i < 16; i++)
135 
136  fMsgWindow = p;
137  fActive = -1;
138 
140 }
141 
142 ////////////////////////////////////////////////////////////////////////////////
143 /// TG16ColorSelector destructor.
144 
146 {
147  Cleanup();
148 }
149 
150 ////////////////////////////////////////////////////////////////////////////////
151 /// Set active color frame.
152 
154 {
155  if (fActive != newat) {
156  if ((fActive >= 0) && (fActive < 16)) {
158  }
159  fActive = newat;
160  if ((fActive >= 0) && (fActive < 16)) {
162  }
163  }
164 }
165 
166 ////////////////////////////////////////////////////////////////////////////////
167 /// Process messages for TG16ColorSelector.
168 
170 {
171  switch (GET_MSG(msg)) {
172  case kC_COLORSEL:
173  switch (GET_SUBMSG(msg)) {
174  case kCOL_SELCHANGED:
175  switch (parm1) {
176  case kButton1:
179  parm1, parm2);
180  break;
181  }
182  break;
183 
184  case kCOL_CLICK:
185  switch (parm1) {
186  case kButton1:
187  SetActive(parm2);
188  break;
189  }
190  break;
191  }
192  }
193 
194  return kTRUE;
195 }
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 /// TGColorPopup constructor.
199 /// The TGColorPopup is a popup containing a TG16ColorSelector and a "More..."
200 /// button which popups up a TGColorDialog allowing custom color selection.
201 
204  GetDefaultFrameBackground())
205 {
206  fMsgWindow = m;
207  fCurrentColor = color;
208 
209  SetWindowAttributes_t wattr;
210 
211  wattr.fMask = kWAOverrideRedirect; // | kWASaveUnder ;
212  wattr.fOverrideRedirect = kTRUE;
213  //wattr.fSaveUnder = kTRUE;
214  gVirtualX->ChangeWindowAttributes(fId, &wattr);
215 
217 
218  fActive = -1;
220 
221  TG16ColorSelector *cs = new TG16ColorSelector(this);
222  AddFrame(cs, new TGLayoutHints(kLHintsCenterX, 1, 1, 1, 1));
223  AddFrame(new TGHorizontal3DLine(this),
224  new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 2, 2, 2));
225  TGTextButton *other = new TGTextButton(this, "Other...", 102);
226  other->SetToolTipText("Popups up Color Selector");
227  other->Associate(this);
228  AddFrame(other, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 2, 2, 2, 2));
229 
230  MapSubwindows();
231 
232  Resize(cs->GetDefaultWidth() + 6, cs->GetDefaultHeight() +
233  other->GetDefaultHeight());
235 }
236 
237 ////////////////////////////////////////////////////////////////////////////////
238 /// TGColorPopup destructor.
239 
241 {
242  Cleanup();
243 }
244 
245 ////////////////////////////////////////////////////////////////////////////////
246 /// Ungrab pointer and unmap window.
247 
249 {
250  gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
251  UnmapWindow();
252 }
253 
254 ////////////////////////////////////////////////////////////////////////////////
255 /// Popup TGColorPopup at x,y position
256 
258 {
259  Int_t rx, ry;
260  UInt_t rw, rh;
261 
262  // Parent is root window for the popup:
263  gVirtualX->GetWindowSize(fParent->GetId(), rx, ry, rw, rh);
264 
265  if (gVirtualX->InheritsFrom("TGWin32")) {
266  if ((x > 0) && ((x + abs(rx) + (Int_t)fWidth) > (Int_t)rw))
267  x = rw - abs(rx) - fWidth;
268  if ((y > 0) && (y + abs(ry) + (Int_t)fHeight > (Int_t)rh))
269  y = rh - fHeight;
270  } else {
271  if (x < 0) x = 0;
272  if (x + fWidth > rw) x = rw - fWidth;
273  if (y < 0) y = 0;
274  if (y + fHeight > rh) y = rh - fHeight;
275  }
276 
277  MoveResize(x, y, w, h);
278  MapSubwindows();
279  Layout();
280  MapRaised();
281 
285 
287 
288  gClient->WaitForUnmap(this);
289  EndPopup();
290 
291  if (fLaunchDialog) {
292  Int_t retc;
293  ULong_t color = fCurrentColor;
294 
295  new TGColorDialog(gClient->GetDefaultRoot(), this, &retc, &color);
296 
297  if (retc == kMBOk) {
298  fCurrentColor = color;
300  -1, color);
301  }
302  }
303  DeleteWindow();
304 }
305 
306 ////////////////////////////////////////////////////////////////////////////////
307 /// Handle mouse button events for TGColorPopup.
308 
310 {
311  if (event->fX < 0 || event->fX >= (Int_t) fWidth ||
312  event->fY < 0 || event->fY >= (Int_t) fHeight) {
313  if (event->fType == kButtonRelease)
314  UnmapWindow();
315  } else {
316  TGFrame *f = GetFrameFromPoint(event->fX, event->fY);
317  if (f && f != this) {
318  TranslateCoordinates(f, event->fX, event->fY, event->fX, event->fY);
319  f->HandleButton(event);
320  }
321  }
322  return kTRUE;
323 }
324 
325 ////////////////////////////////////////////////////////////////////////////////
326 /// Process messages for TGColorPopup.
327 
329 {
330  switch (GET_MSG(msg)) {
331  case kC_COLORSEL:
332  switch (GET_SUBMSG(msg)) {
333  case kCOL_SELCHANGED:
335  parm1, parm2);
336  UnmapWindow();
337  break;
338 
339  default:
340  break;
341  }
342  break;
343 
344  case kC_COMMAND:
345  switch (GET_SUBMSG(msg)) {
346  case kCM_BUTTON:
347  if (parm1 == 102) {
349  UnmapWindow();
350  }
351  break;
352  }
353  break;
354  }
355  return kTRUE;
356 }
357 
358 ////////////////////////////////////////////////////////////////////////////////
359 /// Emit a signal to see preview.
360 
362 {
363  if (fClient->IsEditable()) return;
364 
365  fCurrentColor = color;
367 }
368 
369 ////////////////////////////////////////////////////////////////////////////////
370 /// Emit a signal to see preview.
371 
373 {
374  if (fClient->IsEditable()) return;
375 
376  TColor *tcolor = (TColor *)color;
377  fCurrentColor = tcolor->GetPixel();
379 }
380 
381 ////////////////////////////////////////////////////////////////////////////////
382 /// TGColorSelect constructor.
383 /// The TGColorSelect widget is like a checkbutton but instead of the check
384 /// mark there is color area with a little down arrow.
385 /// When clicked on the arrow the TGColorPopup pops up.
386 
388  TGCheckButton(p, "", id)
389 {
390  if (!p && fClient->IsEditable() && !color) {
391  color = TColor::Number2Pixel(6); // magenta
392  }
393 
394  fColor = color;
395  fColorPopup = 0;
397 
398  Enable();
401  SetColor(fColor);
402 
404 }
405 
406 ////////////////////////////////////////////////////////////////////////////////
407 /// TGColorSelect destructor.
408 
410 {
411  delete fColorPopup;
412 }
413 
414 ////////////////////////////////////////////////////////////////////////////////
415 /// Process messages for TGColorSelect.
416 
418 {
419  switch (GET_MSG(msg)) {
420  case kC_COLORSEL:
421  switch (GET_SUBMSG(msg)) {
422  case kCOL_SELCHANGED:
423  {
424  if (parm1 == 0) {
425  SetAlphaColor((ULong_t)parm2);
426  parm1 = (Long_t)fWidgetId; // parm1 needs to pass the widget Id
428  parm1, parm2);
429  }
430  else {
431  SetColor(parm2);
432  parm1 = (Long_t)fWidgetId; // parm1 needs to pass the widget Id
434  parm1, parm2);
435  }
436  }
437  break;
438 
439  default:
440  break;
441  }
442  break;
443  }
444  return kTRUE;
445 }
446 
447 ////////////////////////////////////////////////////////////////////////////////
448 /// Handle button events for TGColorSelect.
449 
451 {
452  TGFrame::HandleButton(event);
453  if (!IsEnabled()) return kTRUE;
454 
455  if (event->fCode != kButton1) return kFALSE;
456 
457  if ((event->fType == kButtonPress) && HasFocus())
458  WantFocus();
459 
460  if (event->fType == kButtonPress) {
461  fPressPos.fX = fX;
462  fPressPos.fY = fY;
463 
464  if (fState != kButtonDown) {
465  fPrevState = fState;
467  }
468  } else {
469  if (fState != kButtonUp) {
471 
472  // case when it was dragged during guibuilding
473  if ((fPressPos.fX != fX) || (fPressPos.fY != fY)) {
474  return kFALSE;
475  }
476  Window_t wdummy;
477  Int_t ax, ay;
478 
479  if (!fColorPopup)
480  fColorPopup = new TGColorPopup(gClient->GetDefaultRoot(), this, fColor);
481 
482  gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(),
483  0, fHeight, ax, ay, wdummy);
484 
485 #ifdef R__HAS_COCOA
486  gVirtualX->SetWMTransientHint(fColorPopup->GetId(), GetId());
487 #endif
490  fColorPopup = 0;
491  }
492  }
493  return kTRUE;
494 }
495 
496 ////////////////////////////////////////////////////////////////////////////////
497 /// Set state of widget as enabled.
498 
500 {
501  if (on) {
503  } else {
505  }
506  fClient->NeedRedraw(this);
507 }
508 
509 ////////////////////////////////////////////////////////////////////////////////
510 /// Set state of widget as disabled.
511 
513 {
515  fClient->NeedRedraw(this);
516 }
517 
518 ////////////////////////////////////////////////////////////////////////////////
519 /// Redraw TGColorSelect widget.
520 
522 {
523  Int_t x, y;
524  UInt_t w, h;
525 
527 
528  if (IsEnabled()) {
529 
530  // color rectangle
531 
532  x = fBorderWidth + 2;
533  y = fBorderWidth + 2; // 1;
534  w = 22;
535  h = fHeight - (fBorderWidth * 2) - 4; // -3; // 14
536 
537  if (fState == kButtonDown) { ++x; ++y; }
538 
539 #ifdef R__HAS_COCOA
540  //Adjustment for Quartz 2D is required:
541  //first, I DO not try to fit filled rectangle into outline - this
542  //simply DOES NOT work (with retina/non-retina display, for example.
543  //First - fill rectable, then draw outline.
544  gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 1, h - 1);
545  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x + 1, y + 1, w - 1, h - 1);
546 #else
547  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x, y, w - 1, h - 1);
548  gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 2, h - 2);
549 #endif
550 
551  // separator
552 
553  x = fWidth - 6 - fBorderWidth - 6;
554  y = fBorderWidth + 1;
555  h = fHeight - fBorderWidth - 1; // actually y1
556 
557  if (fState == kButtonDown) { ++x; ++y; }
558 
559  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
560  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
561  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
562 
563  // arrow
564 
565  x = fWidth - 6 - fBorderWidth - 2;
566  y = (fHeight - 4) / 2 + 1;
567 
568  if (fState == kButtonDown) { ++x; ++y; }
569 
570  DrawTriangle(GetBlackGC()(), x, y);
571 
572  } else {
573 
574  // sunken rectangle
575 
576  x = fBorderWidth + 2;
577  y = fBorderWidth + 2; // 1;
578  w = 22;
579  h = fHeight - (fBorderWidth * 2) - 4; // 3;
580 
582 
583  // separator
584 
585  x = fWidth - 6 - fBorderWidth - 6;
586  y = fBorderWidth + 1;
587  h = fHeight - fBorderWidth - 1; // actually y1
588 
589  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
590  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
591  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
592 
593  // sunken arrow
594 
595  x = fWidth - 6 - fBorderWidth - 2;
596  y = (fHeight - 4) / 2 + 1;
597 
598  DrawTriangle(GetHilightGC()(), x + 1, y + 1);
599  DrawTriangle(GetShadowGC()(), x, y);
600  }
601 }
602 
603 ////////////////////////////////////////////////////////////////////////////////
604 /// Draw triangle (arrow) on which user can click to open TGColorPopup.
605 
607 {
608  Point_t points[3];
609 
610 #ifdef R__HAS_COCOA
611  //When it comes to tiny pixel-precise objects like this,
612  //Quartz is not really good: triangle is ugly and wrong.
613  //I have to adjust pixels manually.
614  points[0].fX = x;
615  points[0].fY = y;
616  points[1].fX = x + 6;
617  points[1].fY = y;
618  points[2].fX = x + 3;
619  points[2].fY = y + 3;
620 #else
621  points[0].fX = x;
622  points[0].fY = y;
623  points[1].fX = x + 5;
624  points[1].fY = y;
625  points[2].fX = x + 2;
626  points[2].fY = y + 3;
627 #endif
628 
629  gVirtualX->FillPolygon(fId, gc, points, 3);
630 }
631 
632 ////////////////////////////////////////////////////////////////////////////////
633 /// Set color.
634 
636 {
637  fColor = color;
638  fDrawGC.SetForeground(color);
639  gClient->NeedRedraw(this);
640  if (emit)
641  ColorSelected(fColor); // emit a signal
642 }
643 
644 ////////////////////////////////////////////////////////////////////////////////
645 /// Set color.
646 
648 {
649  if (emit) {
650  AlphaColorSelected(color); //emit opacity signal
651  }
652 }
653 
654 
655 ////////////////////////////////////////////////////////////////////////////////
656 /// Save a color select widget as a C++ statement(s) on output stream out
657 
658 void TGColorSelect::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
659 {
660  char quote = '"';
661  static Int_t nn = 1;
662  TString cvar = TString::Format("ColPar%d",nn);
663 
664  ULong_t color = GetColor();
665  const char *colorname = TColor::PixelAsHexString(color);
666  gClient->GetColorByName(colorname, color);
667 
668  out << std::endl << " // color select widget" << std::endl;
669  out << " ULong_t " << cvar.Data() << ";" << std::endl;
670  out << " gClient->GetColorByName(" << quote << colorname << quote
671  << ", " << cvar.Data() << ");" << std::endl;
672 
673  out <<" TGColorSelect *";
674  out << GetName() << " = new TGColorSelect(" << fParent->GetName()
675  << ", " << cvar.Data() << ", " << WidgetId() << ");" << std::endl;
676  nn++;
677 
678  if (option && strstr(option, "keep_names"))
679  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
680 
681  if (!IsEnabled()) {
682  out << " " << GetName() << "->Disable();" << std::endl;
683  }
684  out << std::endl;
685 }
686 
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:36
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:588
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:612
Int_t fY
Definition: TGDimension.h:48
Int_t fBorderWidth
Definition: TGFrame.h:118
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:322
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:738
TGColorFrame * fCe[16]
Definition: TGColorSelect.h:78
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:111
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:1315
Int_t fY
Definition: GuiTypes.h:177
Handle_t GContext_t
Definition: GuiTypes.h:37
Basic string class.
Definition: TString.h:131
#define gClient
Definition: TGClient.h:166
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:983
Int_t fLaunchDialog
#define f(i)
Definition: RSha256.hxx:104
int Int_t
Definition: RtypesCore.h:41
Pixel_t fCurrentColor
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:351
virtual ~TGColorPopup()
TGColorPopup destructor.
TGColorPopup * fColorPopup
virtual void MapRaised()
map raised
Definition: TGFrame.h:230
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:1240
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:2096
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:413
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:2311
ULong_t Pixel_t
Definition: GuiTypes.h:39
TGColorSelect(const TGColorSelect &)
Int_t fX
Definition: TGFrame.h:110
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:628
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:295
XFontStruct * id
Definition: TGX11.cxx:108
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:22
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:1291
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:349
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:318
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition: TColor.cxx:1434
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:47
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:718
#define gVirtualX
Definition: TVirtualX.h:338
#define h(i)
Definition: RSha256.hxx:106
UInt_t fWidth
Definition: TGFrame.h:112
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:2003
long Long_t
Definition: RtypesCore.h:50
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:216
Bool_t HasFocus() const
Definition: TGWidget.h:82
#define ClassImp(name)
Definition: Rtypes.h:365
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1005
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:186
The color creation and management class.
Definition: TColor.h:19
UInt_t fHeight
Definition: TGFrame.h:113
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:1100
TGColorPopup(const TGColorPopup &)
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1147
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()
unmap window
Definition: TGFrame.h:231
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:372
virtual ~TGColorSelect()
TGColorSelect destructor.
UInt_t fEditDisabled
Definition: TGWindow.h:40
EButtonState fState
Definition: TGButton.h:75
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1202
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:340
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:950
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:259
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:397
virtual void DoRedraw()
Redraw TGColorSelect widget.
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:748
Int_t fX
Definition: GuiTypes.h:177
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:758
const TGWindow * fMsgWindow
Definition: TGColorSelect.h:48
Definition: TGMsgBox.h:44
const char * Data() const
Definition: TString.h:364
Bool_t WantFocus() const
Definition: TGWidget.h:83