Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/colorpicker.h')
-rw-r--r--src/ui/colorpicker.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/ui/colorpicker.h b/src/ui/colorpicker.h
new file mode 100644
index 0000000..e2c0cb5
--- /dev/null
+++ b/src/ui/colorpicker.h
@@ -0,0 +1,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__