cwidget  0.5.18
dialogs.h
Go to the documentation of this file.
1 // dialogs.h -*-c++-*-
2 //
3 // Copyright (C) 2000, 2007-2008 Daniel Burrows
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of
8 // the License, or (at your option) any later version.
9 //
10 // This program 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 GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; see the file COPYING. If not, write to
17 // the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 // Boston, MA 02111-1307, USA.
19 
28 #ifndef DIALOGS_H
29 #define DIALOGS_H
30 
31 #include <cwidget/widgets/editline.h> // for editline::history_list
32 
34 
35 #include <string>
36 
37 namespace cwidget
38 {
39  class fragment;
40  class style;
41 
42  namespace widgets
43  {
44  class pager;
45  class widget;
46  }
47 
49  namespace dialogs
50  {
51  // Canned dialog-boxes:
52 
64  widgets::widget_ref ok(const widgets::widget_ref &widget,
65  util::slot0arg okslot, const std::wstring &label,
66  const style &st);
67 
68  widgets::widget_ref ok(fragment *msg, util::slot0arg okslot = nullptr, bool scrollbar=false);
69  widgets::widget_ref ok(fragment *msg, util::slot0arg okslot, const style &st, bool scrollbar=false);
70  widgets::widget_ref ok(fragment *msg, util::slot0arg okslot, const std::wstring &label,
71  const style &st, bool scrollbar=false);
72 
73  widgets::widget_ref ok(const std::wstring &msg, util::slot0arg okslot = nullptr);
74  widgets::widget_ref ok(const std::wstring &msg, util::slot0arg okslot,
75  const style &st);
76  widgets::widget_ref ok(const std::wstring &msg, util::slot0arg okslot, const std::wstring &label,
77  const style &st);
78 
97  widgets::widget_ref yesno(const widgets::widget_ref &widget,
98  util::slot0arg yesslot,
99  const std::wstring &yeslabel,
100  util::slot0arg noslot,
101  const std::wstring &nolabel,
102  const style &st,
103  bool deflt=true);
104 
105  widgets::widget_ref yesno(fragment *msg,
106  util::slot0arg yesslot,
107  util::slot0arg noslot,
108  bool scrollbar=false,
109  bool deflt=true);
110  widgets::widget_ref yesno(fragment *msg,
111  util::slot0arg yesslot,
112  util::slot0arg noslot,
113  const style &st,
114  bool scrollbar=false,
115  bool deflt=true);
116  widgets::widget_ref yesno(fragment *msg,
117  util::slot0arg yesslot,
118  const std::wstring &yeslabel,
119  util::slot0arg noslot,
120  const std::wstring &nolabel,
121  const style &st,
122  bool scrollbar=false,
123  bool deflt=true);
124 
125  widgets::widget_ref yesno(const std::wstring &msg,
126  util::slot0arg yesslot,
127  util::slot0arg noslot,
128  bool deflt=true);
129  widgets::widget_ref yesno(const std::wstring &msg,
130  util::slot0arg yesslot,
131  util::slot0arg noslot,
132  const style &st,
133  bool deflt=true);
134  widgets::widget_ref yesno(const std::wstring &msg,
135  util::slot0arg yesslot,
136  const std::wstring &yeslabel,
137  util::slot0arg noslot,
138  const std::wstring &nolabel,
139  const style &st,
140  bool deflt=true);
141 
142  widgets::widget_ref fileview(const std::string &fn,
143  util::slot0arg okslot = nullptr,
144  util::slotarg<sigc::slot1<void, widgets::pager &> > search_slot = nullptr,
145  util::slotarg<sigc::slot1<void, widgets::pager &> > repeat_search_slot = nullptr,
146  util::slotarg<sigc::slot1<void, widgets::pager &> > repeat_search_back_slot = nullptr,
147  const char *encoding = nullptr);
148  widgets::widget_ref fileview(const std::string &fn,
149  util::slot0arg okslot,
150  util::slotarg<sigc::slot1<void, widgets::pager &> > search_slot,
151  util::slotarg<sigc::slot1<void, widgets::pager &> > repeat_search_slot,
152  util::slotarg<sigc::slot1<void, widgets::pager &> > repeat_search_back_slot,
153  const style &st,
154  const char *encoding = nullptr);
155 
156  widgets::widget_ref string(fragment *msg,
157  const std::wstring &deflt,
158  util::slotarg<sigc::slot1<void, std::wstring> > okslot,
159  util::slotarg<sigc::slot0<void> > cancel_slot,
160  util::slotarg<sigc::slot1<void, std::wstring> > changed_slot,
161  widgets::editline::history_list *history,
162  const style &st);
163 
164  widgets::widget_ref string(const std::wstring &msg,
165  const std::wstring &deflt,
166  util::slotarg<sigc::slot1<void, std::wstring> > okslot,
167  util::slotarg<sigc::slot0<void> > cancel_slot,
168  util::slotarg<sigc::slot1<void, std::wstring> > changed_slot,
169  widgets::editline::history_list *history,
170  const style &st);
171 
172  widgets::widget_ref string(const std::wstring &msg,
173  const std::wstring &deflt,
174  util::slotarg<sigc::slot1<void, std::wstring> > slot,
175  util::slotarg<sigc::slot0<void> > cancel_slot,
176  util::slotarg<sigc::slot1<void, std::wstring> > changed_slot,
177  widgets::editline::history_list *history);
178  }
179 }
180 
181 #endif
cwidget::util::ref_ptr
Definition: ref_ptr.h:19
dialogs.h
Utility functions to construct prefabricated widgets.
cwidget::widgets::text_layout::create
static util::ref_ptr< text_layout > create()
Create an empty text_layout.
Definition: text_layout.h:56
cwidget::config::global_bindings
keybindings global_bindings
The global keybindings object.
Definition: keybindings.cc:43
cwidget::util::slotarg< sigc::slot0< void > >
cwidget::style_attrs_flip
style style_attrs_flip(attr_t attrs)
Definition: style.h:235
slotarg.h
Provides a simple mechanism for passing in optional slots to a function.
cwidget::widgets::text_layout::scroll
void scroll(bool dir)
Page based on a scrollbar signal.
Definition: text_layout.cc:335
keybindings.h
Support for defining and remapping keybindings.
cwidget::util::ref_ptr::unsafe_get_ref
T * unsafe_get_ref() const
Extract the pointer.
Definition: ref_ptr.h:159
cwidget::dialogs::ok
widget_ref ok(const widget_ref &w, slot0arg okslot, const std::wstring &label, const style &st)
Create a dialog box with a single button.
Definition: dialogs.cc:60
cwidget::dialogs::yesno
widget_ref yesno(const widget_ref &widget, slot0arg yesslot, const std::wstring &yeslabel, slot0arg noslot, const std::wstring &nolabel, const style &st, bool deflt)
Create a dialog box with two buttons, labelled "yes" and "no".
Definition: dialogs.cc:137
cwidget::widgets::label
label widgets display some (possibly formatted) text statically.
Definition: label.h:24
cwidget::style
A "style" is a setting to be applied to a display element (widget, text, etc).
Definition: style.h:51
cwidget::fragment
A fragment represents a logical unit of text.
Definition: fragment.h:37
cwidget::widgets::table
Definition: table.h:18
cwidget::util::slot0arg
slotarg< sigc::slot0< void > > slot0arg
Convenience typedefs for slot arguments that take no parameters and return nothing.
Definition: slotarg.h:83
colors.h
Routines to support independently changing foreground and background colors.
cwidget::widgets::pager::scroll_page
void scroll_page(bool dir)
Scroll by a page in the given direction.
Definition: pager.cc:224
cwidget
The namespace containing everything defined by cwidget.
Definition: columnify.cc:27
cwidget::widgets::frame
Definition: frame.h:15
cwidget::widgets::center
Definition: center.h:14
cwidget::widgets::scrollbar
Definition: scrollbar.h:30
cwidget::widgets::widget
The basic widget interface.
Definition: widget.h:106
cwidget::widgets::widget::set_bg_style
void set_bg_style(const style &new_style)
Update this widget's basic style to the given value.
Definition: widget.cc:53