/* 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__