CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWColorSelect.h
Go to the documentation of this file.
1 #ifndef Fireworks_Core_FWColorSelect_h
2 #define Fireworks_Core_FWColorSelect_h
3 
4 #include "TGLabel.h"
5 #include "TGButton.h"
6 #include "TGColorSelect.h"
7 
8 #include <vector>
9 
10 class FWColorManager;
11 class TGColorPopup;
12 
13 
14 //------------------------------FWColorFrame------------------------------//
15 
16 class FWColorFrame : public TGFrame
17 {
18 protected:
19  Color_t fColor;
20 
21 public:
22  FWColorFrame(const TGWindow *p=0, Color_t ci=0);
23  virtual ~FWColorFrame() {}
24 
25  virtual Bool_t HandleButton(Event_t *event);
26  virtual void DrawBorder() {}
27 
28  void SetColor(Color_t);
29  Color_t GetColor() const { return fColor; }
30 
31  void ColorSelected(Color_t); // *SIGNAL*
32 
34 
35 };
36 
37 
38 //------------------------------FWColorRow------------------------------//
39 
40 class FWColorRow : public TGHorizontalFrame
41 {
42  void DrawHighlight();
43 
44 protected:
47  std::vector<FWColorFrame *> fCc;
48 
49  virtual void DoRedraw();
50 
51 public:
52  FWColorRow(const TGWindow *p=0);
53  virtual ~FWColorRow();
54 
55  virtual void AddColor(Color_t color);
56 
57  void ResetColor(Int_t, Color_t);
58  void SetBackgroundToBlack(Bool_t);
59 
60  //if it can't find the color it returns -1
61  Int_t FindColorIndex(Color_t) const;
62 
63  Int_t GetSelectedIndex() const { return fSelectedIndex; }
64  void SetSelectedIndex(Int_t i) { fSelectedIndex = i; }
65 
66  void ColorChanged(Color_t); // *SIGNAL*
67 
68  ClassDef(FWColorRow, 0);
69 
70 };
71 
72 
73 //------------------------------FWColorPopup------------------------------//
74 
75 class FWColorPopup : public TGVerticalFrame
76 {
77 private:
78  void SetColors(const std::vector<Pixel_t>& colors, bool backgroundIsBlack);
79 
80 protected:
81  Color_t fSelectedColor;
83  TGLabel *fLabel;
84  Int_t fNumColors;
85  Bool_t fShowWheel;
86 
87  static Bool_t fgFreePalette;
88 
89 public:
90  FWColorPopup(const TGWindow *p=0, Color_t color=0);
91  virtual ~FWColorPopup();
92 
93  virtual Bool_t HandleButton(Event_t *event);
94 
95  void InitContent(const char *name, const std::vector<Color_t>& colors, bool backgroundIsBlack=true);
96  void SetName(const char* iName);
97  void SetColors(const std::vector<Color_t>& colors, bool backgroundIsBlack=true);
98  void ResetColors(const std::vector<Color_t>& colors, bool backgroundIsBlack=true);
99  void SetSelection(Color_t);
100  void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h);
101 
102  void ColorSelected(Color_t); // *SIGNAL*
103 
104  void PopupColorWheel();
105  void ColorWheelSelected(Pixel_t);
106 
107  static Bool_t HasFreePalette();
108  static void EnableFreePalette();
109 
111 };
112 
113 
114 //------------------------------FWColorSelect------------------------------//
115 
116 class FWColorSelect : public TGColorSelect
117 {
118 private:
120  Color_t fSelectedColor;
123 
124 
125 public:
126  FWColorSelect(const TGWindow *p, const char *label, Color_t colorIndex,
127  const FWColorManager*, Int_t id);
128  ~FWColorSelect();
129 
130  virtual Bool_t HandleButton(Event_t *event);
131 
132  void SetColorByIndex(Color_t iColor);
133  void SetColorByIndex(Color_t iColor, Bool_t iSendSignal);
134  void UpdateColors();
135  const std::string& label() const { return fLabel; }
136  void ColorChosen(Color_t); // *SIGNAL*
137 
139 
140 };
141 #endif
virtual Bool_t HandleButton(Event_t *event)
int i
Definition: DBlmapReader.cc:9
virtual ~FWColorRow()
Int_t fSelectedIndex
Definition: FWColorSelect.h:46
void InitContent(const char *name, const std::vector< Color_t > &colors, bool backgroundIsBlack=true)
Bool_t fShowWheel
Definition: FWColorSelect.h:85
virtual void DoRedraw()
void SetName(const char *iName)
const double w
Definition: UKUtility.cc:23
void SetColorByIndex(Color_t iColor)
FWColorPopup * fFireworksPopup
static Bool_t HasFreePalette()
void SetBackgroundToBlack(Bool_t)
virtual ~FWColorFrame()
Definition: FWColorSelect.h:23
FWColorRow * fFirstRow
Definition: FWColorSelect.h:82
void DrawHighlight()
void ColorChosen(Color_t)
virtual Bool_t HandleButton(Event_t *event)
TGLabel * fLabel
Definition: FWColorSelect.h:83
FWColorRow * fSecondRow
Definition: FWColorSelect.h:82
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
vector< Color_t > colors
static Bool_t fgFreePalette
Definition: FWColorSelect.h:87
ClassDef(FWColorRow, 0)
const std::string & label() const
virtual ~FWColorPopup()
void ColorSelected(Color_t)
Int_t fNumColors
Definition: FWColorSelect.h:84
void SetColor(Color_t)
FWColorSelect(const TGWindow *p, const char *label, Color_t colorIndex, const FWColorManager *, Int_t id)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void ResetColors(const std::vector< Color_t > &colors, bool backgroundIsBlack=true)
void SetSelection(Color_t)
void ColorChanged(Color_t)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void ColorSelected(Color_t)
Color_t fSelectedColor
virtual void DrawBorder()
Definition: FWColorSelect.h:26
Color_t fSelectedColor
Definition: FWColorSelect.h:81
Color_t GetColor() const
Definition: FWColorSelect.h:29
void SetColors(const std::vector< Pixel_t > &colors, bool backgroundIsBlack)
const FWColorManager * fColorManager
Bool_t fBackgroundIsBlack
Definition: FWColorSelect.h:45
virtual Bool_t HandleButton(Event_t *event)
Int_t GetSelectedIndex() const
Definition: FWColorSelect.h:63
std::string fLabel
virtual void AddColor(Color_t color)
ClassDef(FWColorFrame, 0)
void SetSelectedIndex(Int_t i)
Definition: FWColorSelect.h:64
void ResetColor(Int_t, Color_t)
Color_t fColor
Definition: FWColorSelect.h:19
void ColorWheelSelected(Pixel_t)
FWColorRow(const TGWindow *p=0)
static void EnableFreePalette()
std::vector< FWColorFrame * > fCc
Definition: FWColorSelect.h:47
Int_t FindColorIndex(Color_t) const
ClassDef(FWColorSelect, 0)
void PopupColorWheel()
ClassDef(FWColorPopup, 0)
FWColorPopup(const TGWindow *p=0, Color_t color=0)
FWColorFrame(const TGWindow *p=0, Color_t ci=0)