Module: Gtk
- Defined in:
- lib/gtk2/base.rb,
ext/gtk2/rbgtk.c
Defined Under Namespace
Modules: AccelMap, Accelerator, Drag, IconSize, RC, Selection, Stock Classes: Builder, InitError, Printer
Constant Summary collapse
- LOG_DOMAIN =
"Gtk"
- PRIORITY_RESIZE =
INT2FIX(GTK_PRIORITY_RESIZE)
- BINDING_VERSION =
version information
rb_ary_new3(3, INT2FIX(RBGTK_MAJOR_VERSION), INT2FIX(RBGTK_MINOR_VERSION), INT2FIX(RBGTK_MICRO_VERSION))
- BUILD_VERSION =
rb_ary_new3(3, INT2FIX(GTK_MAJOR_VERSION), INT2FIX(GTK_MINOR_VERSION), INT2FIX(GTK_MICRO_VERSION))
- VERSION =
rb_ary_new3(3, INT2FIX(gtk_major_version), INT2FIX(gtk_minor_version), INT2FIX(gtk_micro_version))
- MAJOR_VERSION =
INT2FIX(gtk_major_version)
- MINOR_VERSION =
INT2FIX(gtk_minor_version)
- MICRO_VERSION =
INT2FIX(gtk_micro_version)
- BINARY_AGE =
INT2FIX(gtk_binary_age)
- INTERFACE_AGE =
INT2FIX(gtk_interface_age)
Class Method Summary collapse
-
.check_version(major, minor, micro) ⇒ Object
From Version Information.
- .check_version?(major, minor, micro) ⇒ Boolean
- .current ⇒ Object
- .current_event ⇒ Object
- .current_event_state ⇒ Object
- .current_event_time ⇒ Object
- .default_language ⇒ Object
- .disable_setlocale ⇒ Object
- .events_pending? ⇒ Boolean
- .get_event_widget(*args) ⇒ Object
-
.grab_add(widget) ⇒ Object
We don’t need them.
- .grab_remove(widget) ⇒ Object
- .idle_add ⇒ Object
- .idle_add_priority(priority) ⇒ Object
- .idle_remove(id) ⇒ Object
- .init(*args) ⇒ Object
- .init_add ⇒ Object
- .key_snooper_install ⇒ Object
- .key_snooper_remove(id) ⇒ Object
-
.main ⇒ Object
We don’t need them.
- .main_do_event(event) ⇒ Object
- .main_iteration ⇒ Object
- .main_iteration_do(blocking) ⇒ Object
- .main_level ⇒ Object
- .main_quit ⇒ Object
- .propagate_event(widget, event) ⇒ Object
- .quit_add(main_level) ⇒ Object
- .quit_remove(quit_handler_id) ⇒ Object
- .set_locale ⇒ Object
-
.timeout_add(interval) ⇒ Object
We don’t need this.
- .timeout_remove(id) ⇒ Object
Class Method Details
.check_version(major, minor, micro) ⇒ Object
From Version Information
431 432 433 434 435 436 437 |
# File 'ext/gtk2/rbgtkmain.c', line 431
static VALUE
gtk_m_check_version(VALUE self, VALUE major, VALUE minor, VALUE micro)
{
const gchar *ret;
ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
return ret ? CSTR2RVAL(ret) : Qnil;
}
|
.check_version?(major, minor, micro) ⇒ Boolean
439 440 441 442 443 444 445 |
# File 'ext/gtk2/rbgtkmain.c', line 439
static VALUE
gtk_m_check_version_q(VALUE self, VALUE major, VALUE minor, VALUE micro)
{
const gchar *ret;
ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
return CBOOL2RVAL(ret == NULL);
}
|
.current ⇒ Object
226 227 228 229 230 |
# File 'ext/gtk2/rbgtkmain.c', line 226
static VALUE
gtk_m_get_current(VALUE self)
{
return GOBJ2RVAL(gtk_grab_get_current());
}
|
.current_event ⇒ Object
394 395 396 397 398 |
# File 'ext/gtk2/rbgtkmain.c', line 394
static VALUE
gtk_m_get_current_event(VALUE self)
{
return GEV2RVAL(gtk_get_current_event());
}
|
.current_event_state ⇒ Object
406 407 408 409 410 411 412 |
# File 'ext/gtk2/rbgtkmain.c', line 406
static VALUE
gtk_m_get_current_event_state(VALUE self)
{
GdkModifierType state;
gboolean ret = gtk_get_current_event_state(&state);
return ret ? GFLAGS2RVAL(state, GDK_TYPE_MODIFIER_TYPE) : Qnil;
}
|
.current_event_time ⇒ Object
400 401 402 403 404 |
# File 'ext/gtk2/rbgtkmain.c', line 400
static VALUE
gtk_m_get_current_event_time(VALUE self)
{
return INT2NUM(gtk_get_current_event_time());
}
|
.default_language ⇒ Object
75 76 77 78 79 |
# File 'ext/gtk2/rbgtkmain.c', line 75
static VALUE
gtk_m_get_default_language(VALUE self)
{
return BOXED2RVAL(gtk_get_default_language(), PANGO_TYPE_LANGUAGE);
}
|
.disable_setlocale ⇒ Object
68 69 70 71 72 73 |
# File 'ext/gtk2/rbgtkmain.c', line 68
static VALUE
gtk_m_disable_setlocale(VALUE self)
{
gtk_disable_setlocale();
return Qnil;
}
|
.events_pending? ⇒ Boolean
72 73 74 75 76 |
# File 'ext/gtk2/rbgtk.c', line 72
static VALUE
gtk_m_events_pending(VALUE self)
{
return CBOOL2RVAL(gtk_events_pending());
}
|
.get_event_widget(*args) ⇒ Object
414 415 416 417 418 419 420 421 |
# File 'ext/gtk2/rbgtkmain.c', line 414
static VALUE
gtk_m_get_event_widget(int argc, VALUE *argv, VALUE self)
{
VALUE event;
rb_scan_args(argc, argv, "01", &event);
return GOBJ2RVAL(gtk_get_event_widget(NIL_P(event) ? NULL :RVAL2GEV(event)));
}
|
.grab_add(widget) ⇒ Object
We don’t need them. gtk_true() gtk_false()
219 220 221 222 223 224 |
# File 'ext/gtk2/rbgtkmain.c', line 219
static VALUE
gtk_m_grab_add(VALUE self, VALUE widget)
{
gtk_grab_add(GTK_WIDGET(RVAL2GOBJ(widget)));
return Qnil;
}
|
.grab_remove(widget) ⇒ Object
232 233 234 235 236 237 |
# File 'ext/gtk2/rbgtkmain.c', line 232
static VALUE
gtk_m_grab_remove(VALUE self, VALUE widget)
{
gtk_grab_remove(GTK_WIDGET(RVAL2GOBJ(widget)));
return Qnil;
}
|
.idle_add ⇒ Object
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'ext/gtk2/rbgtkmain.c', line 310
static VALUE
idle_add(VALUE self)
{
VALUE func, rb_id;
callback_info_t *info;
guint id;
func = rb_block_proc();
info = ALLOC(callback_info_t);
info->callback = func;
info->key = id__idle_callbacks__;
id = gtk_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
(GtkFunction)gtk_m_function, NULL,
(gpointer)info, g_free);
info->id = id;
rb_id = UINT2NUM(id);
G_RELATIVE2(self, func, id__idle_callbacks__, rb_id);
return rb_id;
}
|
.idle_add_priority(priority) ⇒ Object
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'ext/gtk2/rbgtkmain.c', line 330
static VALUE
idle_add_priority(VALUE self, VALUE priority)
{
VALUE func, rb_id;
callback_info_t *info;
guint id;
func = rb_block_proc();
info = ALLOC(callback_info_t);
info->callback = func;
info->key = id__idle_callbacks__;
id = gtk_idle_add_full(NUM2INT(priority), (GtkFunction)gtk_m_function,
NULL, (gpointer)info, g_free);
info->id = id;
rb_id = UINT2NUM(id);
G_RELATIVE2(self, func, id__idle_callbacks__, rb_id);
return rb_id;
}
|
.idle_remove(id) ⇒ Object
349 350 351 352 353 354 355 |
# File 'ext/gtk2/rbgtkmain.c', line 349
static VALUE
idle_remove(VALUE self, VALUE id)
{
gtk_idle_remove(NUM2UINT(id));
G_REMOVE_RELATIVE(self, id__idle_callbacks__, id);
return Qnil;
}
|
.init(*args) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'ext/gtk2/rbgtkmain.c', line 85
static VALUE
gtk_m_init(int argc, VALUE *argv, VALUE self)
{
gint i, gargc;
VALUE argary;
char** gargv;
VALUE progname;
if (_initialized)
return self;
else
_initialized = TRUE;
rb_scan_args(argc, argv, "01", &argary);
if (NIL_P(argary)){
argary = rb_const_get(rb_cObject, rb_intern("ARGV"));
gargc = RARRAY_LEN(argary);
} else {
Check_Type(argary, T_ARRAY);
gargc = RARRAY_LEN(argary);
}
gargv = ALLOCA_N(char *, gargc + 1);
progname = rb_gv_get("$0");
gargv[0] = (char *)RVAL2CSTR(progname);
for (i = 0; i < gargc; i++)
if (TYPE(RARRAY_PTR(argary)[i]) == T_STRING)
gargv[i+1] = (char *)RVAL2CSTR(RARRAY_PTR(argary)[i]);
else
gargv[i+1] = (char *)"";
gargc++;
{
gboolean is_initialized;
/* Gdk modifies sighandlers, sigh */
#ifdef NT
RETSIGTYPE (*sigfunc[3])();
#else
RETSIGTYPE (*sigfunc[7])();
#endif
#ifdef NT
sigfunc[0] = signal(SIGINT, SIG_IGN);
sigfunc[1] = signal(SIGSEGV, SIG_IGN);
sigfunc[2] = signal(SIGTERM, SIG_IGN);
#else
sigfunc[0] = signal(SIGHUP, SIG_IGN);
sigfunc[1] = signal(SIGINT, SIG_IGN);
sigfunc[2] = signal(SIGQUIT, SIG_IGN);
sigfunc[3] = signal(SIGBUS, SIG_IGN);
sigfunc[4] = signal(SIGSEGV, SIG_IGN);
sigfunc[5] = signal(SIGPIPE, SIG_IGN);
sigfunc[6] = signal(SIGTERM, SIG_IGN);
#endif
is_initialized = gtk_init_check(&gargc, &gargv);
if (! is_initialized) {
const char *display_name_arg = gdk_get_display_arg_name();
display_name_arg = display_name_arg ? display_name_arg : g_getenv("DISPLAY");
rb_raise(rbgtk_eGtkInitError, "Cannot open display: %s",
display_name_arg ? display_name_arg : " ");
}
setlocale(LC_NUMERIC, "C");
#ifdef NT
signal(SIGINT, (SignalFunc)sigfunc[0]);
signal(SIGSEGV, (SignalFunc)sigfunc[1]);
signal(SIGTERM, (SignalFunc)sigfunc[2]);
#else
signal(SIGHUP, sigfunc[0]);
signal(SIGINT, sigfunc[1]);
signal(SIGQUIT, sigfunc[2]);
signal(SIGBUS, sigfunc[3]);
signal(SIGSEGV, sigfunc[4]);
signal(SIGPIPE, sigfunc[5]);
signal(SIGTERM, sigfunc[6]);
#endif
}
return self;
}
|
.init_add ⇒ Object
239 240 241 242 243 244 245 246 247 |
# File 'ext/gtk2/rbgtkmain.c', line 239
static VALUE
gtk_m_init_add(VALUE self)
{
volatile VALUE func = rb_block_proc();
gtk_init_add((GtkFunction)gtk_m_function2, (gpointer)func);
G_RELATIVE(self, func);
return Qnil;
}
|
.key_snooper_install ⇒ Object
375 376 377 378 379 380 381 382 383 384 |
# File 'ext/gtk2/rbgtkmain.c', line 375
static VALUE
gtk_m_key_snooper_install(VALUE self)
{
VALUE func = rb_block_proc();
VALUE id = INT2FIX(gtk_key_snooper_install(
(GtkKeySnoopFunc)gtk_m_key_snoop_func,
(gpointer)func));
G_RELATIVE2(self, func, id__snooper_callbacks__, id);
return id;
}
|
.key_snooper_remove(id) ⇒ Object
386 387 388 389 390 391 392 |
# File 'ext/gtk2/rbgtkmain.c', line 386
static VALUE
gtk_m_key_snooper_remove(VALUE self, VALUE id)
{
gtk_key_snooper_remove(NUM2UINT(id));
G_REMOVE_RELATIVE(self, id__snooper_callbacks__, id);
return Qnil;
}
|
.main ⇒ Object
We don’t need them. gtk_init() gtk_exit()
175 176 177 178 179 180 |
# File 'ext/gtk2/rbgtkmain.c', line 175
static VALUE
gtk_m_main(VALUE self)
{
gtk_main();
return Qnil;
}
|
.main_do_event(event) ⇒ Object
207 208 209 210 211 212 |
# File 'ext/gtk2/rbgtkmain.c', line 207
static VALUE
gtk_m_main_do_event(VALUE self, VALUE event)
{
gtk_main_do_event(RVAL2GEV(event));
return event;
}
|
.main_iteration ⇒ Object
195 196 197 198 199 |
# File 'ext/gtk2/rbgtkmain.c', line 195
static VALUE
gtk_m_main_iteration(VALUE self)
{
return CBOOL2RVAL(gtk_main_iteration());
}
|
.main_iteration_do(blocking) ⇒ Object
201 202 203 204 205 |
# File 'ext/gtk2/rbgtkmain.c', line 201
static VALUE
gtk_m_main_iteration_do(VALUE self, VALUE blocking)
{
return CBOOL2RVAL(gtk_main_iteration_do(RVAL2CBOOL(blocking)));
}
|
.main_level ⇒ Object
182 183 184 185 186 |
# File 'ext/gtk2/rbgtkmain.c', line 182
static VALUE
gtk_m_main_level(VALUE self)
{
return INT2FIX(gtk_main_level());
}
|
.main_quit ⇒ Object
188 189 190 191 192 193 |
# File 'ext/gtk2/rbgtkmain.c', line 188
static VALUE
gtk_m_main_quit(VALUE self)
{
gtk_main_quit();
return Qnil;
}
|
.propagate_event(widget, event) ⇒ Object
423 424 425 426 427 428 |
# File 'ext/gtk2/rbgtkmain.c', line 423
static VALUE
gtk_m_propagate_event(VALUE self, VALUE widget, VALUE event)
{
gtk_propagate_event(GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2GEV(event));
return Qnil;
}
|
.quit_add(main_level) ⇒ Object
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'ext/gtk2/rbgtkmain.c', line 249
static VALUE
gtk_m_quit_add(VALUE self, VALUE main_level)
{
volatile VALUE func = rb_block_proc();
VALUE rb_id;
callback_info_t *info;
guint id;
info = ALLOC(callback_info_t);
info->callback = func;
info->key = id_relative_callbacks;
id = gtk_quit_add_full(NUM2UINT(main_level), (GtkFunction)gtk_m_function,
NULL, (gpointer)info, g_free);
info->id = id;
rb_id = UINT2NUM(id);
G_RELATIVE2(self, func, id__quit_callbacks__, rb_id);
return rb_id;
}
|
.quit_remove(quit_handler_id) ⇒ Object
268 269 270 271 272 273 274 |
# File 'ext/gtk2/rbgtkmain.c', line 268
static VALUE
gtk_m_quit_remove(VALUE self, VALUE quit_handler_id)
{
gtk_quit_remove(NUM2UINT(quit_handler_id));
G_REMOVE_RELATIVE(self, id__quit_callbacks__, quit_handler_id);
return quit_handler_id;
}
|
.set_locale ⇒ Object
62 63 64 65 66 |
# File 'ext/gtk2/rbgtkmain.c', line 62
static VALUE
gtk_m_set_locale(VALUE self)
{
return CSTR2RVAL(gtk_set_locale());
}
|
.timeout_add(interval) ⇒ Object
We don’t need this. gtk_quit_add_full () gtk_quit_add_destroy() gtk_quit_remove_by_data() gtk_timeout_add_full()
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'ext/gtk2/rbgtkmain.c', line 283
static VALUE
timeout_add(VALUE self, VALUE interval)
{
VALUE func, rb_id;
callback_info_t *info;
guint id;
func = rb_block_proc();
info = ALLOC(callback_info_t);
info->callback = func;
info->key = id__timeout_callbacks__;
id = gtk_timeout_add_full(NUM2UINT(interval), (GtkFunction)gtk_m_function,
NULL, (gpointer)info, g_free);
info->id = id;
rb_id = UINT2NUM(id);
G_RELATIVE2(self, func, id__timeout_callbacks__, rb_id);
return rb_id;
}
|
.timeout_remove(id) ⇒ Object
302 303 304 305 306 307 308 |
# File 'ext/gtk2/rbgtkmain.c', line 302
static VALUE
timeout_remove(VALUE self, VALUE id)
{
gtk_timeout_remove(NUM2UINT(id));
G_REMOVE_RELATIVE(self, id__timeout_callbacks__, id);
return Qnil;
}
|