Class | TkWindow
In: | tk/lib/tkextlib/tktrans/tktrans.rb tk/lib/tkextlib/tkDND/tkdnd.rb tk/lib/tkextlib/tkDND/shape.rb tk/lib/tkextlib/tcllib/cursor.rb tk/lib/tk.rb
Parent: | Object

### Methods

bind_class bindtags bindtags= bindtags_shift bindtags_unshift caret colormodel command current_grab cursor_propagate cursor_restore database_class database_class database_classname database_classname destroy eventloop_tkwait eventloop_tkwait_destroy eventloop_tkwait_visibility eventloop_tkwait_window eventloop_wait eventloop_wait_destroy eventloop_wait_visibility eventloop_wait_window exist? focus grab grab_current grab_release grab_set grab_set_global grab_status grid grid_bbox grid_columnconfig grid_columnconfiginfo grid_columnconfigure grid_config grid_configure grid_forget grid_in grid_info grid_location grid_propagate grid_remove grid_rowconfig grid_rowconfiginfo grid_rowconfigure grid_size grid_slaves lower lower_window new pack pack_config pack_configure pack_forget pack_in pack_info pack_propagate pack_slaves place place_config place_configinfo place_configure place_forget place_in place_info place_slaves raise raise_window release_grab set_focus set_global_grab set_grab thread_tkwait thread_tkwait_destroy thread_tkwait_visibility thread_tkwait_window thread_wait thread_wait_destroy thread_wait_visibility thread_wait_window tktrans_get_image tktrans_set_image tkwait tkwait_destroy tkwait_window to_eval ungrid unpack unplace wait wait_destroy wait_visibility wait_window

### Included Modules

Tk::TkDND::DND Tk::TkDND::Shape TkWinfo

### Constants

TkCommandNames | = | [].freeze
WidgetClassName | = | ''.freeze |  | ## > If TkCommandNames[0] is a string (not a null string),
        assume the string is a Tcl/Tk's create command of the widget class.

### Public Class methods

database_class()

[Source]

    # File tk/lib/tk.rb, line 3947
      def self.database_class
        WidgetClassNames[self::WidgetClassName]
      end

database_classname()

[Source]

    # File tk/lib/tk.rb, line 3944
      def self.database_classname
        self::WidgetClassName
      end

new(parent=nil, keys=nil)

[Source]

    # File tk/lib/tk.rb, line 3834
      def initialize(parent=nil, keys=nil)
        if parent.kind_of? Hash
          keys = _symbolkey2str(parent)
          parent = keys.delete('parent')
          widgetname = keys.delete('widgetname')
          install_win(if parent then parent.path end, widgetname)
          without_creating = keys.delete('without_creating')
          # if without_creating && !widgetname
          #   fail ArgumentError,
          #        "if set 'without_creating' to true, need to define 'widgetname'"
          # end
        elsif keys
          keys = _symbolkey2str(keys)
          widgetname = keys.delete('widgetname')
          install_win(if parent then parent.path end, widgetname)
          without_creating = keys.delete('without_creating')
          # if without_creating && !widgetname
          #   fail ArgumentError,
          #        "if set 'without_creating' to true, need to define 'widgetname'"
          # end
        else
          install_win(if parent then parent.path end)
        end
        if self.method(:create_self).arity == 0
          p 'create_self has no arg' if $DEBUG
          create_self unless without_creating
          if keys
            # tk_call @path, 'configure', *hash_kv(keys)
            configure(keys)
          end
        else
          p 'create_self has args' if $DEBUG
          fontkeys = {}
          methodkeys = {}
          if keys
            #['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
            #  fontkeys[key] = keys.delete(key) if keys.key?(key)
            #}
            __font_optkeys.each{|key|
              fkey = key.to_s
              fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)

              fkey = "kanji#{key}"
              fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)

              fkey = "latin#{key}"
              fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)

              fkey = "ascii#{key}"
              fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
            }

            __methodcall_optkeys.each{|key|
              key = key.to_s
              methodkeys[key] = keys.delete(key) if keys.key?(key)
            }

            __ruby2val_optkeys.each{|key, method|
              key = key.to_s
              keys[key] = method.call(keys[key]) if keys.has_key?(key)
            }
          end
          if without_creating && keys
            #configure(keys)
            configure(__conv_keyonly_opts(keys))
          else
            #create_self(keys)
            create_self(__conv_keyonly_opts(keys))
          end
          font_configure(fontkeys) unless fontkeys.empty?
          configure(methodkeys) unless methodkeys.empty?
        end
      end

to_eval()

WidgetClassNames[WidgetClassName] = self

     ==> If self is a widget class, entry to the WidgetClassNames table.

[Source]

    # File tk/lib/tk.rb, line 3830
      def self.to_eval
        self::WidgetClassName
      end

### Public Instance methods

bind_class()

[Source]

    # File tk/lib/tk.rb, line 3929
      def bind_class
        @db_class || self.class()
      end

bindtags(taglist=nil)

[Source]

    # File tk/lib/tk.rb, line 4396
      def bindtags(taglist=nil)
        if taglist
          fail ArgumentError, "taglist must be Array" unless taglist.kind_of? Array
          tk_call('bindtags', path, taglist)
          taglist
        else
          list(tk_call('bindtags', path)).collect{|tag|
            if tag.kind_of?(String)
              if cls = WidgetClassNames[tag]
                cls
              elsif btag = TkBindTag.id2obj(tag)
                btag
              else
                tag
              end
            else
              tag
            end
          }
        end
      end

bindtags=(taglist)

[Source]

    # File tk/lib/tk.rb, line 4418
      def bindtags=(taglist)
        bindtags(taglist)
        taglist
      end

bindtags_shift()

[Source]

    # File tk/lib/tk.rb, line 4423
      def bindtags_shift
        taglist = bindtags
        tag = taglist.shift
        bindtags(taglist)
        tag
      end

bindtags_unshift(tag)

[Source]

    # File tk/lib/tk.rb, line 4430
      def bindtags_unshift(tag)
        bindtags(bindtags().unshift(tag))
      end

caret(keys=nil)

[Source]

    # File tk/lib/tk.rb, line 4307
      def caret(keys=nil)
        TkXIM.caret(path, keys)
      end

colormodel(model=None)

[Source]

    # File tk/lib/tk.rb, line 4302
      def colormodel(model=None)
        tk_call('tk', 'colormodel', path, model)
        self
      end

command(cmd=nil, &b)

[Source]

    # File tk/lib/tk.rb, line 4292
      def command(cmd=nil, &b)
        if cmd
          configure_cmd('command', cmd)
        elsif b
          configure_cmd('command', Proc.new(&b))
        else
          cget('command')
        end
      end

current_grab()

Alias for grab_current

cursor_propagate(cursor)

[Source]

    # File tk/lib/tkextlib/tcllib/cursor.rb, line 56
      def cursor_propagate(cursor)
        # Sets the cursor for self and all its descendants to cursor.
        #tk_call_without_enc('::cursor::propagate', @path, cursor)
        Tk::Tcllib::Cursor.cursor_propagate(self, cursor)
      end

cursor_restore(cursor = None)

[Source]

    # File tk/lib/tkextlib/tcllib/cursor.rb, line 61
      def cursor_restore(cursor = None)
        # Restore the original or previously set cursor for self and all its
        # descendants. If cursor is specified, that will be used if on any
        # widget that did not have a preset cursor (set by a previous call
        # to TkWindow#cursor_propagate).
        #tk_call_without_enc('::cursor::restore', @path, cursor)
        Tk::Tcllib::Cursor.cursor_restore(self, cursor)
      end

database_class()

[Source]

    # File tk/lib/tk.rb, line 3936
      def database_class
        name = database_classname()
        if WidgetClassNames[name]
          WidgetClassNames[name]
        else
          TkDatabaseClass.new(name)
        end
      end

database_classname()

[Source]

    # File tk/lib/tk.rb, line 3933
      def database_classname
        TkWinfo.classname(self)
      end

destroy()

[Source]

    # File tk/lib/tk.rb, line 4311
      def destroy
        super
        children = []
        rexp = /^#{self.path}\.[^.]+$/
        TkCore::INTERP.tk_windows.each{|path, obj|
          children << [path, obj] if path =~ rexp
        }
        if defined?(@cmdtbl)
          for id in @cmdtbl
            uninstall_cmd id
          end
        end

        children.each{|path, obj|
          if defined?(@cmdtbl)
            for id in @cmdtbl
              uninstall_cmd id
            end
          end
          TkCore::INTERP.tk_windows.delete(path)
        }

        begin
          tk_call_without_enc('destroy', epath)
        rescue
        end
        uninstall_win
      end

eventloop_tkwait()

Alias for eventloop_wait_visibility

eventloop_tkwait_destroy()

Alias for eventloop_wait_destroy

eventloop_tkwait_visibility()

Alias for eventloop_wait_visibility

eventloop_tkwait_window()

Alias for eventloop_wait_destroy

eventloop_wait()

Alias for eventloop_wait_visibility

eventloop_wait_destroy()

[Source]

    # File tk/lib/tk.rb, line 4378
      def eventloop_wait_destroy
        wait_destroy(false)
      end

eventloop_wait_visibility()

[Source]

    # File tk/lib/tk.rb, line 4351
      def eventloop_wait_visibility
        wait_visibility(false)
      end

eventloop_wait_window()

Alias for eventloop_wait_destroy

exist?()

[Source]

    # File tk/lib/tk.rb, line 3925
      def exist?
        TkWinfo.exist?(self)
      end

focus(force=false)

Alias for set_focus

grab(opt = nil)

[Source]

    # File tk/lib/tk.rb, line 4230
      def grab(opt = nil)
        unless opt
          tk_call_without_enc('grab', 'set', path)
          return self
        end

        case opt
        when 'set', :set
          tk_call_without_enc('grab', 'set', path)
          return self
        when 'global', :global
          #return(tk_call('grab', 'set', '-global', path))
          tk_call_without_enc('grab', 'set', '-global', path)
          return self
        when 'release', :release
          #return tk_call('grab', 'release', path)
          tk_call_without_enc('grab', 'release', path)
          return self
        when 'current', :current
          return window(tk_call_without_enc('grab', 'current', path))
        when 'status', :status
          return tk_call_without_enc('grab', 'status', path)
        else
          return tk_call_without_enc('grab', opt, path)
        end
      end

grab_current()

[Source]

    # File tk/lib/tk.rb, line 4257
      def grab_current
        grab('current')
      end

grab_release()

[Source]

    # File tk/lib/tk.rb, line 4261
      def grab_release
        grab('release')
      end

grab_set()

[Source]

    # File tk/lib/tk.rb, line 4265
      def grab_set
        grab('set')
      end

grab_set_global()

[Source]

    # File tk/lib/tk.rb, line 4269
      def grab_set_global
        grab('global')
      end

grab_status()

[Source]

    # File tk/lib/tk.rb, line 4273
      def grab_status
        grab('status')
      end

grid(keys = nil)

[Source]

    # File tk/lib/tk.rb, line 4024
      def grid(keys = nil)
        #tk_call 'grid', epath, *hash_kv(keys)
        if keys
          TkGrid.configure(self, keys)
        else
          TkGrid.configure(self)
        end
        self
      end

grid_bbox(*args)

[Source]

    # File tk/lib/tk.rb, line 4053
      def grid_bbox(*args)
        #list(tk_call('grid', 'bbox', epath, *args))
        TkGrid.bbox(self, *args)
      end

grid_columnconfig(index, keys)

[Source]

    # File tk/lib/tk.rb, line 4072
      def grid_columnconfig(index, keys)
        #tk_call('grid', 'columnconfigure', epath, index, *hash_kv(keys))
        TkGrid.columnconfigure(self, index, keys)
      end

grid_columnconfiginfo(index, slot=nil)

[Source]

    # File tk/lib/tk.rb, line 4084
      def grid_columnconfiginfo(index, slot=nil)
        #if slot
        #  tk_call('grid', 'columnconfigure', epath, index, "-#{slot}").to_i
        #else
        #  ilist = list(tk_call('grid', 'columnconfigure', epath, index))
        #  info = {}
        #  while key = ilist.shift
        #   info[key[1..-1]] = ilist.shift
        #  end
        #  info
        #end
        TkGrid.columnconfiginfo(self, index, slot)
      end

grid_columnconfigure(index, keys)

Alias for grid_columnconfig

grid_config(slot, value=None)

[Source]

    # File tk/lib/tk.rb, line 4058
      def grid_config(slot, value=None)
        #if slot.kind_of? Hash
        #  tk_call 'grid', 'configure', epath, *hash_kv(slot)
        #else
        #  tk_call 'grid', 'configure', epath, "-#{slot}", value
        #end
        if slot.kind_of? Hash
          TkGrid.configure(self, slot)
        else
          TkGrid.configure(self, slot=>value)
        end
      end

grid_configure(slot, value=None)

Alias for grid_config

grid_forget()

[Source]

    # File tk/lib/tk.rb, line 4046
      def grid_forget
        #tk_call('grid', 'forget', epath)
        TkGrid.forget(self)
        self
      end

grid_in(target, keys = nil)

[Source]

    # File tk/lib/tk.rb, line 4034
      def grid_in(target, keys = nil)
        if keys
          keys = keys.dup
          keys['in'] = target
        else
          keys = {'in'=>target}
        end
        #tk_call 'grid', epath, *hash_kv(keys)
        TkGrid.configure(self, keys)
        self
      end

grid_info()

[Source]

    # File tk/lib/tk.rb, line 4112
      def grid_info()
        #list(tk_call('grid', 'info', epath))
        TkGrid.info(self)
      end

grid_location(x, y)

[Source]

    # File tk/lib/tk.rb, line 4117
      def grid_location(x, y)
        #list(tk_call('grid', 'location', epath, x, y))
        TkGrid.location(self, x, y)
      end

grid_propagate(mode=None)

[Source]

    # File tk/lib/tk.rb, line 4122
      def grid_propagate(mode=None)
        #if mode == None
        #  bool(tk_call('grid', 'propagate', epath))
        #else
        #  tk_call('grid', 'propagate', epath, mode)
        #  self
        #end
        if mode == None
          TkGrid.propagate(self)
        else
          TkGrid.propagate(self, mode)
          self
        end
      end

grid_remove()

[Source]

    # File tk/lib/tk.rb, line 4137
      def grid_remove()
        #tk_call 'grid', 'remove', epath
        TkGrid.remove(self)
        self
      end

grid_rowconfig(index, keys)

[Source]

    # File tk/lib/tk.rb, line 4078
      def grid_rowconfig(index, keys)
        #tk_call('grid', 'rowconfigure', epath, index, *hash_kv(keys))
        TkGrid.rowconfigure(self, index, keys)
      end

grid_rowconfiginfo(index, slot=nil)

[Source]

    # File tk/lib/tk.rb, line 4098
      def grid_rowconfiginfo(index, slot=nil)
        #if slot
        #  tk_call('grid', 'rowconfigure', epath, index, "-#{slot}").to_i
        #else
        #  ilist = list(tk_call('grid', 'rowconfigure', epath, index))
        #  info = {}
        #  while key = ilist.shift
        #   info[key[1..-1]] = ilist.shift
        #  end
        #  info
        #end
        TkGrid.rowconfiginfo(self, index, slot)
      end

grid_rowconfigure(index, keys)

Alias for grid_rowconfig

grid_size()

[Source]

    # File tk/lib/tk.rb, line 4143
      def grid_size()
        #list(tk_call('grid', 'size', epath))
        TkGrid.size(self)
      end

grid_slaves(args)

[Source]

    # File tk/lib/tk.rb, line 4148
      def grid_slaves(args)
        #list(tk_call('grid', 'slaves', epath, *hash_kv(args)))
        TkGrid.slaves(self, args)
      end

lower(below=None)

[Source]

    # File tk/lib/tk.rb, line 4277
      def lower(below=None)
        # below = below.epath if below.kind_of?(TkObject)
        below = _epath(below)
        tk_call 'lower', epath, below
        self
      end

lower_window(below=None)

Alias for lower

pack(keys = nil)

[Source]

    # File tk/lib/tk.rb, line 3951
      def pack(keys = nil)
        #tk_call_without_enc('pack', epath, *hash_kv(keys, true))
        if keys
          TkPack.configure(self, keys)
        else
          TkPack.configure(self)
        end
        self
      end

pack_config(slot, value=None)

[Source]

    # File tk/lib/tk.rb, line 3980
      def pack_config(slot, value=None)
        #if slot.kind_of? Hash
        #  tk_call 'pack', 'configure', epath, *hash_kv(slot)
        #else
        #  tk_call 'pack', 'configure', epath, "-#{slot}", value
        #end
        if slot.kind_of? Hash
          TkPack.configure(self, slot)
        else
          TkPack.configure(self, slot=>value)
        end
      end

pack_configure(slot, value=None)

Alias for pack_config

pack_forget()

[Source]

    # File tk/lib/tk.rb, line 3973
      def pack_forget
        #tk_call_without_enc('pack', 'forget', epath)
        TkPack.forget(self)
        self
      end

pack_in(target, keys = nil)

[Source]

    # File tk/lib/tk.rb, line 3961
      def pack_in(target, keys = nil)
        if keys
          keys = keys.dup
          keys['in'] = target
        else
          keys = {'in'=>target}
        end
        #tk_call 'pack', epath, *hash_kv(keys)
        TkPack.configure(self, keys)
        self
      end

pack_info()

[Source]

    # File tk/lib/tk.rb, line 3994
      def pack_info()
        #ilist = list(tk_call('pack', 'info', epath))
        #info = {}
        #while key = ilist.shift
        #  info[key[1..-1]] = ilist.shift
        #end
        #return info
        TkPack.info(self)
      end

pack_propagate(mode=None)

[Source]

    # File tk/lib/tk.rb, line 4004
      def pack_propagate(mode=None)
        #if mode == None
        #  bool(tk_call('pack', 'propagate', epath))
        #else
        #  tk_call('pack', 'propagate', epath, mode)
        #  self
        #end
        if mode == None
          TkPack.propagate(self)
        else
          TkPack.propagate(self, mode)
          self
        end
      end

pack_slaves()

[Source]

    # File tk/lib/tk.rb, line 4019
      def pack_slaves()
        #list(tk_call('pack', 'slaves', epath))
        TkPack.slaves(self)
      end

place(keys)

[Source]

    # File tk/lib/tk.rb, line 4153
      def place(keys)
        #tk_call 'place', epath, *hash_kv(keys)
        TkPlace.configure(self, keys)
        self
      end

place_config(slot, value=None)

[Source]

    # File tk/lib/tk.rb, line 4178
      def place_config(slot, value=None)
        #if slot.kind_of? Hash
        #  tk_call 'place', 'configure', epath, *hash_kv(slot)
        #else
        #  tk_call 'place', 'configure', epath, "-#{slot}", value
        #end
        TkPlace.configure(self, slot, value)
      end

place_configinfo(slot = nil)

[Source]

    # File tk/lib/tk.rb, line 4188
      def place_configinfo(slot = nil)
        # for >= Tk8.4a2 ?
        #if slot
        #  conf = tk_split_list(tk_call('place', 'configure', epath, "-#{slot}") )
        #  conf[0] = conf[0][1..-1]
        #  conf
        #else
        #  tk_split_simplelist(tk_call('place',
        #                             'configure', epath)).collect{|conflist|
        #   conf = tk_split_simplelist(conflist)
        #   conf[0] = conf[0][1..-1]
        #   conf
        #  }
        #end
        TkPlace.configinfo(self, slot)
      end

place_configure(slot, value=None)

Alias for place_config

place_forget()

[Source]

    # File tk/lib/tk.rb, line 4171
      def  place_forget
        #tk_call 'place', 'forget', epath
        TkPlace.forget(self)
        self
      end

place_in(target, keys = nil)

[Source]

    # File tk/lib/tk.rb, line 4159
      def place_in(target, keys = nil)
        if keys
          keys = keys.dup
          keys['in'] = target
        else
          keys = {'in'=>target}
        end
        #tk_call 'place', epath, *hash_kv(keys)
        TkPlace.configure(self, keys)
        self
      end

place_info()

[Source]

    # File tk/lib/tk.rb, line 4205
      def place_info()
        #ilist = list(tk_call('place', 'info', epath))
        #info = {}
        #while key = ilist.shift
        #  info[key[1..-1]] = ilist.shift
        #end
        #return info
        TkPlace.info(self)
      end

place_slaves()

[Source]

    # File tk/lib/tk.rb, line 4215
      def place_slaves()
        #list(tk_call('place', 'slaves', epath))
        TkPlace.slaves(self)
      end

raise(above=None)

[Source]

    # File tk/lib/tk.rb, line 4284
      def raise(above=None)
        #above = above.epath if above.kind_of?(TkObject)
        above = _epath(above)
        tk_call 'raise', epath, above
        self
      end

raise_window(above=None)

Alias for raise

release_grab()

Alias for grab_release

set_focus(force=false)

[Source]

    # File tk/lib/tk.rb, line 4220
      def set_focus(force=false)
        if force
          tk_call_without_enc('focus', '-force', path)
        else
          tk_call_without_enc('focus', path)
        end
        self
      end

set_global_grab()

Alias for grab_set_global

set_grab()

Alias for grab_set

thread_tkwait()

Alias for thread_wait_visibility

thread_tkwait_destroy()

Alias for thread_wait_destroy

thread_tkwait_visibility()

Alias for thread_wait_visibility

thread_tkwait_window()

Alias for thread_wait_destroy

thread_wait()

Alias for thread_wait_visibility

thread_wait_destroy()

[Source]

    # File tk/lib/tk.rb, line 4382
      def thread_wait_destroy
        wait_destroy(true)
      end

thread_wait_visibility()

[Source]

    # File tk/lib/tk.rb, line 4354
      def thread_wait_visibility
        wait_visibility(true)
      end

thread_wait_window()

Alias for thread_wait_destroy

tktrans_get_image()

[Source]

    # File tk/lib/tkextlib/tktrans/tktrans.rb, line 37
      def tktrans_get_image()
        tk_send('tktrans::setwidget', @path)
      end

tktrans_set_image(img)

[Source]

    # File tk/lib/tkextlib/tktrans/tktrans.rb, line 33
      def tktrans_set_image(img)
        tk_send('tktrans::setwidget', @path, img)
        self
      end

tkwait(on_thread = true)

Alias for wait_visibility

tkwait_destroy(on_thread = true)

Alias for wait_destroy

tkwait_window(on_thread = true)

Alias for wait_destroy

ungrid()

Alias for grid_forget

unpack()

Alias for pack_forget

unplace()

Alias for place_forget

wait(on_thread = true)

Alias for wait_visibility

wait_destroy(on_thread = true)

[Source]

    # File tk/lib/tk.rb, line 4366
      def wait_destroy(on_thread = true)
        if $SAFE >= 4
          fail SecurityError, "can't wait destroy at $SAFE >= 4"
        end
        on_thread &= (Thread.list.size != 1)
        if on_thread
          INTERP._thread_tkwait('window', epath)
        else
          INTERP._invoke('tkwait', 'window', epath)
        end
      end

wait_visibility(on_thread = true)

[Source]

    # File tk/lib/tk.rb, line 4340
      def wait_visibility(on_thread = true)
        if $SAFE >= 4
          fail SecurityError, "can't wait visibility at $SAFE >= 4"
        end
        on_thread &= (Thread.list.size != 1)
        if on_thread
          INTERP._thread_tkwait('visibility', path)
        else
          INTERP._invoke('tkwait', 'visibility', path)
        end
      end

wait_window(on_thread = true)

Alias for wait_destroy

[Validate]