libt3widget
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules
colorpicker.h
1 /* Copyright (C) 2012 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef T3_WIDGET_COLORPICKER_H
15 #define T3_WIDGET_COLORPICKER_H
16 
17 #include <t3widget/widgets/widget.h>
18 
19 namespace t3_widget {
20 
21 class T3_WIDGET_API color_picker_base_t : public widget_t {
22  protected:
23  int max_color, current_color;
24  bool fg, has_focus;
25  t3_attr_t undefined_colors;
26  const char *color_str;
27 
28  color_picker_base_t(bool _fg);
29  virtual int xy_to_color(int x, int y) = 0;
30  virtual void color_to_xy(int color, int &x, int &y) = 0;
31  virtual t3_attr_t get_paint_attr(int color) = 0;
32  virtual void paint_color_name(int color);
33 
34  public:
35  virtual bool process_key(key_t key);
36  virtual void update_contents(void);
37  virtual bool set_size(optint height, optint width);
38  virtual bool process_mouse_event(mouse_event_t event);
39  virtual void set_focus(focus_t focus);
40 
50  void set_undefined_colors(t3_attr_t attr);
51  t3_attr_t get_color(void);
52  void set_color(t3_attr_t attr);
53 
54  T3_WIDGET_SIGNAL(activated, void);
55  T3_WIDGET_SIGNAL(selection_changed, void);
56 };
57 
58 class T3_WIDGET_API color_picker_t : public color_picker_base_t {
59  protected:
60  virtual int xy_to_color(int x, int y);
61  virtual void color_to_xy(int color, int &x, int &y);
62  virtual t3_attr_t get_paint_attr(int color);
63  virtual void paint_color_name(int color);
64  public:
65  color_picker_t(bool _fg);
66 };
67 
68 class T3_WIDGET_API color_pair_picker_t : public color_picker_base_t {
69  protected:
70  virtual int xy_to_color(int x, int y);
71  virtual void color_to_xy(int color, int &x, int &y);
72  virtual t3_attr_t get_paint_attr(int color);
73  public:
74  color_pair_picker_t(void);
75 };
76 
77 }; // namespace
78 #endif
The t3_widget namespace is contains all classes, functions and global variables in the libt3widget li...
Definition: autocompleter.cc:18
long key_t
Integer type holding a single key symbol.
Definition: key.h:24
Definition: colorpicker.h:68
Definition: colorpicker.h:21
Base class for widgets.
Definition: widget.h:24
Class defining values with a separate validity check.
Definition: util.h:29
Structure holding the relevant elements of a mouse event.
Definition: mouse.h:23
Definition: colorpicker.h:58