In Files

  • tk/lib/multi-tk.rb
  • tk/lib/tk.rb
  • tk/lib/tk/ttk_selector.rb
  • tk/tcltklib.c

Class/Module Index [+]

Quicksearch

TclTkLib

wrap methods on TclTkLib : not permit calling TclTkLib module methods

—- initialization —-

Public Class Methods

_conv_listelement(arg) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2735
def _conv_listelement(arg)
  MultiTkIp._conv_listelement(arg)
end
            
_encoding() click to toggle source
Alias for: encoding
_encoding=(name) click to toggle source
Alias for: encoding=
_fromUTF8(p1, p2 = v2) click to toggle source
 
               static VALUE
lib_fromUTF8(argc, argv, self)
    int   argc;
    VALUE *argv;
    VALUE self;
{
    VALUE str, encodename;

    if (rb_scan_args(argc, argv, "11", &str, &encodename) == 1) {
        encodename = Qnil;
    }
    return lib_fromUTF8_core(Qnil, str, encodename);
}
            
_merge_tklist(*args) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2732
def _merge_tklist(*args)
  MultiTkIp._merge_tklist(*args)
end
            
_split_tklist(p1) click to toggle source
 
               static VALUE
lib_split_tklist(self, list_str)
    VALUE self;
    VALUE list_str;
{
    return lib_split_tklist_core(Qnil, list_str);
}
            
_subst_Tcl_backslash(p1) click to toggle source
 
               static VALUE
lib_Tcl_backslash(self, str)
    VALUE self;
    VALUE str;
{
    return lib_UTF_backslash_core(self, str, 1);
}
            
_subst_UTF_backslash(p1) click to toggle source
 
               static VALUE
lib_UTF_backslash(self, str)
    VALUE self;
    VALUE str;
{
    return lib_UTF_backslash_core(self, str, 0);
}
            
_toUTF8(p1, p2 = v2) click to toggle source
 
               static VALUE
lib_toUTF8(argc, argv, self)
    int   argc;
    VALUE *argv;
    VALUE self;
{
    VALUE str, encodename;

    if (rb_scan_args(argc, argv, "11", &str, &encodename) == 1) {
        encodename = Qnil;
    }
    return lib_toUTF8_core(Qnil, str, encodename);
}
            
default_encoding() click to toggle source
Alias for: encoding_name
default_encoding=(name) click to toggle source
 
               # File tk/lib/tk.rb, line 3142
def default_encoding=(name)
  TkCore::INTERP.default_encoding = name
end
            
do_one_event(flag = TclTkLib::EventFlag::ALL) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2701
def do_one_event(flag = TclTkLib::EventFlag::ALL)
  MultiTkIp.do_one_event(flag)
end
            
do_thread_callback(p1 = v1) click to toggle source
 
               static VALUE
lib_thread_callback(argc, argv, self)
    int argc;
    VALUE *argv;
    VALUE self;
{
    struct thread_call_proc_arg *q;
    VALUE proc, th, ret;
    int status;

    if (rb_scan_args(argc, argv, "01", &proc) == 0) {
        proc = rb_block_proc();
    }

    q = (struct thread_call_proc_arg *)ALLOC(struct thread_call_proc_arg);
    /* q = RbTk_ALLOC_N(struct thread_call_proc_arg, 1); */
    q->proc = proc;
    q->done = (int*)ALLOC(int);
    /* q->done = RbTk_ALLOC_N(int, 1); */
    *(q->done) = 0;

    /* create call-proc thread */
    th = rb_thread_create(_thread_call_proc, (void*)q);

    rb_thread_schedule();

    /* start sub-eventloop */
    lib_eventloop_launcher(/* not check root-widget */0, 0,
                           q->done, (Tcl_Interp*)NULL);

    if (RTEST(rb_thread_alive_p(th))) {
        rb_funcall(th, ID_kill, 0);
        ret = Qnil;
    } else {
        ret = rb_protect(_thread_call_proc_value, th, &status);
    }

    xfree(q->done);
    xfree(q);
    /* ckfree((char*)q->done); */
    /* ckfree((char*)q); */

    if (NIL_P(rbtk_pending_exception)) {
        /* return rb_errinfo(); */
        if (status) {
            rb_exc_raise(rb_errinfo());
        }
    } else {
        VALUE exc = rbtk_pending_exception;
        rbtk_pending_exception = Qnil;
        /* return exc; */
        rb_exc_raise(exc);
    }

    return ret;
}
            
encoding() click to toggle source
Also aliased as: _encoding
Alias for: encoding_name
encoding=(name) click to toggle source
 
               # File tk/lib/tk.rb, line 3148
def encoding=(name)
  name = name.name if name.kind_of?(::Encoding) if Tk::WITH_ENCODING
  TkCore::INTERP.encoding = name
end
            
Also aliased as: _encoding=
encoding_name() click to toggle source
 
               # File tk/lib/tk.rb, line 3153
def encoding_name
  TkCore::INTERP.encoding
end
            
Also aliased as: encoding, default_encoding
encoding_obj() click to toggle source
 
               # File tk/lib/tk.rb, line 3159
def encoding_obj
  if Tk::WITH_ENCODING
    Tk::Encoding.tcl2rb_encoding(TkCore::INTERP.encoding)
  else
    TkCore::INTERP.encoding
  end
end
            
encoding_system() click to toggle source
 
               static VALUE
lib_get_system_encoding(self)
    VALUE self;
{
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
    tcl_stubs_check();
    return rb_str_new2(Tcl_GetEncodingName((Tcl_Encoding)NULL));
#else
    return Qnil;
#endif
}
            
encoding_system=(p1) click to toggle source
 
               static VALUE
lib_set_system_encoding(self, enc_name)
    VALUE self;
    VALUE enc_name;
{
#if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 0)
    tcl_stubs_check();

    if (NIL_P(enc_name)) {
        Tcl_SetSystemEncoding((Tcl_Interp *)NULL, (CONST char *)NULL);
        return lib_get_system_encoding(self);
    }

    enc_name = rb_funcall(enc_name, ID_to_s, 0, 0);
    if (Tcl_SetSystemEncoding((Tcl_Interp *)NULL,
                              StringValuePtr(enc_name)) != TCL_OK) {
        rb_raise(rb_eArgError, "unknown encoding name '%s'",
                 RSTRING_PTR(enc_name));
    }

    return enc_name;
#else
    return Qnil;
#endif
}
            
force_default_encoding=(mode) click to toggle source
 
               # File tk/lib/tk.rb, line 3134
def force_default_encoding=(mode)
  TkCore::INTERP.force_default_encoding = mode
end
            
force_default_encoding?() click to toggle source
 
               # File tk/lib/tk.rb, line 3138
def force_default_encoding?
  TkCore::INTERP.force_default_encoding?
end
            
get_eventloop_tick() click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2713
def get_eventloop_tick
  MultiTkIp.get_eventloop_tick
end
            
get_eventloop_weight() click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2725
def get_eventloop_weight
  MultiTkIp.get_eventloop_weight
end
            
get_eventloop_window_mode() click to toggle source
 
               static VALUE
get_eventloop_window_mode(self)
    VALUE self;
{
    if ( ~window_event_mode ) {
      return Qfalse;
    } else {
      return Qtrue;
    }
}
            
get_no_event_wait() click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2719
def get_no_event_wait
  MultiTkIp.get_no_event_wait
end
            
get_release_type_name(*args) click to toggle source
 
               static VALUE
lib_get_reltype_name(self)
    VALUE self;
{
    set_tcltk_version();

    switch(tcltk_version.type) {
    case TCL_ALPHA_RELEASE:
      return rb_str_new2("alpha");
    case TCL_BETA_RELEASE:
      return rb_str_new2("beta");
    case TCL_FINAL_RELEASE:
      return rb_str_new2("final");
    default:
      rb_raise(rb_eRuntimeError, "tcltklib has invalid release type number");
    }

    UNREACHABLE;
}
            
get_version(*args) click to toggle source
 
               static VALUE
lib_getversion(self)
    VALUE self;
{
    set_tcltk_version();

    return rb_ary_new3(4, INT2NUM(tcltk_version.major),
                          INT2NUM(tcltk_version.minor),
                          INT2NUM(tcltk_version.type),
                          INT2NUM(tcltk_version.patchlevel));
}
            
mainloop(check_root = true) click to toggle source

execute Tk_MainLoop

 
               # File tk/lib/multi-tk.rb, line 2695
def mainloop(check_root = true)
  MultiTkIp.mainloop(check_root)
end
            
mainloop_abort_on_exception() click to toggle source
 
               static VALUE
lib_evloop_abort_on_exc(self)
    VALUE self;
{
    if (event_loop_abort_on_exc > 0) {
        return Qtrue;
    } else if (event_loop_abort_on_exc == 0) {
        return Qfalse;
    } else {
        return Qnil;
    }
}
            
mainloop_abort_on_exception=(p1) click to toggle source
 
               static VALUE
lib_evloop_abort_on_exc_set(self, val)
    VALUE self, val;
{
    if (RTEST(val)) {
        event_loop_abort_on_exc =  1;
    } else if (NIL_P(val)) {
        event_loop_abort_on_exc = -1;
    } else {
        event_loop_abort_on_exc =  0;
    }
    return lib_evloop_abort_on_exc(self);
}
            
mainloop_thread?() click to toggle source
 
               static VALUE
lib_evloop_thread_p(self)
    VALUE self;
{
    if (NIL_P(eventloop_thread)) {
        return Qnil;    /* no eventloop */
    } else if (rb_thread_current() == eventloop_thread) {
        return Qtrue;   /* is eventloop */
    } else {
        return Qfalse;  /* not eventloop */
    }
}
            
mainloop_watchdog(check_root = true) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2698
def mainloop_watchdog(check_root = true)
  MultiTkIp.mainloop_watchdog(check_root)
end
            
num_of_mainwindows() click to toggle source
 
               static VALUE
lib_num_of_mainwindows(self)
    VALUE self;
{
#ifdef RUBY_USE_NATIVE_THREAD  /* Ruby 1.9+ !!! */
    return tk_funcall(lib_num_of_mainwindows_core, 0, (VALUE*)NULL, self);
#else
    return lib_num_of_mainwindows_core(self, 0, (VALUE*)NULL);
#endif
}
            
restart(*args) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2728
def restart(*args)
  MultiTkIp.restart(*args)
end
            
set_eventloop_tick(tick) click to toggle source

def ::mainloop_abort_on_exception

MultiTkIp.mainloop_abort_on_exception

end def ::mainloop_abort_on_exception=(mode)

MultiTkIp.mainloop_abort_on_exception=(mode)

end

 
               # File tk/lib/multi-tk.rb, line 2710
def set_eventloop_tick(tick)
  MultiTkIp.set_eventloop_tick(tick)
end
            
set_eventloop_weight(loop_max, no_event_tick) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2722
def set_eventloop_weight(loop_max, no_event_tick)
  MultiTkIp.set_eventloop_weight(loop_max, no_event_tick)
end
            
set_eventloop_window_mode(p1) click to toggle source
 
               static VALUE
set_eventloop_window_mode(self, mode)
    VALUE self;
    VALUE mode;
{

    if (RTEST(mode)) {
      window_event_mode = ~0;
    } else {
      window_event_mode = ~TCL_WINDOW_EVENTS;
    }

    return mode;
}
            
set_max_block_time(p1) click to toggle source
 
               static VALUE
set_max_block_time(self, time)
    VALUE self;
    VALUE time;
{
    struct Tcl_Time tcl_time;
    VALUE divmod;

    switch(TYPE(time)) {
    case T_FIXNUM:
    case T_BIGNUM:
        /* time is micro-second value */
        divmod = rb_funcall(time, rb_intern("divmod"), 1, LONG2NUM(1000000));
        tcl_time.sec  = NUM2LONG(RARRAY_PTR(divmod)[0]);
        tcl_time.usec = NUM2LONG(RARRAY_PTR(divmod)[1]);
        break;

    case T_FLOAT:
        /* time is second value */
        divmod = rb_funcall(time, rb_intern("divmod"), 1, INT2FIX(1));
        tcl_time.sec  = NUM2LONG(RARRAY_PTR(divmod)[0]);
        tcl_time.usec = (long)(NUM2DBL(RARRAY_PTR(divmod)[1]) * 1000000);

    default:
        {
            VALUE tmp = rb_funcall(time, ID_inspect, 0, 0);
            rb_raise(rb_eArgError, "invalid value for time: '%s'",
                     StringValuePtr(tmp));
        }
    }

    Tcl_SetMaxBlockTime(&tcl_time);

    return Qnil;
}
            
set_no_event_wait(tick) click to toggle source
 
               # File tk/lib/multi-tk.rb, line 2716
def set_no_event_wait(tick)
  MultiTkIp.set_no_event_wait(tick)
end