1 // Copyright (C) 2007 Mark Pustjens <pustjens@dds.nl>
2 // Copyright (C) 2010-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 /// AbstractListBox class.
22 /// @ingroup cppconsui
24 #ifndef ABSTRACTLISTBOX_H
25 #define ABSTRACTLISTBOX_H
27 #include "AbstractLine.h"
29 #include "Container.h"
33 /// Abstract class that defines common interface for ListBox and
34 /// HorizontalListBox.
35 class AbstractListBox
: public Container
{
37 AbstractListBox(int w
, int h
);
38 virtual ~AbstractListBox() override
{}
40 /// Inserts a new button into ListBox before a given position.
41 virtual Button
*insertItem(std::size_t pos
, const char *title
,
42 const sigc::slot
<void, Button
&> &callback
);
44 /// Adds a new button in the end of ListBox.
45 virtual Button
*appendItem(
46 const char *title
, const sigc::slot
<void, Button
&> &callback
);
48 /// Inserts a separator (usually a horizontal or vertical line) into the
49 /// ListBox before a given position.
50 virtual AbstractLine
*insertSeparator(std::size_t pos
) = 0;
52 /// Appends a separator (usually a horizontal or vertical line) into the
54 virtual AbstractLine
*appendSeparator() = 0;
56 /// Inserts a widget into the ListBox before a given position.
57 virtual void insertWidget(std::size_t pos
, Widget
&widget
) = 0;
59 /// Appends a widget into the ListBox.
60 virtual void appendWidget(Widget
&widget
) = 0;
64 using Container::addWidget
;
67 CONSUI_DISABLE_COPY(AbstractListBox
);
70 } // namespace CppConsUI
72 #endif // ABSTRACTLISTBOX_H
74 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: