class Tk::Widget

Attributes

tk_parent[R]
tk_pathname[R]

Public Class Methods

new(tk_parent = Tk.root, options = None) { |options| ... } click to toggle source
# File lib/ffi-tk/widget.rb, line 12
def initialize(tk_parent = Tk.root, options = None)
  if tk_parent.respond_to?(:to_tcl_options?)
    tk_parent, options = Tk.root, tk_parent
  end

  if !options || None == options
    options = {}
  else
    options = options.dup
  end

  @tk_parent = tk_parent

  yield(options) if block_given? && !options[:command]

  command = self.class.tk_command
  Tk.execute(command, assign_pathname, options.to_tcl_options?)
end
tk_command() click to toggle source
# File lib/ffi-tk/widget.rb, line 8
def self.tk_command
  raise NotImplementedError, "Implement in subclass"
end

Public Instance Methods

execute(command, *args) click to toggle source
# File lib/ffi-tk/widget.rb, line 55
def execute(command, *args)
  Tk.execute(tk_pathname, command, *args)
end
execute_only(command, *args) click to toggle source
# File lib/ffi-tk/widget.rb, line 59
def execute_only(command, *args)
  Tk.execute_only(tk_pathname, command, *args)
end
focus(option = None) click to toggle source
# File lib/ffi-tk/widget.rb, line 35
def focus(option = None)
  Focus.focus(self, option)
end
focus_next() click to toggle source
# File lib/ffi-tk/widget.rb, line 39
def focus_next
  Focus.next(self)
end
focus_prev() click to toggle source
# File lib/ffi-tk/widget.rb, line 43
def focus_prev
  Focus.prev(self)
end
lower(below = None) click to toggle source
# File lib/ffi-tk/widget.rb, line 51
def lower(below = None)
  Lower.lower(self, below)
end
raise(above = None) click to toggle source
# File lib/ffi-tk/widget.rb, line 47
def raise(above = None)
  Raise.raise(self, above)
end
to_tcl() click to toggle source
# File lib/ffi-tk/widget.rb, line 31
def to_tcl
  tk_pathname.dump
end

Private Instance Methods

assign_pathname() click to toggle source
# File lib/ffi-tk/widget.rb, line 65
def assign_pathname
  @tk_pathname ||= Tk.register_object(tk_parent, self)
end