Module: FFI::Tk

Extended by:
Library
Defined in:
lib/ffi-tk/ffi/tk.rb,
lib/ffi-tk/version.rb

Defined Under Namespace

Classes: Window, XColor

Constant Summary collapse

VERSION =
"2010.08.23"

Class Method Summary collapse

Class Method Details

.get_color(interp, string) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/ffi-tk/ffi/tk.rb', line 40

def get_color(interp, string)
  if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD
    XColor.new(Tk_GetColor(interp, Tk_MainWindow(interp), string))
  else
    Tcl.thread_sender.thread_send{
      XColor.new(Tk_GetColor(interp, Tk_MainWindow(interp), string))
    }
  end
end

.init(interp) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/ffi-tk/ffi/tk.rb', line 58

def init(interp)
  if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD
    if Tk_Init(interp) == 1
      message = Tcl.Tcl_GetStringResult(interp)
      raise RuntimeError, message
    end
  else
    Tcl.thread_sender.thread_send do
      if Tk_Init(interp) == 1
        message = Tcl.Tcl_GetStringResult(interp)
        raise RuntimeError, message
      end
    end
  end
end

.mainloopObject



50
51
52
53
54
55
56
# File 'lib/ffi-tk/ffi/tk.rb', line 50

def mainloop
  if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD
    Tk_MainLoop()
  else
    Tcl.thread_sender.thread_send{ Tk_MainLoop() }
  end
end