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
434 435 436 437 438 439 440 |
# File 'ext/gtk2/rbgtkmain.c', line 434
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
442 443 444 445 446 447 448 |
# File 'ext/gtk2/rbgtkmain.c', line 442
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
229 230 231 232 233 |
# File 'ext/gtk2/rbgtkmain.c', line 229
static VALUE
gtk_m_get_current(VALUE self)
{
return GOBJ2RVAL(gtk_grab_get_current());
}
|
.current_event ⇒ Object
397 398 399 400 401 |
# File 'ext/gtk2/rbgtkmain.c', line 397
static VALUE
gtk_m_get_current_event(VALUE self)
{
return GEV2RVAL(gtk_get_current_event());
}
|
.current_event_state ⇒ Object
409 410 411 412 413 414 415 |
# File 'ext/gtk2/rbgtkmain.c', line 409
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
403 404 405 406 407 |
# File 'ext/gtk2/rbgtkmain.c', line 403
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
417 418 419 420 421 422 423 424 |
# File 'ext/gtk2/rbgtkmain.c', line 417
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()
222 223 224 225 226 227 |
# File 'ext/gtk2/rbgtkmain.c', line 222
static VALUE
gtk_m_grab_add(VALUE self, VALUE widget)
{
gtk_grab_add(GTK_WIDGET(RVAL2GOBJ(widget)));
return Qnil;
}
|
.grab_remove(widget) ⇒ Object
235 236 237 238 239 240 |
# File 'ext/gtk2/rbgtkmain.c', line 235
static VALUE
gtk_m_grab_remove(VALUE self, VALUE widget)
{
gtk_grab_remove(GTK_WIDGET(RVAL2GOBJ(widget)));
return Qnil;
}
|
.idle_add ⇒ Object
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'ext/gtk2/rbgtkmain.c', line 313
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
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'ext/gtk2/rbgtkmain.c', line 333
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
352 353 354 355 356 357 358 |
# File 'ext/gtk2/rbgtkmain.c', line 352
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 169 170 171 |
# File 'ext/gtk2/rbgtkmain.c', line 85
static VALUE
gtk_m_init(int argc, VALUE *argv, VALUE self)
{
gint i, gargc;
VALUE argary;
gchar** 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] = RVAL2CSTR(progname);
for (i = 0; i < gargc; i++) {
if (TYPE(RARRAY_PTR(argary)[i]) == T_STRING) {
gargv[i+1] = RVAL2CSTR(RARRAY_PTR(argary)[i]);
}
else {
gargv[i+1] = "";
}
}
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
242 243 244 245 246 247 248 249 250 |
# File 'ext/gtk2/rbgtkmain.c', line 242
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
378 379 380 381 382 383 384 385 386 387 |
# File 'ext/gtk2/rbgtkmain.c', line 378
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
389 390 391 392 393 394 395 |
# File 'ext/gtk2/rbgtkmain.c', line 389
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()
178 179 180 181 182 183 |
# File 'ext/gtk2/rbgtkmain.c', line 178
static VALUE
gtk_m_main(VALUE self)
{
gtk_main();
return Qnil;
}
|
.main_do_event(event) ⇒ Object
210 211 212 213 214 215 |
# File 'ext/gtk2/rbgtkmain.c', line 210
static VALUE
gtk_m_main_do_event(VALUE self, VALUE event)
{
gtk_main_do_event(RVAL2GEV(event));
return event;
}
|
.main_iteration ⇒ Object
198 199 200 201 202 |
# File 'ext/gtk2/rbgtkmain.c', line 198
static VALUE
gtk_m_main_iteration(VALUE self)
{
return CBOOL2RVAL(gtk_main_iteration());
}
|
.main_iteration_do(blocking) ⇒ Object
204 205 206 207 208 |
# File 'ext/gtk2/rbgtkmain.c', line 204
static VALUE
gtk_m_main_iteration_do(VALUE self, VALUE blocking)
{
return CBOOL2RVAL(gtk_main_iteration_do(RVAL2CBOOL(blocking)));
}
|
.main_level ⇒ Object
185 186 187 188 189 |
# File 'ext/gtk2/rbgtkmain.c', line 185
static VALUE
gtk_m_main_level(VALUE self)
{
return INT2FIX(gtk_main_level());
}
|
.main_quit ⇒ Object
191 192 193 194 195 196 |
# File 'ext/gtk2/rbgtkmain.c', line 191
static VALUE
gtk_m_main_quit(VALUE self)
{
gtk_main_quit();
return Qnil;
}
|
.propagate_event(widget, event) ⇒ Object
426 427 428 429 430 431 |
# File 'ext/gtk2/rbgtkmain.c', line 426
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
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'ext/gtk2/rbgtkmain.c', line 252
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
271 272 273 274 275 276 277 |
# File 'ext/gtk2/rbgtkmain.c', line 271
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()
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'ext/gtk2/rbgtkmain.c', line 286
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
305 306 307 308 309 310 311 |
# File 'ext/gtk2/rbgtkmain.c', line 305
static VALUE
timeout_remove(VALUE self, VALUE id)
{
gtk_timeout_remove(NUM2UINT(id));
G_REMOVE_RELATIVE(self, id__timeout_callbacks__, id);
return Qnil;
}
|