Fix build on systems that have a separate libintl library
[centerim5.git] / cppconsui / ColorPickerDialog.cpp
blob5730c8bb5b06c60f159f849b32183ab5f48e361c
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 /// ColorPickerDialog class implementation.
21 ///
22 /// @ingroup cppconsui
24 #include "ColorPickerDialog.h"
26 #include "gettext.h"
28 namespace CppConsUI {
30 ColorPickerDialog::ColorPickerDialog(
31 const char *title, int default_color, int flags)
32 : AbstractDialog(title)
34 addButton(OK_BUTTON_TEXT, RESPONSE_OK);
36 auto pick = new ColorPickerPalette(default_color, flags);
37 layout_->insertWidget(0, *pick);
38 pick->signal_color_selected.connect(
39 sigc::mem_fun(this, &ColorPickerDialog::onColorSelected));
41 resize(pick->getWidth() + 2, pick->getHeight() + 4);
44 void ColorPickerDialog::onColorSelected(
45 ColorPickerPalette & /*activator*/, int new_color)
47 color_ = new_color;
48 response(RESPONSE_OK);
51 void ColorPickerDialog::emitResponse(ResponseType response)
53 signal_response(*this, response, color_);
56 } // namespace CppConsUI
58 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: