1 // Copyright (C) 2012-2015 Petr Pavlu <setup@dagobah.cz>
3 // This file is part of CenterIM.
5 // CenterIM is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // CenterIM is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with CenterIM. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef PLUGINWINDOW_H
19 #define PLUGINWINDOW_H
21 #include <cppconsui/Button.h>
22 #include <cppconsui/CheckBox.h>
23 #include <cppconsui/ComboBox.h>
24 #include <cppconsui/InputDialog.h>
25 #include <cppconsui/MessageDialog.h>
26 #include <cppconsui/SplitDialog.h>
27 #include <cppconsui/TreeView.h>
28 #include <libpurple/purple.h>
30 class PluginWindow
: public CppConsUI::SplitDialog
{
33 virtual ~PluginWindow() override
;
36 virtual void onScreenResized() override
;
39 class AddPluginWindow
: public CppConsUI::Window
{
42 virtual ~AddPluginWindow() override
{}
45 virtual void onScreenResized() override
;
47 // Signal that the user has selected a plugin that he wants to add.
48 sigc::signal
<void, AddPluginWindow
&, PurplePlugin
*> signal_selection
;
51 void onPluginButtonActivate(
52 CppConsUI::Button
&activator
, PurplePlugin
*plugin
);
55 CONSUI_DISABLE_COPY(AddPluginWindow
);
58 class BoolOption
: public CppConsUI::CheckBox
{
60 BoolOption(const char *name
, const char *pref
);
61 virtual ~BoolOption() override
;
66 void onToggle(CppConsUI::CheckBox
&activator
, bool new_state
);
69 CONSUI_DISABLE_COPY(BoolOption
);
72 class StringOption
: public CppConsUI::Button
{
74 StringOption(const char *name
, const char *pref
);
75 virtual ~StringOption() override
;
81 void onActivate(CppConsUI::Button
&activator
);
82 void responseHandler(CppConsUI::InputDialog
&activator
,
83 CppConsUI::AbstractDialog::ResponseType response
);
86 CONSUI_DISABLE_COPY(StringOption
);
89 class IntegerOption
: public CppConsUI::Button
{
91 IntegerOption(const char *name
, const char *pref
);
92 virtual ~IntegerOption() override
;
98 void onActivate(CppConsUI::Button
&activator
);
99 void responseHandler(CppConsUI::InputDialog
&activator
,
100 CppConsUI::AbstractDialog::ResponseType response
);
103 CONSUI_DISABLE_COPY(IntegerOption
);
106 class PathOption
: public CppConsUI::Button
{
108 PathOption(const char *name
, const char *pref
);
109 virtual ~PathOption() override
;
115 void onActivate(CppConsUI::Button
&activator
);
116 void responseHandler(CppConsUI::InputDialog
&activator
,
117 CppConsUI::AbstractDialog::ResponseType response
);
120 CONSUI_DISABLE_COPY(PathOption
);
124 CppConsUI::Button
*parent
;
125 CppConsUI::TreeView::NodeReference parent_reference
;
126 PurplePluginPrefFrame
*frame
;
128 typedef std::map
<PurplePlugin
*, PluginEntry
> PluginEntries
;
130 CppConsUI::TreeView
*treeview_
;
131 PluginEntries plugin_entries_
;
133 CONSUI_DISABLE_COPY(PluginWindow
);
135 void clearPlugin(PurplePlugin
*plugin
);
136 void populatePlugin(PurplePlugin
*plugin
);
138 void addPlugin(CppConsUI::Button
&activator
);
139 void onAddPluginSelection(AddPluginWindow
&activator
, PurplePlugin
*plugin
);
141 void disablePlugin(CppConsUI::Button
&activator
, PurplePlugin
*plugin
);
142 void disablePluginResponseHandler(CppConsUI::MessageDialog
&activator
,
143 CppConsUI::AbstractDialog::ResponseType response
, PurplePlugin
*plugin
);
146 #endif // PLUGINWINDOW_H
148 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: