~ubuntu-branches/ubuntu/trusty/glibmm2.4/trusty

« back to all changes in this revision

Viewing changes to glib/glibmm/main.h

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-03-08 11:46:37 UTC
  • mfrom: (1.2.70)
  • Revision ID: package-import@ubuntu.com-20120308114637-igm0brktjj83b03b
Tags: 2.31.20-0ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
   * optimizations and more efficient system power usage.
92
92
   *
93
93
   * @code
 
94
   * bool timeout_handler() { ... }
94
95
   * Glib::signal_timeout().connect(sigc::ptr_fun(&timeout_handler), 1000);
95
96
   * @endcode
96
97
   * is equivalent to:
97
98
   * @code
 
99
   * bool timeout_handler() { ... }
98
100
   * const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(1000);
99
101
   * timeout_source->connect(sigc::ptr_fun(&timeout_handler));
100
102
   * timeout_source->attach(Glib::MainContext::get_default());
101
103
   * @endcode
102
104
   * @param slot A slot to call when @a interval has elapsed.
 
105
   * If <tt>timeout_handler()</tt> returns <tt>false</tt> the handler is disconnected.
103
106
   * @param interval The timeout in milliseconds.
104
107
   * @param priority The priority of the new event source.
105
108
   * @return A connection handle, which can be used to disconnect the handler.
107
110
  sigc::connection connect(const sigc::slot<bool>& slot, unsigned int interval,
108
111
                           int priority = PRIORITY_DEFAULT);
109
112
 
110
 
 /** Connects an timeout handler that runs only once.
 
113
 /** Connects a timeout handler that runs only once.
111
114
  * This method takes a function pointer to a function with a void return
112
115
  * and no parameters. After running once it is not called again.
113
116
  *
114
 
  * @see connect
 
117
  * @see connect()
115
118
  * @param slot A slot to call when @a interval has elapsed. For example:
116
119
  * @code
117
120
  * void on_timeout_once()
134
137
   * Subsequent timer iterations will generally run at the specified interval.
135
138
   *
136
139
   * @code
137
 
   * Glib::signal_timeout().connect(sigc::ptr_fun(&timeout_handler), 1000);
 
140
   * bool timeout_handler() { ... }
 
141
   * Glib::signal_timeout().connect_seconds(sigc::ptr_fun(&timeout_handler), 5);
138
142
   * @endcode
139
143
   * is equivalent to:
140
144
   * @code
141
 
   * const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(1000);
142
 
   * timeout_source->connectseconds(sigc::ptr_fun(&timeout_handler));
 
145
   * bool timeout_handler() { ... }
 
146
   * const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(5000);
 
147
   * timeout_source->connect(sigc::ptr_fun(&timeout_handler));
143
148
   * timeout_source->attach(Glib::MainContext::get_default());
144
149
   * @endcode
145
150
   * @param slot A slot to call when @a interval has elapsed.
 
151
   * If <tt>timeout_handler()</tt> returns <tt>false</tt> the handler is disconnected.
146
152
   * @param interval The timeout in seconds.
147
153
   * @param priority The priority of the new event source.
148
154
   * @return A connection handle, which can be used to disconnect the handler.
152
158
  sigc::connection connect_seconds(const sigc::slot<bool>& slot, unsigned int interval,
153
159
                           int priority = PRIORITY_DEFAULT);
154
160
 
155
 
 /** Connects an timeout handler that runs only once with whole second
 
161
 /** Connects a timeout handler that runs only once with whole second
156
162
  *  granularity.
157
163
  *
158
164
  * This method takes a function pointer to a function with a void return
159
165
  * and no parameters. After running once it is not called again.
160
166
  *
161
 
  * @see connect_seconds
 
167
  * @see connect_seconds()
162
168
  * @param slot A slot to call when @a interval has elapsed. For example:
163
169
  * @code
164
170
  * void on_timeout_once()
165
171
  * @endcode
166
 
  * @param interval The timeout in milliseconds.
 
172
  * @param interval The timeout in seconds.
167
173
  * @param priority The priority of the new event source.
168
174
  */
