Update list of wide characters
[centerim5.git] / cppconsui / ColorPicker.h
blob7bf61be13d190cbb09d0f9e27cc172ca9c1df9f4
1 // Copyright (C) 2012 Mark Pustjens <pustjens@dds.nl>
2 // Copyright (C) 2012-2015 Petr Pavlu <setup@dagobah.cz>
3 //
4 // This file is part of CenterIM.
5 //
6 // CenterIM is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // CenterIM is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with CenterIM. If not, see <http://www.gnu.org/licenses/>.
19 /// @file
20 /// ColorPicker class.
21 ///
22 /// @ingroup cppconsui
24 #ifndef COLORPICKER_H
25 #define COLORPICKER_H
27 #include "ColorPickerComboBox.h"
28 #include "HorizontalListBox.h"
29 #include "Label.h"
31 namespace CppConsUI {
33 class ColorPicker : public HorizontalListBox {
34 public:
35 ColorPicker(int fg, int bg, const char *text, bool sample = false);
36 virtual ~ColorPicker() override {}
38 virtual void setColorPair(int fg, int bg);
39 virtual void setText(const char *new_text);
41 /// Signal emitted when a colorpair has been selected.
42 sigc::signal<void, ColorPicker &, int, int> signal_colorpair_selected;
44 protected:
45 class Sample : public Widget {
46 public:
47 Sample(int w, int fg = -1, int bg = -1);
48 virtual ~Sample() override {}
50 // Widget
51 virtual int draw(Curses::ViewPort area, Error &error) override;
53 virtual void setColors(int fg, int bg);
55 protected:
56 ColorScheme::Color color_;
58 private:
59 CONSUI_DISABLE_COPY(Sample);
62 ColorPickerComboBox *fg_combo_;
63 ColorPickerComboBox *bg_combo_;
64 Label *label_;
65 Sample *sample_;
67 virtual void onColorChanged(ComboBox &activator, int new_color);
69 private:
70 CONSUI_DISABLE_COPY(ColorPicker);
73 } // namespace CppConsUI
75 #endif // COLORPICKER_H
77 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: