Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGColorSelect.h
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-2021, 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#ifndef ROOT_TGColorSelect
13#define ROOT_TGColorSelect
14
15
16#include "TGFrame.h"
17#include "TGButton.h"
18
19
20//----------------------------------------------------------------------
21
22class TGColorFrame : public TGFrame {
23
24protected:
25 const TGWindow *fMsgWindow; ///< window handling container messages
26 Pixel_t fPixel; ///< color value of this cell
27 Bool_t fActive; ///< kTRUE if this color cell is active
28 GContext_t fGrayGC; ///< Shadow GC
29 Pixel_t fColor; ///< returned color value
30
31private:
32 TGColorFrame(const TGColorFrame&) = delete;
34
35public:
36 TGColorFrame(const TGWindow *p = nullptr, Pixel_t c = 0, Int_t n = 1);
37 virtual ~TGColorFrame() { }
38
40 virtual void DrawBorder();
41
42 void SetActive(Bool_t in) { fActive = in; gClient->NeedRedraw(this); }
43 Pixel_t GetColor() const { return fColor; }
44
45 ClassDef(TGColorFrame,0) // Frame for color cell
46};
47
48//----------------------------------------------------------------------
49
51
52protected:
53 Int_t fActive; ///< index of active color cell
54 const TGWindow *fMsgWindow; ///< window handling container messages
55 TGColorFrame *fCe[16]; ///< matrix of color cells
56
57private:
60
61public:
62 TG16ColorSelector(const TGWindow *p = nullptr);
63 virtual ~TG16ColorSelector();
64
65 virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
66
67 void SetActive(Int_t newat);
68 Int_t GetActive() { return fActive; }
69
70 ClassDef(TG16ColorSelector,0) // 16 color cells
71};
72
73//----------------------------------------------------------------------
74
76
77protected:
78 Int_t fActive; ///< active color index
79 Int_t fLaunchDialog; ///< flag used for launching color dialog
80 const TGWindow *fMsgWindow; ///< window handling container messages
81 Pixel_t fCurrentColor; ///< currently selected color value
82
83private:
84 TGColorPopup(const TGColorPopup&) = delete;
86
87public:
88 TGColorPopup(const TGWindow *p = nullptr, const TGWindow *m = nullptr, Pixel_t color = 0);
89 virtual ~TGColorPopup();
90
92 virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
93
95 void EndPopup();
96 void PreviewColor(Pixel_t color);
97 void PreviewAlphaColor(ULongptr_t color);
98
99 ClassDef(TGColorPopup,0) // Color selector popup
100};
101
102//----------------------------------------------------------------------
103
105
106protected:
107 Pixel_t fColor; ///< color value of the button
108 TGGC fDrawGC; ///< drawing GC
109 TGColorPopup *fColorPopup; ///< color popup associated
110 TGPosition fPressPos; ///< position of frame on button press event
111
112 virtual void DoRedraw();
113
115
116private:
117 TGColorSelect(const TGColorSelect&) = delete;
119
120public:
121 TGColorSelect(const TGWindow *p = nullptr, Pixel_t color = 0,
122 Int_t id = -1);
123 virtual ~TGColorSelect();
124
126 virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
127
128 void SetColor(Pixel_t color, Bool_t emit = kTRUE);
129 void SetAlphaColor(ULong_t color, Bool_t emit = kTRUE);
130 Pixel_t GetColor() const { return fColor; }
131 void Enable(Bool_t on = kTRUE); //*TOGGLE* *GETTER=IsEnabled
132 void Disable();
133
134 // dummy methods just to remove from context menu
135 void SetDown(Bool_t on = kTRUE, Bool_t emit = kFALSE) { TGButton::SetDown(on, emit); }
136 void Rename(const char *title) { TGTextButton::SetTitle(title); }
138
139 virtual TGDimension GetDefaultSize() const { return TGDimension(43, 21); }
140 virtual void SavePrimitive(std::ostream &out, Option_t * = "");
141
142 virtual void ColorSelected(Pixel_t color = 0)
143 { Emit("ColorSelected(Pixel_t)", color ? color : GetColor()); } //*SIGNAL*
144 virtual void AlphaColorSelected(ULong_t colptr = 0)
145 { Emit("AlphaColorSelected(ULong_t)", colptr); } //*SIGNAL*
146
147 ClassDef(TGColorSelect,0) // Color selection checkbutton
148};
149
150#endif
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
long Longptr_t
Definition RtypesCore.h:82
unsigned long ULongptr_t
Definition RtypesCore.h:83
const Bool_t kFALSE
Definition RtypesCore.h:101
unsigned long ULong_t
Definition RtypesCore.h:55
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
#define gClient
Definition TGClient.h:157
A composite frame with 16 TGColorFrames.
void SetActive(Int_t newat)
Set active color frame.
TG16ColorSelector & operator=(const TG16ColorSelector &)=delete
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process messages for TG16ColorSelector.
TGColorFrame * fCe[16]
matrix of color cells
Int_t fActive
index of active color cell
virtual ~TG16ColorSelector()
TG16ColorSelector destructor.
const TGWindow * fMsgWindow
window handling container messages
TG16ColorSelector(const TG16ColorSelector &)=delete
virtual void SetDown(Bool_t on=kTRUE, Bool_t emit=kFALSE)
Definition TGButton.cxx:310
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:459
Selects different options.
Definition TGButton.h:264
A small frame with border showing a specific color.
virtual Bool_t HandleButton(Event_t *event)
Handle button events in TGColorFrame.
TGColorFrame(const TGColorFrame &)=delete
GContext_t fGrayGC
Shadow GC.
TGColorFrame & operator=(const TGColorFrame &)=delete
Pixel_t GetColor() const
const TGWindow * fMsgWindow
window handling container messages
virtual ~TGColorFrame()
virtual void DrawBorder()
Draw TGColorFrame border.
void SetActive(Bool_t in)
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...
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events for TGColorPopup.
const TGWindow * fMsgWindow
window handling container messages
TGColorPopup & operator=(const TGColorPopup &)=delete
virtual ~TGColorPopup()
TGColorPopup destructor.
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.
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
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
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
TGColorPopup * fColorPopup
color popup associated
TGGC fDrawGC
drawing GC
TGColorSelect & operator=(const TGColorSelect &)=delete
virtual void AlphaColorSelected(ULong_t colptr=0)
void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
void SetDown(Bool_t on=kTRUE, Bool_t emit=kFALSE)
virtual TGDimension GetDefaultSize() const
default size
Pixel_t fColor
color value of the button
virtual ~TGColorSelect()
TGColorSelect destructor.
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process messages for TGColorSelect.
TGColorSelect(const TGColorSelect &)=delete
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
TGPosition fPressPos
position of frame on button press event
void Enable(Bool_t on=kTRUE)
Set state of widget as enabled.
virtual void ColorSelected(Pixel_t color=0)
void Rename(const char *title)
void SetAlphaColor(ULong_t color, Bool_t emit=kTRUE)
Set color.
void Disable()
Set state of widget as disabled.
virtual Bool_t HandleButton(Event_t *event)
Handle button events for TGColorSelect.
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.
virtual void DoRedraw()
Redraw TGColorSelect widget.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a color select widget as a C++ statement(s) on output stream out.
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
virtual void SetTitle(const char *label)
Definition TGButton.h:196
ROOT GUI Window base class.
Definition TGWindow.h:23
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Event structure.
Definition GuiTypes.h:174
auto * m
Definition textangle.C:8