#ifndef ROOT_TGColorSelect
#define ROOT_TGColorSelect
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGButton
#include "TGButton.h"
#endif
class TGColorFrame : public TGFrame {
protected:
const TGWindow *fMsgWindow;
Pixel_t fPixel;
Bool_t fActive;
GContext_t fGrayGC;
Pixel_t fColor;
private:
TGColorFrame(const TGColorFrame&);
TGColorFrame& operator=(const TGColorFrame&);
public:
TGColorFrame(const TGWindow *p = 0, Pixel_t c = 0, Int_t n = 1);
virtual ~TGColorFrame() { }
virtual Bool_t HandleButton(Event_t *event);
virtual void DrawBorder();
void SetActive(Bool_t in) { fActive = in; gClient->NeedRedraw(this); }
Pixel_t GetColor() const { return fColor; }
ClassDef(TGColorFrame,0)
};
class TG16ColorSelector : public TGCompositeFrame {
protected:
Int_t fActive;
const TGWindow *fMsgWindow;
TGColorFrame *fCe[16];
private:
TG16ColorSelector(const TG16ColorSelector&);
TG16ColorSelector& operator=(const TG16ColorSelector&);
public:
TG16ColorSelector(const TGWindow *p = 0);
virtual ~TG16ColorSelector();
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
void SetActive(Int_t newat);
Int_t GetActive() { return fActive; }
ClassDef(TG16ColorSelector,0)
};
class TGColorPopup : public TGCompositeFrame {
protected:
Int_t fActive;
Int_t fLaunchDialog;
const TGWindow *fMsgWindow;
Pixel_t fCurrentColor;
private:
TGColorPopup(const TGColorPopup&);
TGColorPopup& operator=(const TGColorPopup&);
public:
TGColorPopup(const TGWindow *p = 0, const TGWindow *m = 0, Pixel_t color = 0);
virtual ~TGColorPopup();
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h);
void EndPopup();
void PreviewColor(Pixel_t color);
void PreviewAlphaColor(ULong_t color);
ClassDef(TGColorPopup,0)
};
class TGColorSelect : public TGCheckButton {
protected:
Pixel_t fColor;
TGGC fDrawGC;
TGColorPopup *fColorPopup;
TGPosition fPressPos;
virtual void DoRedraw();
void DrawTriangle(GContext_t gc, Int_t x, Int_t y);
private:
TGColorSelect(const TGColorSelect&);
TGColorSelect& operator=(const TGColorSelect&);
public:
TGColorSelect(const TGWindow *p = 0, Pixel_t color = 0,
Int_t id = -1);
virtual ~TGColorSelect();
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
void SetColor(Pixel_t color, Bool_t emit = kTRUE);
void SetAlphaColor(ULong_t color, Bool_t emit = kTRUE);
Pixel_t GetColor() const { return fColor; }
void Enable(Bool_t on = kTRUE);
void Disable();
void SetDown(Bool_t on = kTRUE, Bool_t emit = kFALSE) { TGButton::SetDown(on, emit); }
void Rename(const char *title) { TGTextButton::SetTitle(title); }
void SetEnabled(Bool_t e = kTRUE) {TGButton::SetEnabled(e); }
virtual TGDimension GetDefaultSize() const { return TGDimension(43, 21); }
virtual void SavePrimitive(std::ostream &out, Option_t * = "");
virtual void ColorSelected(Pixel_t color = 0)
{ Emit("ColorSelected(Pixel_t)", color ? color : GetColor()); }
virtual void AlphaColorSelected(ULong_t colptr = 0)
{ Emit("AlphaColorSelected(ULong_t)", colptr); }
ClassDef(TGColorSelect,0)
};
#endif