Logo ROOT  
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 /** \class TGColorFrame
25  \ingroup guiwidgets
26 
27 A small frame with border showing a specific color.
28 
29 */
30 
31 
32 /** \class TG16ColorSelector
33  \ingroup guiwidgets
34 
35 A composite frame with 16 TGColorFrames.
36 
37 */
38 
39 
40 /** \class TGColorPopup
41  \ingroup guiwidgets
42 
43 A popup containing a TG16ColorSelector and a "More..." button which popups up a
44 TGColorDialog allowing custom color selection.
45 
46 */
47 
48 
49 /** \class TGColorSelect
50 \ingroup guiwidgets
51 
52 Like a checkbutton but instead of the check mark there is color area with a little down
53 arrow. When clicked on the arrow the TGColorPopup pops up.
54 
55 Selecting a color in this widget will generate the event:
56  - kC_COLORSEL, kCOL_SELCHANGED, widget id, pixel.
57 
58 and the signal:
59 
60  - ColorSelected(Pixel_t color)
61 
62 */
63 
64 
65 #include "TGClient.h"
66 #include "TGMsgBox.h" // for kMBOk
67 #include "TGGC.h"
68 #include "TGColorSelect.h"
69 #include "TGColorDialog.h"
70 #include "TGResourcePool.h"
71 #include "RConfigure.h"
72 #include "TG3DLine.h"
73 #include "TColor.h"
74 #include "TVirtualX.h"
75 
76 #include <iostream>
77 
82 
83 
84 ////////////////////////////////////////////////////////////////////////////////
85 /// TGColorFrame constructor.
86 /// The TGColorFrame is a small frame with border showing a specific color.
87 
89  TGFrame(p, 20, 20, kOwnBackground, color)
90 {
91  SetBackgroundColor(color);
92 
93  fPixel = fColor = color;
94 
96  fMsgWindow = p;
97  fActive = kFALSE;
98 
99  fGrayGC = GetShadowGC()();
101 }
102 
103 ////////////////////////////////////////////////////////////////////////////////
104 /// Handle button events in TGColorFrame.
105 
107 {
108  if (event->fType == kButtonPress) {
110  } else { // kButtonRelease
112  }
113 
114  return kTRUE;
115 }
116 
117 ////////////////////////////////////////////////////////////////////////////////
118 /// Draw TGColorFrame border.
119 
121 {
122  gVirtualX->DrawRectangle(fId, GetBckgndGC()(), 0, 0, fWidth - 1, fHeight - 1);
124 }
125 
126 ////////////////////////////////////////////////////////////////////////////////
127 /// TG16ColorSelector constructor.
128 /// The TG16ColorSelector is a composite frame with 16 TGColorFrames.
129 
131  TGCompositeFrame(p, 10, 10)
132 {
133  SetLayoutManager(new TGMatrixLayout(this, 4, 4, 1, 1));
134 
135  fCe[0] = new TGColorFrame(this, TColor::Number2Pixel(0), 0);
136  fCe[1] = new TGColorFrame(this, TColor::Number2Pixel(1), 1);
137  fCe[2] = new TGColorFrame(this, TColor::Number2Pixel(2), 2);
138  fCe[3] = new TGColorFrame(this, TColor::Number2Pixel(3), 3);
139  fCe[4] = new TGColorFrame(this, TColor::Number2Pixel(4), 4);
140  fCe[5] = new TGColorFrame(this, TColor::Number2Pixel(5), 5);
141  fCe[6] = new TGColorFrame(this, TColor::Number2Pixel(6), 6);
142  fCe[7] = new TGColorFrame(this, TColor::Number2Pixel(7), 7);
143  fCe[8] = new TGColorFrame(this, TColor::Number2Pixel(8), 8);
144  fCe[9] = new TGColorFrame(this, TColor::Number2Pixel(9), 9);
145  fCe[10] = new TGColorFrame(this, TColor::Number2Pixel(30), 10);
146  fCe[11] = new TGColorFrame(this, TColor::Number2Pixel(38), 11);
147  fCe[12] = new TGColorFrame(this, TColor::Number2Pixel(41), 12);
148  fCe[13] = new TGColorFrame(this, TColor::Number2Pixel(42), 13);
149  fCe[14] = new TGColorFrame(this, TColor::Number2Pixel(50), 14);
150  fCe[15] = new TGColorFrame(this, TColor::Number2Pixel(51), 15);
151 
152  for (Int_t i = 0; i < 16; i++)
154 
155  fMsgWindow = p;
156  fActive = -1;
157 
159 }
160 
161 ////////////////////////////////////////////////////////////////////////////////
162 /// TG16ColorSelector destructor.
163 
165 {
166  Cleanup();
167 }
168 
169 ////////////////////////////////////////////////////////////////////////////////
170 /// Set active color frame.
171 
173 {
174  if (fActive != newat) {
175  if ((fActive >= 0) && (fActive < 16)) {
177  }
178  fActive = newat;
179  if ((fActive >= 0) && (fActive < 16)) {
181  }
182  }
183 }
184 
185 ////////////////////////////////////////////////////////////////////////////////
186 /// Process messages for TG16ColorSelector.
187 
189 {
190  switch (GET_MSG(msg)) {
191  case kC_COLORSEL:
192  switch (GET_SUBMSG(msg)) {
193  case kCOL_SELCHANGED:
194  switch (parm1) {
195  case kButton1:
198  parm1, parm2);
199  break;
200  }
201  break;
202 
203  case kCOL_CLICK:
204  switch (parm1) {
205  case kButton1:
206  SetActive(parm2);
207  break;
208  }
209  break;
210  }
211  }
212 
213  return kTRUE;
214 }
215 
216 ////////////////////////////////////////////////////////////////////////////////
217 /// TGColorPopup constructor.
218 /// The TGColorPopup is a popup containing a TG16ColorSelector and a "More..."
219 /// button which popups up a TGColorDialog allowing custom color selection.
220 
223  GetDefaultFrameBackground())
224 {
225  fMsgWindow = m;
226  fCurrentColor = color;
227 
228  SetWindowAttributes_t wattr;
229 
230  wattr.fMask = kWAOverrideRedirect; // | kWASaveUnder ;
231  wattr.fOverrideRedirect = kTRUE;
232  //wattr.fSaveUnder = kTRUE;
233  gVirtualX->ChangeWindowAttributes(fId, &wattr);
234 
236 
237  fActive = -1;
239 
240  TG16ColorSelector *cs = new TG16ColorSelector(this);
241  AddFrame(cs, new TGLayoutHints(kLHintsCenterX, 1, 1, 1, 1));
242  AddFrame(new TGHorizontal3DLine(this),
243  new TGLayoutHints(kLHintsExpandX | kLHintsCenterY, 2, 2, 2, 2));
244  TGTextButton *other = new TGTextButton(this, "Other...", 102);
245  other->SetToolTipText("Popups up Color Selector");
246  other->Associate(this);
247  AddFrame(other, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 2, 2, 2, 2));
248 
249  MapSubwindows();
250 
251  Resize(cs->GetDefaultWidth() + 6, cs->GetDefaultHeight() +
252  other->GetDefaultHeight());
254 }
255 
256 ////////////////////////////////////////////////////////////////////////////////
257 /// TGColorPopup destructor.
258 
260 {
261  Cleanup();
262 }
263 
264 ////////////////////////////////////////////////////////////////////////////////
265 /// Ungrab pointer and unmap window.
266 
268 {
269  gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE); // ungrab pointer
270  UnmapWindow();
271 }
272 
273 ////////////////////////////////////////////////////////////////////////////////
274 /// Popup TGColorPopup at x,y position
275 
277 {
278  Int_t rx, ry;
279  UInt_t rw, rh;
280 
281  // Parent is root window for the popup:
282  gVirtualX->GetWindowSize(fParent->GetId(), rx, ry, rw, rh);
283 
284  if (gVirtualX->InheritsFrom("TGWin32")) {
285  if ((x > 0) && ((x + abs(rx) + (Int_t)fWidth) > (Int_t)rw))
286  x = rw - abs(rx) - fWidth;
287  if ((y > 0) && (y + abs(ry) + (Int_t)fHeight > (Int_t)rh))
288  y = rh - fHeight;
289  } else {
290  if (x < 0) x = 0;
291  if (x + fWidth > rw) x = rw - fWidth;
292  if (y < 0) y = 0;
293  if (y + fHeight > rh) y = rh - fHeight;
294  }
295 
296  MoveResize(x, y, w, h);
297  MapSubwindows();
298  Layout();
299  MapRaised();
300 
304 
306 
307  gClient->WaitForUnmap(this);
308  EndPopup();
309 
310  if (fLaunchDialog) {
311  Int_t retc;
312  ULong_t color = fCurrentColor;
313 
314  new TGColorDialog(gClient->GetDefaultRoot(), this, &retc, &color);
315 
316  if (retc == kMBOk) {
317  fCurrentColor = color;
319  -1, color);
320  }
321  }
322  DeleteWindow();
323 }
324 
325 ////////////////////////////////////////////////////////////////////////////////
326 /// Handle mouse button events for TGColorPopup.
327 
329 {
330  if (event->fX < 0 || event->fX >= (Int_t) fWidth ||
331  event->fY < 0 || event->fY >= (Int_t) fHeight) {
332  if (event->fType == kButtonRelease)
333  UnmapWindow();
334  } else {
335  TGFrame *f = GetFrameFromPoint(event->fX, event->fY);
336  if (f && f != this) {
337  TranslateCoordinates(f, event->fX, event->fY, event->fX, event->fY);
338  f->HandleButton(event);
339  }
340  }
341  return kTRUE;
342 }
343 
344 ////////////////////////////////////////////////////////////////////////////////
345 /// Process messages for TGColorPopup.
346 
348 {
349  switch (GET_MSG(msg)) {
350  case kC_COLORSEL:
351  switch (GET_SUBMSG(msg)) {
352  case kCOL_SELCHANGED:
354  parm1, parm2);
355  UnmapWindow();
356  break;
357 
358  default:
359  break;
360  }
361  break;
362 
363  case kC_COMMAND:
364  switch (GET_SUBMSG(msg)) {
365  case kCM_BUTTON:
366  if (parm1 == 102) {
368  UnmapWindow();
369  }
370  break;
371  }
372  break;
373  }
374  return kTRUE;
375 }
376 
377 ////////////////////////////////////////////////////////////////////////////////
378 /// Emit a signal to see preview.
379 
381 {
382  if (fClient->IsEditable()) return;
383 
384  fCurrentColor = color;
386 }
387 
388 ////////////////////////////////////////////////////////////////////////////////
389 /// Emit a signal to see preview.
390 
392 {
393  if (fClient->IsEditable()) return;
394 
395  TColor *tcolor = (TColor *)color;
396  fCurrentColor = tcolor->GetPixel();
398 }
399 
400 ////////////////////////////////////////////////////////////////////////////////
401 /// TGColorSelect constructor.
402 /// The TGColorSelect widget is like a checkbutton but instead of the check
403 /// mark there is color area with a little down arrow.
404 /// When clicked on the arrow the TGColorPopup pops up.
405 
407  TGCheckButton(p, "", id)
408 {
409  if (!p && fClient->IsEditable() && !color) {
410  color = TColor::Number2Pixel(6); // magenta
411  }
412 
413  fColor = color;
414  fColorPopup = 0;
416 
417  Enable();
420  SetColor(fColor);
421 
423 }
424 
425 ////////////////////////////////////////////////////////////////////////////////
426 /// TGColorSelect destructor.
427 
429 {
430  delete fColorPopup;
431 }
432 
433 ////////////////////////////////////////////////////////////////////////////////
434 /// Process messages for TGColorSelect.
435 
437 {
438  switch (GET_MSG(msg)) {
439  case kC_COLORSEL:
440  switch (GET_SUBMSG(msg)) {
441  case kCOL_SELCHANGED:
442  {
443  if (parm1 == 0) {
444  SetAlphaColor((ULong_t)parm2);
445  parm1 = (Long_t)fWidgetId; // parm1 needs to pass the widget Id
447  parm1, parm2);
448  }
449  else {
450  SetColor(parm2);
451  parm1 = (Long_t)fWidgetId; // parm1 needs to pass the widget Id
453  parm1, parm2);
454  }
455  }
456  break;
457 
458  default:
459  break;
460  }
461  break;
462  }
463  return kTRUE;
464 }
465 
466 ////////////////////////////////////////////////////////////////////////////////
467 /// Handle button events for TGColorSelect.
468 
470 {
471  TGFrame::HandleButton(event);
472  if (!IsEnabled()) return kTRUE;
473 
474  if (event->fCode != kButton1) return kFALSE;
475 
476  if ((event->fType == kButtonPress) && HasFocus())
477  WantFocus();
478 
479  if (event->fType == kButtonPress) {
480  fPressPos.fX = fX;
481  fPressPos.fY = fY;
482 
483  if (fState != kButtonDown) {
484  fPrevState = fState;
486  }
487  } else {
488  if (fState != kButtonUp) {
490 
491  // case when it was dragged during guibuilding
492  if ((fPressPos.fX != fX) || (fPressPos.fY != fY)) {
493  return kFALSE;
494  }
495  Window_t wdummy;
496  Int_t ax, ay;
497 
498  if (!fColorPopup)
499  fColorPopup = new TGColorPopup(gClient->GetDefaultRoot(), this, fColor);
500 
501  gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(),
502  0, fHeight, ax, ay, wdummy);
503 
504 #ifdef R__HAS_COCOA
505  gVirtualX->SetWMTransientHint(fColorPopup->GetId(), GetId());
506 #endif
509  fColorPopup = 0;
510  }
511  }
512  return kTRUE;
513 }
514 
515 ////////////////////////////////////////////////////////////////////////////////
516 /// Set state of widget as enabled.
517 
519 {
520  if (on) {
522  } else {
524  }
525  fClient->NeedRedraw(this);
526 }
527 
528 ////////////////////////////////////////////////////////////////////////////////
529 /// Set state of widget as disabled.
530 
532 {
534  fClient->NeedRedraw(this);
535 }
536 
537 ////////////////////////////////////////////////////////////////////////////////
538 /// Redraw TGColorSelect widget.
539 
541 {
542  Int_t x, y;
543  UInt_t w, h;
544 
546 
547  if (IsEnabled()) {
548 
549  // color rectangle
550 
551  x = fBorderWidth + 2;
552  y = fBorderWidth + 2; // 1;
553  w = 22;
554  h = fHeight - (fBorderWidth * 2) - 4; // -3; // 14
555 
556  if (fState == kButtonDown) { ++x; ++y; }
557 
558 #ifdef R__HAS_COCOA
559  //Adjustment for Quartz 2D is required:
560  //first, I DO not try to fit filled rectangle into outline - this
561  //simply DOES NOT work (with retina/non-retina display, for example.
562  //First - fill rectangle, then draw outline.
563  gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 1, h - 1);
564  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x + 1, y + 1, w - 1, h - 1);
565 #else
566  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x, y, w - 1, h - 1);
567  gVirtualX->FillRectangle(fId, fDrawGC(), x + 1, y + 1, w - 2, h - 2);
568 #endif
569 
570  // separator
571 
572  x = fWidth - 6 - fBorderWidth - 6;
573  y = fBorderWidth + 1;
574  h = fHeight - fBorderWidth - 1; // actually y1
575 
576  if (fState == kButtonDown) { ++x; ++y; }
577 
578  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
579  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
580  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
581 
582  // arrow
583 
584  x = fWidth - 6 - fBorderWidth - 2;
585  y = (fHeight - 4) / 2 + 1;
586 
587  if (fState == kButtonDown) { ++x; ++y; }
588 
589  DrawTriangle(GetBlackGC()(), x, y);
590 
591  } else {
592 
593  // sunken rectangle
594 
595  x = fBorderWidth + 2;
596  y = fBorderWidth + 2; // 1;
597  w = 22;
598  h = fHeight - (fBorderWidth * 2) - 4; // 3;
599 
601 
602  // separator
603 
604  x = fWidth - 6 - fBorderWidth - 6;
605  y = fBorderWidth + 1;
606  h = fHeight - fBorderWidth - 1; // actually y1
607 
608  gVirtualX->DrawLine(fId, GetShadowGC()(), x, y, x, h - 2);
609  gVirtualX->DrawLine(fId, GetHilightGC()(), x + 1, y, x + 1, h - 1);
610  gVirtualX->DrawLine(fId, GetHilightGC()(), x, h - 1, x + 1, h - 1);
611 
612  // sunken arrow
613 
614  x = fWidth - 6 - fBorderWidth - 2;
615  y = (fHeight - 4) / 2 + 1;
616 
617  DrawTriangle(GetHilightGC()(), x + 1, y + 1);
618  DrawTriangle(GetShadowGC()(), x, y);
619  }
620 }
621 
622 ////////////////////////////////////////////////////////////////////////////////
623 /// Draw triangle (arrow) on which user can click to open TGColorPopup.
624 
626 {
627  Point_t points[3];
628 
629 #ifdef R__HAS_COCOA
630  //When it comes to tiny pixel-precise objects like this,
631  //Quartz is not really good: triangle is ugly and wrong.
632  //I have to adjust pixels manually.
633  points[0].fX = x;
634  points[0].fY = y;
635  points[1].fX = x + 6;
636  points[1].fY = y;
637  points[2].fX = x + 3;
638  points[2].fY = y + 3;
639 #else
640  points[0].fX = x;
641  points[0].fY = y;
642  points[1].fX = x + 5;
643  points[1].fY = y;
644  points[2].fX = x + 2;
645  points[2].fY = y + 3;
646 #endif
647 
648  gVirtualX->FillPolygon(fId, gc, points, 3);
649 }
650 
651 ////////////////////////////////////////////////////////////////////////////////
652 /// Set color.
653 
655 {
656  fColor = color;
657  fDrawGC.SetForeground(color);
658  gClient->NeedRedraw(this);
659  if (emit)
660  ColorSelected(fColor); // emit a signal
661 }
662 
663 ////////////////////////////////////////////////////////////////////////////////
664 /// Set color.
665 
667 {
668  if (emit) {
669  AlphaColorSelected(color); //emit opacity signal
670  }
671 }
672 
673 
674 ////////////////////////////////////////////////////////////////////////////////
675 /// Save a color select widget as a C++ statement(s) on output stream out
676 
677 void TGColorSelect::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
678 {
679  char quote = '"';
680  static Int_t nn = 1;
681  TString cvar = TString::Format("ColPar%d",nn);
682 
683  ULong_t color = GetColor();
684  const char *colorname = TColor::PixelAsHexString(color);
685  gClient->GetColorByName(colorname, color);
686 
687  out << std::endl << " // color select widget" << std::endl;
688  out << " ULong_t " << cvar.Data() << ";" << std::endl;
689  out << " gClient->GetColorByName(" << quote << colorname << quote
690  << ", " << cvar.Data() << ");" << std::endl;
691 
692  out <<" TGColorSelect *";
693  out << GetName() << " = new TGColorSelect(" << fParent->GetName()
694  << ", " << cvar.Data() << ", " << WidgetId() << ");" << std::endl;
695  nn++;
696 
697  if (option && strstr(option, "keep_names"))
698  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
699 
700  if (!IsEnabled()) {
701  out << " " << GetName() << "->Disable();" << std::endl;
702  }
703  out << std::endl;
704 }
705 
TGButton::SetToolTipText
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:445
TGColorSelect::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a color select widget as a C++ statement(s) on output stream out.
Definition: TGColorSelect.cxx:677
Event_t::fType
EGEventType fType
of event (see EGEventType)
Definition: GuiTypes.h:175
m
auto * m
Definition: textangle.C:8
GET_MSG
Int_t GET_MSG(Long_t val)
Definition: WidgetMessageTypes.h:110
TGFrame::fY
Int_t fY
frame y position
Definition: TGFrame.h:86
TGColorPopup::~TGColorPopup
virtual ~TGColorPopup()
TGColorPopup destructor.
Definition: TGColorSelect.cxx:259
Event_t::fY
Int_t fY
pointer x, y coordinates in event window
Definition: GuiTypes.h:178
Event_t::fX
Int_t fX
Definition: GuiTypes.h:178
TGColorFrame
A small frame with border showing a specific color.
Definition: TGColorSelect.h:22
TGFrame::Draw3dRectangle
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:357
TGColorPopup::fActive
Int_t fActive
active color index
Definition: TGColorSelect.h:78
TGColorSelect::fColor
Pixel_t fColor
color value of the button
Definition: TGColorSelect.h:107
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kLHintsCenterX
@ kLHintsCenterX
Definition: TGLayout.h:25
TGColorPopup::fLaunchDialog
Int_t fLaunchDialog
flag used for launching color dialog
Definition: TGColorSelect.h:79
TGCheckButton::SetState
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1250
TGPosition::fY
Int_t fY
y position
Definition: TGDimension.h:39
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TGColorDialog.h
f
#define f(i)
Definition: RSha256.hxx:104
TGFrame::SetBackgroundColor
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:312
TG16ColorSelector
A composite frame with 16 TGColorFrames.
Definition: TGColorSelect.h:50
kC_COLORSEL
@ kC_COLORSEL
Definition: WidgetMessageTypes.h:75
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGHorizontal3DLine
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition: TG3DLine.h:18
TGColorFrame::fActive
Bool_t fActive
kTRUE if this color cell is active
Definition: TGColorSelect.h:27
kPointerMotionMask
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:163
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TGColorSelect::Disable
void Disable()
Set state of widget as disabled.
Definition: TGColorSelect.cxx:531
kButtonDown
@ kButtonDown
Definition: TGButton.h:54
TString::Data
const char * Data() const
Definition: TString.h:369
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
Point_t
Point structure (maps to the X11 XPoint structure)
Definition: GuiTypes.h:356
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGCompositeFrame::GetFrameFromPoint
virtual TGFrame * GetFrameFromPoint(Int_t x, Int_t y)
Get frame located at specified point.
Definition: TGFrame.cxx:1308
TColor::GetPixel
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition: TColor.cxx:1446
TGFrame::fWidth
UInt_t fWidth
frame width
Definition: TGFrame.h:87
TGCompositeFrame::Cleanup
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:967
TG16ColorSelector::fCe
TGColorFrame * fCe[16]
matrix of color cells
Definition: TGColorSelect.h:55
TGFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
kButtonUp
@ kButtonUp
Definition: TGButton.h:53
TGWindow::kEditDisable
@ kEditDisable
disable edit of this window
Definition: TGWindow.h:50
TGColorSelect::GetColor
Pixel_t GetColor() const
Definition: TGColorSelect.h:130
TGColorPopup::PreviewColor
void PreviewColor(Pixel_t color)
Emit a signal to see preview.
Definition: TGColorSelect.cxx:380
TGTextButton
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
TGClient::IsEditable
Bool_t IsEditable() const
Definition: TGClient.h:89
TGFrame::HandleButton
virtual Bool_t HandleButton(Event_t *)
Definition: TGFrame.h:161
TGCompositeFrame::SetEditDisabled
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1022
x
Double_t x[n]
Definition: legend1.C:17
kButton1
@ kButton1
Definition: GuiTypes.h:214
TColor.h
TGResourcePool::GetGrabCursor
Cursor_t GetGrabCursor() const
Definition: TGResourcePool.h:162
TVirtualX.h
TColor::PixelAsHexString
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:2115
TColor::Number2Pixel
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2022
TGClient::GetResourcePool
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:124
TGWidget::WantFocus
Bool_t WantFocus() const
Definition: TGWidget.h:71
TGColorFrame::fColor
Pixel_t fColor
returned color value
Definition: TGColorSelect.h:29
TString::Format
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:2333
TGColorPopup::EndPopup
void EndPopup()
Ungrab pointer and unmap window.
Definition: TGColorSelect.cxx:267
TGFrame::GetBlackGC
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:735
TString
Basic string class.
Definition: TString.h:136
TGFrame
Definition: TGFrame.h:80
kButtonPressMask
const Mask_t kButtonPressMask
Definition: GuiTypes.h:161
TGColorFrame::fPixel
Pixel_t fPixel
color value of this cell
Definition: TGColorSelect.h:26
SetWindowAttributes_t::fMask
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:110
TGObject::GetId
Handle_t GetId() const
Definition: TGObject.h:37
kDoubleBorder
@ kDoubleBorder
Definition: GuiTypes.h:385
TGColorSelect::DrawTriangle
void DrawTriangle(GContext_t gc, Int_t x, Int_t y)
Draw triangle (arrow) on which user can click to open TGColorPopup.
Definition: TGColorSelect.cxx:625
kOwnBackground
@ kOwnBackground
Definition: GuiTypes.h:391
bool
TG16ColorSelector::~TG16ColorSelector
virtual ~TG16ColorSelector()
TG16ColorSelector destructor.
Definition: TGColorSelect.cxx:164
TG16ColorSelector::fActive
Int_t fActive
index of active color cell
Definition: TGColorSelect.h:53
TGColorSelect::~TGColorSelect
virtual ~TGColorSelect()
TGColorSelect destructor.
Definition: TGColorSelect.cxx:428
TGColorPopup::fCurrentColor
Pixel_t fCurrentColor
currently selected color value
Definition: TGColorSelect.h:81
TGWidget::HasFocus
Bool_t HasFocus() const
Definition: TGWidget.h:70
id
XFontStruct * id
Definition: TGX11.cxx:109
TGColorSelect::Enable
void Enable(Bool_t on=kTRUE)
Set state of widget as enabled.
Definition: TGColorSelect.cxx:518
kCOL_SELCHANGED
@ kCOL_SELCHANGED
Definition: WidgetMessageTypes.h:77
GContext_t
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
gClient
#define gClient
Definition: TGClient.h:157
TGCheckButton
Selects different options.
Definition: TGButton.h:264
TGColorSelect::TGColorSelect
TGColorSelect(const TGColorSelect &)=delete
TG16ColorSelector::TG16ColorSelector
TG16ColorSelector(const TG16ColorSelector &)=delete
TGFrame::AddInput
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:339
kNone
const Handle_t kNone
Definition: GuiTypes.h:88
TGFrame::GetHilightGC
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:755
TGFrame::DeleteWindow
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:276
TGColorFrame::fMsgWindow
const TGWindow * fMsgWindow
window handling container messages
Definition: TGColorSelect.h:25
TGMatrixLayout
This layout managers does not make use of TGLayoutHints.
Definition: TGLayout.h:269
TG16ColorSelector::fMsgWindow
const TGWindow * fMsgWindow
window handling container messages
Definition: TGColorSelect.h:54
TGColorSelect::DoRedraw
virtual void DoRedraw()
Redraw TGColorSelect widget.
Definition: TGColorSelect.cxx:540
TG3DLine.h
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TGColorDialog
A full featured color selection dialog.
Definition: TGColorDialog.h:136
TGPosition::fX
Int_t fX
x position
Definition: TGDimension.h:38
kLHintsCenterY
@ kLHintsCenterY
Definition: TGLayout.h:28
TColor
The color creation and management class.
Definition: TColor.h:19
TGColorPopup::TGColorPopup
TGColorPopup(const TGColorPopup &)=delete
h
#define h(i)
Definition: RSha256.hxx:106
TGWidget::WidgetId
Int_t WidgetId() const
Definition: TGWidget.h:68
TGWidget::fMsgWindow
const TGWindow * fMsgWindow
window which handles widget events
Definition: TGWidget.h:48
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:336
TGCompositeFrame::MapSubwindows
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1164
SetWindowAttributes_t::fOverrideRedirect
Bool_t fOverrideRedirect
boolean value for override-redirect
Definition: GuiTypes.h:107
kCOL_CLICK
@ kCOL_CLICK
Definition: WidgetMessageTypes.h:76
TGWidget::Associate
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:72
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:605
TGGC.h
TGObject::fId
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:26
TGCompositeFrame::TranslateCoordinates
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:1332
Event_t::fCode
UInt_t fCode
key or button code
Definition: GuiTypes.h:180
TGFrame::SendMessage
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
Definition: TGFrame.cxx:645
TGColorFrame::SetActive
void SetActive(Bool_t in)
Definition: TGColorSelect.h:42
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TGColorSelect::ColorSelected
virtual void ColorSelected(Pixel_t color=0)
Definition: TGColorSelect.h:142
TGFrame::fBorderWidth
Int_t fBorderWidth
frame border width
Definition: TGFrame.h:93
kButtonPress
@ kButtonPress
Definition: GuiTypes.h:60
kWidgetIsEnabled
@ kWidgetIsEnabled
Definition: TGWidget.h:37
kCM_BUTTON
@ kCM_BUTTON
Definition: WidgetMessageTypes.h:34
Long_t
long Long_t
Definition: RtypesCore.h:54
kButtonReleaseMask
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:162
TGWidget::IsEnabled
Bool_t IsEnabled() const
Definition: TGWidget.h:69
kButtonRelease
@ kButtonRelease
Definition: GuiTypes.h:60
TGColorPopup::PreviewAlphaColor
void PreviewAlphaColor(ULong_t color)
Emit a signal to see preview.
Definition: TGColorSelect.cxx:391
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TGFrame::MapRaised
virtual void MapRaised()
map raised
Definition: TGFrame.h:205
Window_t
Handle_t Window_t
Window handle.
Definition: GuiTypes.h:29
y
Double_t y[n]
Definition: legend1.C:17
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGColorPopup::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for TGColorPopup.
Definition: TGColorSelect.cxx:347
TGClient.h
TGFrame::GetBckgndGC
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:775
TGCompositeFrame::SetLayoutManager
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:1000
kRaisedFrame
@ kRaisedFrame
Definition: GuiTypes.h:384
TGColorFrame::fGrayGC
GContext_t fGrayGC
Shadow GC.
Definition: TGColorSelect.h:28
unsigned int
TGCompositeFrame::GetDefaultHeight
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:314
kMBOk
@ kMBOk
Definition: TGMsgBox.h:33
TGFrame::fX
Int_t fX
frame x position
Definition: TGFrame.h:85
TGColorFrame::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle button events in TGColorFrame.
Definition: TGColorSelect.cxx:106
TGColorPopup::fMsgWindow
const TGWindow * fMsgWindow
window handling container messages
Definition: TGColorSelect.h:80
TGColorSelect::AlphaColorSelected
virtual void AlphaColorSelected(ULong_t colptr=0)
Definition: TGColorSelect.h:144
TGColorSelect::SetAlphaColor
void SetAlphaColor(ULong_t color, Bool_t emit=kTRUE)
Set color.
Definition: TGColorSelect.cxx:666
TGWidget::fWidgetId
Int_t fWidgetId
the widget id (used for event processing)
Definition: TGWidget.h:46
TGWidget::ClearFlags
Int_t ClearFlags(Int_t flags)
Definition: TGWidget.h:59
TGColorFrame::DrawBorder
virtual void DrawBorder()
Draw TGColorFrame border.
Definition: TGColorSelect.cxx:120
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:374
TGFrame::UnmapWindow
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:206
TGColorSelect::fColorPopup
TGColorPopup * fColorPopup
color popup associated
Definition: TGColorSelect.h:109
TGMsgBox.h
TGObject::fClient
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
TGFrame::MoveResize
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:629
TGColorPopup
A popup containing a TG16ColorSelector and a "More..." button which popups up a TGColorDialog allowin...
Definition: TGColorSelect.h:75
kC_COMMAND
@ kC_COMMAND
Definition: WidgetMessageTypes.h:31
points
point * points
Definition: X3DBuffer.c:22
TGGC::SetForeground
void SetForeground(Pixel_t v)
Set foreground color.
Definition: TGGC.cxx:278
TGColorSelect::fPressPos
TGPosition fPressPos
position of frame on button press event
Definition: TGColorSelect.h:110
TGButton::fState
EButtonState fState
button state
Definition: TGButton.h:75
Event_t
Event structure.
Definition: GuiTypes.h:174
GET_SUBMSG
Int_t GET_SUBMSG(Long_t val)
Definition: WidgetMessageTypes.h:111
TGColorFrame::TGColorFrame
TGColorFrame(const TGColorFrame &)=delete
TGColorSelect::SetColor
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
Definition: TGColorSelect.cxx:654
TGFrame::GetShadowGC
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:765
TGColorSelect
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
Definition: TGColorSelect.h:104
kLHintsExpandX
@ kLHintsExpandX
Definition: TGLayout.h:30
TGWidget::SetFlags
Int_t SetFlags(Int_t flags)
Definition: TGWidget.h:58
TGResourcePool.h
kStructureNotifyMask
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:166
TGColorSelect.h
TGFrame::fHeight
UInt_t fHeight
frame height
Definition: TGFrame.h:88
TGCompositeFrame::GetDefaultWidth
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:312
TGWindow::fEditDisabled
UInt_t fEditDisabled
flags used for "guibuilding"
Definition: TGWindow.h:32
kWAOverrideRedirect
const Mask_t kWAOverrideRedirect
Definition: GuiTypes.h:149
TG16ColorSelector::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for TG16ColorSelector.
Definition: TGColorSelect.cxx:188
TGCompositeFrame
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGCheckButton::fPrevState
EButtonState fPrevState
previous check button state
Definition: TGButton.h:272
TGColorSelect::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for TGColorSelect.
Definition: TGColorSelect.cxx:436
TGCompositeFrame::AddFrame
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
TGColorPopup::PlacePopup
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
Popup TGColorPopup at x,y position.
Definition: TGColorSelect.cxx:276
TGColorSelect::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle button events for TGColorSelect.
Definition: TGColorSelect.cxx:469
TGCompositeFrame::Layout
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1257
TGColorSelect::fDrawGC
TGGC fDrawGC
drawing GC
Definition: TGColorSelect.h:108
MK_MSG
Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
Definition: WidgetMessageTypes.h:108
TG16ColorSelector::SetActive
void SetActive(Int_t newat)
Set active color frame.
Definition: TGColorSelect.cxx:172
TGWindow::fParent
const TGWindow * fParent
Parent window.
Definition: TGWindow.h:28
TGColorPopup::HandleButton
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events for TGColorPopup.
Definition: TGColorSelect.cxx:328
int
SetWindowAttributes_t
Attributes that can be used when creating or changing a window.
Definition: GuiTypes.h:93
TGFrame::DoRedraw
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:430
TGResourcePool::GetFrameGC
const TGGC * GetFrameGC() const
Definition: TGResourcePool.h:135