cwidget
0.5.17
src
cwidget
toplevel.h
Go to the documentation of this file.
1
// toplevel.h -*-c++-*-
2
//
3
// Copyright 2000, 2005, 2007-2008 Daniel Burrows
4
//
5
// This program 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.
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
13
// GNU 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
//
20
30
#ifndef TOPLEVEL_H
31
#define TOPLEVEL_H
32
33
#include <sigc++/signal.h>
34
35
#include <cwidget/generic/util/ref_ptr.h>
36
38
namespace
cwidget
39
{
41
std::string
version
();
42
43
namespace
threads
44
{
45
class
mutex;
46
}
47
48
namespace
widgets
49
{
50
class
widget;
51
}
52
61
namespace
toplevel
62
{
66
class
event
67
{
68
public
:
69
virtual
void
dispatch() = 0;
70
virtual
~
event
();
71
};
72
82
class
slot_event
:
public
event
83
{
84
sigc::slot0<void> the_slot;
85
public
:
86
slot_event
(
const
sigc::slot0<void> &_the_slot)
87
: the_slot(_the_slot)
88
{
89
}
90
91
void
dispatch();
92
};
93
97
void
init
();
98
109
void
install_sighandlers
();
110
116
util::ref_ptr<widgets::widget>
settoplevel
(
const
util::ref_ptr<widgets::widget>
&
widget
);
117
121
void
queuelayout
();
122
124
void
layoutnow
();
125
126
// Main loop handlers:
127
150
void
mainloop
(
int
synch=0);
151
159
void
post_event
(
event
*ev);
160
167
bool
poll
();
168
169
void
exitmain();
170
// Exits the main loop.
171
172
void
redraw();
173
// Redraws the screen completely from scratch
174
176
void
update
();
177
179
void
tryupdate
();
180
184
void
updatecursor
();
185
191
void
suspend
();
192
197
void
suspend_without_signals
();
198
203
void
shutdown
();
204
208
void
resume
();
209
216
int
addtimeout
(
event
*ev,
int
msecs);
217
219
void
deltimeout
(
int
id
);
220
221
void
handleresize();
222
// Does anything needed to handle a window resize event.
223
// FIXME: I --think-- that this is now redundant
224
225
// Return a mutex that is held whenever the main loop is processing
226
// events or drawing the screen. The mutex can be held by other
227
// threads that want to do their own drawing or processing, although
228
// this is highly discouraged (use the event posting system instead
229
// to run code in the main loop).
230
threads::mutex
&get_mutex();
231
242
int
get_suspend_count
();
243
244
extern
sigc::signal0<void> main_hook;
245
// Called right after we finish handling input in the mainloop. Can
246
// be used (eg) to insert extra actions to be performed after all
247
// user-input (aptitude uses this to check for apt errors and pop up a
248
// message about them)
249
}
250
}
251
252
#endif
cwidget::toplevel::init
void init()
Initializes curses and the global state of the cwidget library.
Definition:
toplevel.cc:854
cwidget::toplevel::event
An event in the global event queue.
Definition:
toplevel.h:66
cwidget::toplevel::layoutnow
void layoutnow()
Immediately recalculates the layout of all widgets.
Definition:
toplevel.cc:1104
cwidget::toplevel::addtimeout
int addtimeout(event *ev, int msecs)
Invoke the given event in at least msecs from the current time.
Definition:
toplevel.cc:1300
cwidget::util::ref_ptr
Definition:
ref_ptr.h:19
cwidget::toplevel::shutdown
void shutdown()
Does the same thing as suspend, except that it also destroys the top-level widget.
Definition:
toplevel.cc:1231
cwidget::toplevel::tryupdate
void tryupdate()
Executes any pending draws or redraws.
Definition:
toplevel.cc:1111
cwidget::toplevel::mainloop
void mainloop(int synch)
Start the main event loop.
Definition:
toplevel.cc:1155
cwidget::toplevel::suspend_without_signals
void suspend_without_signals()
Hides all widgets and suspends Curses operation until resume() is called, but does NOT reset the SIGC...
Definition:
toplevel.cc:1193
cwidget::toplevel::get_suspend_count
int get_suspend_count()
Definition:
toplevel.cc:86
cwidget::toplevel::slot_event
An event based on sigc++ slots.
Definition:
toplevel.h:82
cwidget
The namespace containing everything defined by cwidget.
Definition:
columnify.cc:26
cwidget::toplevel::queuelayout
void queuelayout()
Posts a request to recalculate every widget's layout and update the screen.
Definition:
toplevel.cc:1093
cwidget::toplevel::install_sighandlers
void install_sighandlers()
Installs signal handlers to cleanly shut down cwidget.
Definition:
toplevel.cc:1022
cwidget::toplevel::post_event
void post_event(event *ev)
Post the given event to the main event queue.
Definition:
toplevel.cc:229
cwidget::toplevel::suspend
void suspend()
Hides all widgets and suspends Curses operation until resume() is called.
Definition:
toplevel.cc:1213
cwidget::widgets::widget
The basic widget interface.
Definition:
widget.h:107
cwidget::toplevel::poll
bool poll()
Dispatch any events in the event queue.
Definition:
toplevel.cc:1135
cwidget::toplevel::update
void update()
Posts a request to redraw the screen; may be called from any thread.
Definition:
toplevel.cc:1072
cwidget::toplevel::resume
void resume()
Returns to Curses mode after a suspend*, restoring any signal handlers that were modified by the susp...
Definition:
toplevel.cc:1247
cwidget::toplevel::settoplevel
util::ref_ptr< widgets::widget > settoplevel(const util::ref_ptr< widgets::widget > &widget)
Sets the top-level widget to the new value, returning the old top-level widget.
cwidget::threads::mutex
Definition:
threads.h:286
cwidget::toplevel::updatecursor
void updatecursor()
Posts a request to update the cursor location; may be called from any thread.
Definition:
toplevel.cc:1050
cwidget::version
std::string version()
Return the version number of the library.
Definition:
toplevel.cc:64
cwidget::toplevel::deltimeout
void deltimeout(int num)
Delete the event with the given identifier.
Definition:
toplevel.cc:1308
Generated by
1.8.13