Update list of wide characters
[centerim5.git] / cppconsui / ColorPickerComboBox.h
blob33d2fe2a16220ef2be2579172dc58cfbeb911b19
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 /// ColorPickerComboBox class.
21 ///
22 /// @ingroup cppconsui
24 #ifndef COLORPICKERCOMBOBOX_H
25 #define COLORPICKERCOMBOBOX_H
27 #include "ColorPickerDialog.h"
28 #include "ComboBox.h"
30 #ifdef DEBUG
31 #define COLORPICKER_256COLOR
32 #endif
34 namespace CppConsUI {
36 class ColorPickerComboBox : public ComboBox {
37 public:
38 ColorPickerComboBox(int w, int color);
39 virtual ~ColorPickerComboBox() override;
41 // Widget
42 virtual int draw(Curses::ViewPort area, Error &error) override;
44 virtual void setColor(int new_color);
45 virtual int getColor() { return selected_color_; }
47 sigc::signal<void, ColorPickerComboBox &, int> signal_color_changed;
49 protected:
50 class ColorButton : public Button {
51 public:
52 ColorButton(int color = -1);
53 virtual ~ColorButton() override {}
55 // Widget
56 virtual int draw(Curses::ViewPort area, Error &error) override;
58 protected:
59 int color_;
61 private:
62 CONSUI_DISABLE_COPY(ColorButton);
65 // ComboBox
66 using ComboBox::clearOptions;
67 using ComboBox::addOption;
68 using ComboBox::addOptionPtr;
69 using ComboBox::getSelectedTitle;
70 using ComboBox::getTitle;
71 using ComboBox::setSelectedByData;
72 using ComboBox::setSelectedByDataPtr;
74 // ComboBox
75 virtual void onDropDown(Button &activator) override;
76 virtual void dropDownOk(Button &activator, int new_entry) override;
77 virtual void dropDownClose(Window &window) override
79 ComboBox::dropDownClose(window);
81 #ifdef COLORPICKER_256COLOR
82 virtual void colorPickerOk(ColorPickerDialog &activator,
83 AbstractDialog::ResponseType response, int new_color);
84 virtual void colorPickerClose(Window &window);
85 #endif // COLORPICKER_256COLOR
86 virtual void setSelected(int new_entry) override;
88 int selected_color_;
90 #ifdef COLORPICKER_256COLOR
91 ColorPickerDialog *colorpicker_;
92 #endif // COLORPICKER_256COLOR
94 private:
95 CONSUI_DISABLE_COPY(ColorPickerComboBox);
98 } // namespace CppConsUI
100 #endif // COLORPICKERCOMBOBOX_H
102 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: