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