UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zqb_palette.hpp
1 /* zqb_palette.hpp */
2 /* $Id: zqb_palette.hpp,v 1.8 2006/06/05 13:19:51 guser4 Exp $ */
3 #ifndef __zqb_palette_hpp
4 #define __zqb_palette_hpp
5 
6 #include <qcolor.h>
7 #include <qpixmap.h>
8 
9 #include <vector>
10 
11 
18 {
19 public:
20 
22  ZqbPalette (const QColor& c = Qt::black);
23 
26  ZqbPalette (int n, const QColor& c1, const QColor& c2);
27 
31  ZqbPalette (int n, const QColor& c1, const QColor& c2, const QColor& c3);
32 
34  ZqbPalette (const ZqbPalette& zpal);
35 
37  virtual ~ZqbPalette ();
38 
39 
41  ZqbPalette& operator= (const ZqbPalette& zpal);
42 
43 
44 
46  virtual void revertColorsOrder ();
47 
49  virtual int numberOfColors () const;
50 
54  virtual const QColor& color (int index) const;
55 
58  const QColor& operator[] (int index) const {
59  return color(index);
60  }
61 
65  virtual QColor& color (int index);
66 
69  QColor& operator[] (int index) {
70  return color(index);
71  }
72 
76  virtual int colorIndex (const QColor& c) const;
77 
80  const int operator[] (const QColor& c) const {
81  return colorIndex(c);
82  }
83 
86  virtual void drawPalette (QPixmap& pixmap,
87  Qt::Orientation eOrient) const;
88 
91  virtual int addColor (const QColor& c);
92 
95  ZqbPalette& operator+= (const QColor& c) {
96  addColor(c);
97  return *this;
98  }
99 
102  virtual int addPalette (const ZqbPalette& pal);
103 
107  addPalette(pal);
108  return *this;
109  }
110 
113  void expandToColor (int n, const QColor& c);
114 
117  int addColors (int n, const QColor& c1, const QColor& c2) {
118  return addPalette(ZqbPalette(n, c1, c2));
119  }
120 
124  int addColors (int n, const QColor& c1,
125  const QColor& c2, const QColor& c3) {
126  return addPalette(ZqbPalette(n, c1, c2, c3));
127  }
128 
129 
130 private:
131 
133  std::vector<QColor*> m_Colors;
134 
135 };
136 
137 
138 #endif /* zqb_palette.hpp */
virtual void revertColorsOrder()
int addColors(int n, const QColor &c1, const QColor &c2)
Definition: zqb_palette.hpp:117
ZqbPalette & operator+=(const QColor &c)
Definition: zqb_palette.hpp:95
virtual int addColor(const QColor &c)
virtual const QColor & color(int index) const
ZqbPalette & operator=(const ZqbPalette &zpal)
void expandToColor(int n, const QColor &c)
virtual void drawPalette(QPixmap &pixmap, Qt::Orientation eOrient) const
ZqbPalette(const QColor &c=Qt::black)
virtual ~ZqbPalette()
virtual int addPalette(const ZqbPalette &pal)
const QColor & operator[](int index) const
Definition: zqb_palette.hpp:58
virtual int numberOfColors() const
int addColors(int n, const QColor &c1, const QColor &c2, const QColor &c3)
Definition: zqb_palette.hpp:124
Definition: zqb_palette.hpp:17
virtual int colorIndex(const QColor &c) const