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.01"

Class Method Summary collapse

Class Method Details

.get_color(interp, string) ⇒ Object



40
41
42
# File 'lib/ffi-tk/ffi/tk.rb', line 40

def get_color(interp, string)
  XColor.new(Tk_GetColor(interp, Tk_MainWindow(interp), string))
end

.init(interp) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ffi-tk/ffi/tk.rb', line 52

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



44
45
46
47
48
49
50
# File 'lib/ffi-tk/ffi/tk.rb', line 44

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