1 // Copyright (C) 2012 Mark Pustjens <pustjens@dds.nl>
2 // Copyright (C) 2012-2015 Petr Pavlu <setup@dagobah.cz>
4 // This file is part of CenterIM.
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/>.
20 /// ColorPickerComboBox class.
22 /// @ingroup cppconsui
24 #ifndef COLORPICKERCOMBOBOX_H
25 #define COLORPICKERCOMBOBOX_H
27 #include "ColorPickerDialog.h"
31 #define COLORPICKER_256COLOR
36 class ColorPickerComboBox
: public ComboBox
{
38 ColorPickerComboBox(int w
, int color
);
39 virtual ~ColorPickerComboBox() override
;
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
;
50 class ColorButton
: public Button
{
52 ColorButton(int color
= -1);
53 virtual ~ColorButton() override
{}
56 virtual int draw(Curses::ViewPort area
, Error
&error
) override
;
62 CONSUI_DISABLE_COPY(ColorButton
);
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
;
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
;
90 #ifdef COLORPICKER_256COLOR
91 ColorPickerDialog
*colorpicker_
;
92 #endif // COLORPICKER_256COLOR
95 CONSUI_DISABLE_COPY(ColorPickerComboBox
);
98 } // namespace CppConsUI
100 #endif // COLORPICKERCOMBOBOX_H
102 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: