blob: e2c0cb5168fddad527a255bbe1972b8394ba4248 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
ui/colorpicker.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#ifndef __INCLUDED_UI_COLORPICKER_H__
#define __INCLUDED_UI_COLORPICKER_H__
#include "ui/widget.h"
namespace ui
{
class Bitmap;
class Label;
class Slider;
class ColorPicker : public Widget
{
public:
ColorPicker(Widget *parent);
~ColorPicker();
/**
* @brief current selected color
* */
inline const math::Color color() const {
return _color;
}
/**
* @brief set selected color
* */
void set_color(const math::Color & color);
/**
* @brief set selected color
* */
void set_color(const float r, const float g, const float b);
protected:
/// resize event handler
virtual void resize();
/**
* @brief emit event handler
* */
virtual bool on_emit(ui::Widget *sender, const ui::Widget::Event event, void *data);
private:
void color_changed();
Label *_label_red;
Slider *_slider_red;
Label *_label_green;
Slider *_slider_green;
Label *_label_blue;
Slider *_slider_blue;
Bitmap *_color_preview;
math::Color _color;
};
}
#endif // __INCLUDED_UI_COLORPICKER_H__
|