Add override specifier where applicable
[centerim5.git] / cppconsui / ColorPickerPalette.h
blob906050092eb8a6752e2b580a842d916d36d453e0
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 this program. If not, see <http://www.gnu.org/licenses/>.
19 /// @file
20 /// ColorPickerPalette class.
21 ///
22 /// @ingroup cppconsui
24 #ifndef COLORPICKERPALETTE_H
25 #define COLORPICKERPALETTE_H
27 #include "Button.h"
28 #include "Container.h"
30 namespace CppConsUI {
32 class ColorPickerPalette : public Container {
33 public:
34 enum Flag {
35 FLAG_HIDE_ANSI = 1 << 0,
36 FLAG_HIDE_GRAYSCALE = 1 << 1,
37 FLAG_HIDE_COLORCUBE = 1 << 2,
40 ColorPickerPalette(int default_color, int flags = 0);
41 virtual ~ColorPickerPalette() override {}
43 /// Signal emitted when a color is selected.
44 sigc::signal<void, ColorPickerPalette &, int> signal_color_selected;
46 protected:
47 class ColorPickerPaletteButton : public Button {
48 public:
49 ColorPickerPaletteButton(int color);
50 virtual ~ColorPickerPaletteButton() override {}
52 // Widget
53 virtual int draw(Curses::ViewPort area, Error &error) override;
55 virtual int getColor() const { return color_; };
57 protected:
58 int color_;
60 private:
61 CONSUI_DISABLE_COPY(ColorPickerPaletteButton);
64 virtual void onSelectColor(Button &activator);
66 virtual void addButton(int x, int y, int color, int default_color);
68 virtual void addAnsi(int default_color);
69 virtual void addGrayscale(int default_color);
70 virtual void addColorCube(int default_color);
72 private:
73 CONSUI_DISABLE_COPY(ColorPickerPalette);
76 } // namespace CppConsUI
78 #endif // COLORPICKERPALETTE_H
80 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: