# class TkTextWindow

### Public Class Methods

new(parent, index, keys = {}) click to toggle source

    # File lib/tk/textwindow.rb, line 11
      def initialize(parent, index, keys = {})
        #unless parent.kind_of?(Tk::Text)
        #  fail ArgumentError, "expect Tk::Text for 1st argument"
        #end
        @t = parent
        if index == 'end' || index == :end
          @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
                                                         'end - 1 chars'))
        elsif index.kind_of?(TkTextMark)
          if tk_call_without_enc(@t.path,'index',index.path) == tk_call_without_enc(@t.path,'index','end')
            @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
                                                           'end - 1 chars'))
          else
            @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
                                                           index.path))
          end
        else
          @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', _get_eval_enc_str(index)))
        end
        @path.gravity = 'left'
        @index = @path.path
        keys = _symbolkey2str(keys)
        @id = keys['window']
        # keys['window'] = @id.epath if @id.kind_of?(TkWindow)
        keys['window'] = _epath(@id) if @id
        if keys['create']
          @p_create = keys['create']
          # if @p_create.kind_of?(Proc)
          if TkComm._callback_entry?(@p_create)
            keys['create'] = install_cmd(proc{
                                           @id = @p_create.call
                                           if @id.kind_of?(TkWindow)
                                             @id.epath
                                           else
                                             @id
                                           end
                                         })
            keys['create'] = install_cmd(proc{@id = @p_create.call; _epath(@id)})
          end
        end
        tk_call_without_enc(@t.path, 'window', 'create', @index,
                            *hash_kv(keys, true))
        @path.gravity = 'right'
      end

### Public Instance Methods

[](slot) click to toggle source

    # File lib/tk/textwindow.rb, line 65
    def [](slot)
      cget(slot)
    end

[]=(slot, value) click to toggle source

    # File lib/tk/textwindow.rb, line 68
    def []=(slot, value)
      configure(slot, value)
      value
    end

cget(slot) click to toggle source

    # File lib/tk/textwindow.rb, line 73
    def cget(slot)
      @t.window_cget(@index, slot)
    end

cget_strict(slot) click to toggle source

    # File lib/tk/textwindow.rb, line 76
    def cget_strict(slot)
      @t.window_cget_strict(@index, slot)
    end

configinfo(slot = nil) click to toggle source

    # File lib/tk/textwindow.rb, line 111
    def configinfo(slot = nil)
      @t.window_configinfo(@index, slot)
    end

configure(slot, value=None) click to toggle source

    # File lib/tk/textwindow.rb, line 80
    def configure(slot, value=None)
      if slot.kind_of?(Hash)
        slot = _symbolkey2str(slot)
        if slot['window']
          @id = slot['window']
          # slot['window'] = @id.epath if @id.kind_of?(TkWindow)
          slot['window'] = _epath(@id) if @id
        end
        if slot['create']
          self.create=slot.delete('create')
        end
        if slot.size > 0
          tk_call_without_enc(@t.path, 'window', 'configure', @index,
                              *hash_kv(slot, true))
        end
      else
        if slot == 'window' || slot == :window
          @id = value
          # value = @id.epath if @id.kind_of?(TkWindow)
          value = _epath(@id) if @id
        end
        if slot == 'create' || slot == :create
          self.create=value
        else
          tk_call_without_enc(@t.path, 'window', 'configure', @index,
                              "-#{slot}", _get_eval_enc_str(value))
        end
      end
      self
    end

create() click to toggle source

    # File lib/tk/textwindow.rb, line 132
    def create
      @p_create
    end

create=(value) click to toggle source

    # File lib/tk/textwindow.rb, line 136
    def create=(value)
      @p_create = value
      # if @p_create.kind_of?(Proc)
      if TkComm._callback_entry?(@p_create)
        value = install_cmd(proc{
                              @id = @p_create.call
                              if @id.kind_of?(TkWindow)
                                @id.epath
                              else
                                @id
                              end
                            })
      end
      tk_call_without_enc(@t.path, 'window', 'configure', @index,
                          '-create', _get_eval_enc_str(value))
      value
    end

current_configinfo(slot = nil) click to toggle source

    # File lib/tk/textwindow.rb, line 115
    def current_configinfo(slot = nil)
      @t.current_window_configinfo(@index, slot)
    end

id() click to toggle source

    # File lib/tk/textwindow.rb, line 58
    def id
      Tk::Text::IndexString.new(_epath(@id))
    end

mark() click to toggle source

    # File lib/tk/textwindow.rb, line 61
    def mark
      @path
    end

window() click to toggle source

    # File lib/tk/textwindow.rb, line 119
    def window
      @id
    end

window=(value) click to toggle source

    # File lib/tk/textwindow.rb, line 123
    def window=(value)
      @id = value
      # value = @id.epath if @id.kind_of?(TkWindow)
      value = _epath(@id) if @id
      tk_call_without_enc(@t.path, 'window', 'configure', @index,
                          '-window', _get_eval_enc_str(value))
      value
    end