169
175
  void connect_seconds_once(const sigc::slot<void>& slot, unsigned int interval,
186
192
 
187
193
  /** Connects an idle handler.
188
194
   * @code
 
195
   * bool idle_handler() { ... }
189
196
   * Glib::signal_idle().connect(sigc::ptr_fun(&idle_handler));
190
197
   * @endcode
191
198
   * is equivalent to:
192
199
   * @code
 
200
   * bool idle_handler() { ... }
193
201
   * const Glib::RefPtr<Glib::IdleSource> idle_source = Glib::IdleSource::create();
194
202
   * idle_source->connect(sigc::ptr_fun(&idle_handler));
195
203
   * idle_source->attach(Glib::MainContext::get_default());
196
204
   * @endcode
197
205
   * @param slot A slot to call when the main loop is idle.
 
206
   * If <tt>idle_handler()</tt> returns <tt>false</tt> the handler is disconnected.
198
207
   * @param priority The priority of the new event source.
199
208
   * @return A connection handle, which can be used to disconnect the handler.
200
209
   */
203
212
 /** Connects an idle handler that runs only once.
204
213
  * This method takes a function pointer to a function with a void return
205
214
  * and no parameters. After running once it is not called again.
 
215
  *
 
216
  * @see connect()
 
217
  * @param slot A slot to call when the main loop is idle. For example:
 
218
  * @code
 
219
  * void on_idle_once()
 
220
  * @endcode
 
221
  * @param priority The priority of the new event source.
206
222
  */
207
223
  void connect_once(const sigc::slot<void>& slot, int priority = PRIORITY_DEFAULT_IDLE);
208
224
 
221
237
  explicit inline SignalIO(GMainContext* context);
222
238
#endif
223
239
 
224
 
  /** Connects an I/O handler.
 
240
  /** Connects an I/O handler that watches a file descriptor.
225
241
   * @code
 
242
   * bool io_handler(Glib::IOCondition io_condition) { ... }
226
243
   * Glib::signal_io().connect(sigc::ptr_fun(&io_handler), fd, Glib::IO_IN | Glib::IO_HUP);
227
244
   * @endcode
228
245
   * is equivalent to:
229
246
   * @code
 
247
   * bool io_handler(Glib::IOCondition io_condition) { ... }
230
248
   * const Glib::RefPtr<Glib::IOSource> io_source = Glib::IOSource::create(fd, Glib::IO_IN | Glib::IO_HUP);
231
249
   * io_source->connect(sigc::ptr_fun(&io_handler));
232
250
   * io_source->attach(Glib::MainContext::get_default());
233
251
   * @endcode
234
252
   * @param slot A slot to call when polling @a fd results in an event that matches @a condition.
235
253
   * The event will be passed as a parameter to @a slot.
236
 
   * If @a io_handler returns <tt>false</tt> the signal is disconnected.
 
254
   * If <tt>io_handler()</tt> returns <tt>false</tt> the handler is disconnected.
237
255
   * @param fd The file descriptor (or a @c HANDLE on Win32 systems) to watch.
238
256
   * @param condition The conditions to watch for.
239
257
   * @param priority The priority of the new event source.
242
260
  sigc::connection connect(const sigc::slot<bool,IOCondition>& slot, int fd,
243
261
                           IOCondition condition, int priority = PRIORITY_DEFAULT);
244
262
 
245
 
  /** Connects an I/O channel.
 
263
  /** Connects an I/O handler that watches an I/O channel.
246
264
   * @code
 
265
   * bool io_handler(Glib::IOCondition io_condition) { ... }
247
266
   * Glib::signal_io().connect(sigc::ptr_fun(&io_handler), channel, Glib::IO_IN | Glib::IO_HUP);
248
267
   * @endcode
249
268
   * is equivalent to:
250
269
   * @code
 
270
   * bool io_handler(Glib::IOCondition io_condition) { ... }
251
271
   * const Glib::RefPtr<Glib::IOSource> io_source = Glib::IOSource::create(channel, Glib::IO_IN | Glib::IO_HUP);
252
272
   * io_source->connect(sigc::ptr_fun(&io_handler));
253
273
   * io_source->attach(Glib::MainContext::get_default());
254
274
   * @endcode
255
275
   * @param slot A slot to call when polling @a channel results in an event that matches @a condition.
256
276
   * The event will be passed as a parameter to @a slot.
257
 
   * If @a io_handler returns <tt>false</tt> the signal is disconnected.
 
277
   * If <tt>io_handler()</tt> returns <tt>false</tt> the handler is disconnected.
258
278
   * @param channel The IOChannel object to watch.
259
279
   * @param condition The conditions to watch for.
260
280
   * @param priority The priority of the new event source.
278
298
#endif
279
299
  /** Connects a child watch handler.
280
300
   * @code
 
301
   * void child_watch_handler(GPid pid, int child_status) { ... }
281
302
   * Glib::signal_child_watch().connect(sigc::ptr_fun(&child_watch_handler), pid);
282
303
   * @endcode
283
 
   * @param slot A slot to call when child @a pid exited.
284
 
   * @param pid The child to watch for.
 
304
   * @param slot A slot to call when child process @a pid exited.
 
305
   * @param pid The child process to watch for.
285
306
   * @param priority The priority of the new event source.
286
307
   * @return A connection handle, which can be used to disconnect the handler.
287
308
   */