Warning, file /include/root/TGColorDialog.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT_TGColorDialog
0014 #define ROOT_TGColorDialog
0015
0016
0017 #include "TGFrame.h"
0018 #include "TGWidget.h"
0019 #include "TColor.h"
0020
0021
0022 class TGTextEntry;
0023 class TGTextBuffer;
0024 class TGTab;
0025 class TRootEmbeddedCanvas;
0026 class TColorWheel;
0027 class TGLabel;
0028 class TGTextButton;
0029
0030
0031
0032 class TGColorPalette : public TGFrame, public TGWidget {
0033
0034 private:
0035
0036 TGColorPalette(const TGColorPalette&) = delete;
0037 TGColorPalette& operator=(const TGColorPalette&) = delete;
0038
0039 protected:
0040 Int_t fCx;
0041 Int_t fCy;
0042 UInt_t fCw;
0043 UInt_t fCh;
0044 Int_t fRows;
0045 Int_t fCols;
0046 Pixel_t *fPixels;
0047 TGGC fDrawGC;
0048
0049 void DoRedraw() override;
0050 virtual void GotFocus();
0051 virtual void LostFocus();
0052
0053 void DrawFocusHilite(Int_t onoff);
0054
0055 public:
0056 TGColorPalette(const TGWindow *p = nullptr, Int_t cols = 8, Int_t rows = 8, Int_t id = -1);
0057 ~TGColorPalette() override;
0058
0059 Bool_t HandleButton(Event_t *event) override;
0060 Bool_t HandleMotion(Event_t *event) override;
0061 Bool_t HandleKey(Event_t *event) override;
0062
0063 TGDimension GetDefaultSize() const override
0064 { return TGDimension((fCw + 5) * fCols, (fCh + 5) * fRows); }
0065
0066 void SetColors(Pixel_t colors[]);
0067 void SetColor(Int_t ix, Pixel_t color);
0068 void SetCurrentCellColor(Pixel_t color);
0069
0070 void SetCellSize(Int_t w = 20, Int_t h = 17);
0071
0072 Pixel_t GetColorByIndex(Int_t ix) const { return fPixels[ix]; }
0073 Pixel_t GetCurrentColor() const;
0074
0075 virtual void ColorSelected(Pixel_t col = 0)
0076 { Emit("ColorSelected(Pixel_t)", col ? col : GetCurrentColor()); }
0077
0078 ClassDefOverride(TGColorPalette,0)
0079 };
0080
0081
0082
0083 class TGColorPick : public TGFrame, public TGWidget {
0084
0085 private:
0086 Int_t fColormap[64][3];
0087 Pixel_t fPixel[64];
0088
0089 protected:
0090 Pixmap_t fHSimage;
0091 Pixmap_t fLimage;
0092 Int_t fNColors;
0093 Int_t fClick;
0094 Int_t fCx;
0095 Int_t fCy;
0096 Int_t fCz;
0097 Pixel_t fCurrentColor;
0098 Rectangle_t fColormapRect;
0099 Rectangle_t fSliderRect;
0100 TGGC fCursorGC;
0101
0102 void DoRedraw() override;
0103
0104 void DrawHScursor(Int_t onoff);
0105 void DrawLcursor(Int_t onoff);
0106 void SetHScursor(Int_t x, Int_t y);
0107 void SetLcursor(Int_t z);
0108
0109 void CreateImages();
0110 void InitImages();
0111 void SetSliderColor();
0112 void UpdateCurrentColor();
0113
0114 void AllocColors();
0115 void FreeColors();
0116 void CreateDitheredImage(Pixmap_t image, Int_t which);
0117
0118 public:
0119 TGColorPick(const TGWindow *p = nullptr, Int_t w = 1, Int_t h = 1, Int_t id = -1);
0120 ~TGColorPick() override;
0121
0122 Bool_t HandleButton(Event_t *event) override;
0123 Bool_t HandleMotion(Event_t *event) override;
0124
0125 void SetColor(Pixel_t color);
0126 Pixel_t GetCurrentColor() const { return fCurrentColor; }
0127
0128 virtual void ColorSelected(Pixel_t col = 0)
0129 { Emit("ColorSelected(Pixel_t)", col ? col : GetCurrentColor()); }
0130
0131 ClassDefOverride(TGColorPick,0)
0132 };
0133
0134
0135
0136 class TGColorDialog : public TGTransientFrame {
0137
0138 private:
0139
0140 TGColorDialog(const TGColorDialog&) = delete;
0141 TGColorDialog& operator=(const TGColorDialog&) = delete;
0142
0143 protected:
0144 Pixel_t fCurrentColor;
0145 Pixel_t fInitColor;
0146 Int_t *fRetc;
0147 Pixel_t *fRetColor;
0148 TColor *fRetTColor;
0149
0150 TGColorPalette *fPalette;
0151 TGColorPalette *fCpalette;
0152 TGColorPick *fColors;
0153 TGFrame *fSample;
0154 TGFrame *fSampleOld;
0155 TGTextEntry *fRte, *fGte, *fBte, *fHte, *fLte, *fSte, *fAle;
0156 TGTextBuffer *fRtb, *fGtb, *fBtb, *fHtb, *fLtb, *fStb, *fAlb;
0157 Bool_t fWaitFor;
0158
0159 TGTab *fTab;
0160 TRootEmbeddedCanvas *fEcanvas;
0161 TColorWheel *fColorWheel;
0162 TGLabel *fColorInfo;
0163 TGTextButton *fPreview;
0164
0165 void UpdateRGBentries(Pixel_t *c);
0166 void UpdateHLSentries(Pixel_t *c);
0167 void UpdateAlpha(Pixel_t *c);
0168 void CloseWindow() override;
0169 Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
0170
0171 public:
0172 TGColorDialog(const TGWindow *p = nullptr, const TGWindow *m = nullptr, Int_t *retc = nullptr,
0173 Pixel_t *color = nullptr, Bool_t wait = kTRUE);
0174 ~TGColorDialog() override;
0175
0176 TGColorPalette *GetPalette() const { return fPalette; }
0177 TGColorPalette *GetCustomPalette() const { return fCpalette; }
0178
0179 virtual void ColorSelected(Pixel_t);
0180 virtual void AlphaColorSelected(ULongptr_t);
0181 void DoPreview();
0182 virtual void SetCurrentColor(Pixel_t col);
0183 void SetColorInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
0184
0185 ClassDefOverride(TGColorDialog,0)
0186 };
0187
0188 #endif