Fix build on systems that have a separate libintl library
[centerim5.git] / cppconsui / ListBox.h
blob05b52c2fbf6a442283ac5c736a9cc9d4bf624b1d
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 /// ListBox class.
21 ///
22 /// @ingroup cppconsui
24 #ifndef LISTBOX_H
25 #define LISTBOX_H
27 #include "AbstractListBox.h"
28 #include "HorizontalLine.h"
30 namespace CppConsUI {
32 /// Implementation of AbstractListBox class where widgets are placed vertically.
33 class ListBox : public AbstractListBox {
34 public:
35 ListBox(int w, int h);
36 virtual ~ListBox() override {}
38 // AbstractListBox
39 virtual HorizontalLine *insertSeparator(std::size_t pos) override;
40 virtual HorizontalLine *appendSeparator() override;
41 virtual void insertWidget(std::size_t pos, Widget &widget) override;
42 virtual void appendWidget(Widget &widget) override;
44 virtual int getChildrenHeight() const { return children_height_; };
46 sigc::signal<void, ListBox &, int> signal_children_height_change;
48 protected:
49 /// Total height of all visible children.
50 int children_height_;
52 /// Number of visible children that has their height set to AUTOSIZE.
53 int autosize_children_count_;
55 // Widget
56 virtual void updateArea() override;
58 // Container
59 virtual void onChildMoveResize(
60 Widget &activator, const Rect &oldsize, const Rect &newsize) override;
61 virtual void onChildWishSizeChange(
62 Widget &activator, const Size &oldsize, const Size &newsize) override;
63 virtual void onChildVisible(Widget &activator, bool visible) override;
64 virtual void moveWidget(
65 Widget &widget, Widget &position, bool after) override;
67 virtual void updateChildren(
68 int children_height_change, int autosize_children_count_change);
70 private:
71 CONSUI_DISABLE_COPY(ListBox);
74 } // namespace CppConsUI
76 #endif // LISTBOX_H
78 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: