Sha256: 5243b82c9ef6966b80e80050e9399f68501db6e29047a5893218c0ac1cf084ed
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
module FFI module Tk extend FFI::Library ffi_lib ::Tk::TK_LIBPATH class XColor < FFI::Struct layout( :pixel, :ulong, :red, :ushort, :green, :ushort, :blue, :ushort, :flags, :char, :pad, :char ) def red self[:red] end def green self[:green] end def blue self[:blue] end end # This is opaque class Window < FFI::Struct end attach_function :Tk_Init, [:pointer], :int attach_function :Tk_MainWindow, [Tcl::Interp], Window attach_function :Tk_GetColor, [Tcl::Interp, Window, name = :string], XColor attach_function :Tk_MainLoop, [], :void module_function 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 def mainloop if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD Tk_MainLoop() else Tcl.thread_sender.thread_send{ Tk_MainLoop() } end end 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffi-tk-2010.08.23 | lib/ffi-tk/ffi/tk.rb |
ffi-tk-2010.08 | lib/ffi-tk/ffi/tk.rb |
ffi-tk-2010.06 | lib/ffi-tk/ffi/tk.rb |