Avoid use of curses subpads
[centerim5.git] / cppconsui / CheckBox.h
blob3315acec7c8ee5aa25e8a441326e447d1d40952d
1 /*
2 * Copyright (C) 2010-2013 by CenterIM developers
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 this program. If not, see <http://www.gnu.org/licenses/>.
21 /**
22 * @file
23 * CheckBox class.
25 * @ingroup cppconsui
28 #ifndef __CHECKBOX_H__
29 #define __CHECKBOX_H__
31 #include "Widget.h"
33 namespace CppConsUI
36 /**
37 * CheckBox.
39 class CheckBox
40 : public Widget
42 public:
43 CheckBox(int w, int h, const char *text_ = NULL, bool checked_ = false);
44 explicit CheckBox(const char *text_ = NULL, bool checked_ = false);
45 virtual ~CheckBox();
47 // Widget
48 virtual void draw(Curses::ViewPort area);
50 /**
51 * Sets a new label text and redraws the widget.
53 virtual void setText(const char *new_text);
54 /**
55 * Returns a current label text.
57 virtual const char *getText() const { return text; }
59 virtual void setChecked(bool new_checked);
60 virtual bool isChecked() const { return checked; }
62 /**
63 * Emited signal when a checkbox is pressed/activated.
65 sigc::signal<void, CheckBox&, bool> signal_toggle;
67 protected:
68 char *text;
69 int text_width;
70 int text_height;
71 bool checked;
73 private:
74 CONSUI_DISABLE_COPY(CheckBox);
76 void actionToggle();
78 void declareBindables();
81 } // namespace CppConsUI
83 #endif // __CHECKBOX_H__
85 /* vim: set tabstop=2 shiftwidth=2 textwidth=78 expandtab : */