13 #ifndef ROOT_TGColorDialog
14 #define ROOT_TGColorDialog
46 class TRootEmbeddedCanvas;
53 class TGColorPalette :
public TGFrame,
public TGWidget {
57 TGColorPalette(
const TGColorPalette&);
58 TGColorPalette& operator=(
const TGColorPalette&);
70 virtual void DoRedraw();
71 virtual void GotFocus();
72 virtual void LostFocus();
74 void DrawFocusHilite(Int_t onoff);
77 TGColorPalette(
const TGWindow *p = 0, Int_t cols = 8, Int_t rows = 8, Int_t
id = -1);
78 virtual ~TGColorPalette();
80 virtual Bool_t HandleButton(Event_t *event);
81 virtual Bool_t HandleMotion(Event_t *event);
82 virtual Bool_t HandleKey(Event_t *event);
84 virtual TGDimension GetDefaultSize()
const
85 {
return TGDimension((fCw + 5) * fCols, (fCh + 5) * fRows); }
87 void SetColors(Pixel_t colors[]);
88 void SetColor(Int_t ix, Pixel_t color);
89 void SetCurrentCellColor(Pixel_t color);
91 void SetCellSize(Int_t w = 20, Int_t h = 17);
93 Pixel_t GetColorByIndex(Int_t ix)
const {
return fPixels[ix]; }
94 Pixel_t GetCurrentColor()
const;
96 virtual void ColorSelected(Pixel_t col = 0)
97 { Emit(
"ColorSelected(Pixel_t)", col ? col : GetCurrentColor()); }
99 ClassDef(TGColorPalette,0)
104 class TGColorPick :
public TGFrame,
public TGWidget {
107 Int_t fColormap[64][3];
118 Pixel_t fCurrentColor;
119 Rectangle_t fColormapRect;
120 Rectangle_t fSliderRect;
123 virtual void DoRedraw();
125 void DrawHScursor(Int_t onoff);
126 void DrawLcursor(Int_t onoff);
127 void SetHScursor(Int_t x, Int_t y);
128 void SetLcursor(Int_t z);
132 void SetSliderColor();
133 void UpdateCurrentColor();
137 void CreateDitheredImage(Pixmap_t image, Int_t which);
140 TGColorPick(
const TGWindow *p = 0, Int_t w = 1, Int_t h = 1, Int_t
id = -1);
141 virtual ~TGColorPick();
143 virtual Bool_t HandleButton(Event_t *event);
144 virtual Bool_t HandleMotion(Event_t *event);
146 void SetColor(Pixel_t color);
147 Pixel_t GetCurrentColor()
const {
return fCurrentColor; }
149 virtual void ColorSelected(Pixel_t col = 0)
150 { Emit(
"ColorSelected(Pixel_t)", col ? col : GetCurrentColor()); }
152 ClassDef(TGColorPick,0)
157 class TGColorDialog :
public TGTransientFrame {
161 TGColorDialog(
const TGColorDialog&);
162 TGColorDialog& operator=(
const TGColorDialog&);
165 Pixel_t fCurrentColor;
171 TGColorPalette *fPalette;
172 TGColorPalette *fCpalette;
173 TGColorPick *fColors;
176 TGTextEntry *fRte, *fGte, *fBte, *fHte, *fLte, *fSte, *fAle;
177 TGTextBuffer *fRtb, *fGtb, *fBtb, *fHtb, *fLtb, *fStb, *fAlb;
181 TRootEmbeddedCanvas *fEcanvas;
182 TColorWheel *fColorWheel;
184 TGTextButton *fPreview;
186 void UpdateRGBentries(Pixel_t *c);
187 void UpdateHLSentries(Pixel_t *c);
188 void UpdateAlpha(Pixel_t *c);
189 virtual void CloseWindow();
190 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
193 TGColorDialog(
const TGWindow *p = 0,
const TGWindow *m = 0, Int_t *retc = 0,
194 Pixel_t *color = 0, Bool_t wait = kTRUE);
195 virtual ~TGColorDialog();
197 TGColorPalette *GetPalette()
const {
return fPalette; }
198 TGColorPalette *GetCustomPalette()
const {
return fCpalette; }
200 virtual void ColorSelected(Pixel_t);
201 virtual void AlphaColorSelected(ULong_t);
203 virtual void SetCurrentColor(Pixel_t col);
204 void SetColorInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
206 ClassDef(TGColorDialog,0)