Update list of wide characters
[centerim5.git] / cppconsui / AbstractListBox.cpp
blob6f98da13e4f0a295c91d6035b81b283be5bfad3e
1 // Copyright (C) 2007 Mark Pustjens <pustjens@dds.nl>
2 // Copyright (C) 2010-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 /// AbstractListBox class implementation.
21 ///
22 /// @ingroup cppconsui
24 #include "AbstractListBox.h"
26 namespace CppConsUI {
28 AbstractListBox::AbstractListBox(int w, int h) : Container(w, h)
32 Button *AbstractListBox::insertItem(std::size_t pos, const char *title,
33 const sigc::slot<void, Button &> &callback)
35 auto b = new Button(Curses::onScreenWidth(title), 1, title);
36 b->signal_activate.connect(callback);
37 insertWidget(pos, *b);
38 return b;
41 Button *AbstractListBox::appendItem(
42 const char *title, const sigc::slot<void, Button &> &callback)
44 auto b = new Button(Curses::onScreenWidth(title), 1, title);
45 b->signal_activate.connect(callback);
46 appendWidget(*b);
47 return b;
50 } // namespace CppConsUI
52 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: