class Tk::Iwidgets::Notebook - tk-0.2.0 Documentation

# class Tk::Iwidgets::Notebook

### Constants

TkCommandNames
WidgetClassName

### Public Instance Methods

add(keys={}) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 61
    def add(keys={})
      window(tk_call(@path, 'add', *hash_kv(keys)))
    end

child_site(idx) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 69
    def child_site(idx)
      if (new_idx = self.index(idx)) < 0
        new_idx = tagid(idx)
      end
      window(tk_call(@path, 'childsite', new_idx))
    end

child_site_list() click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 65
    def child_site_list
      list(tk_call(@path, 'childsite'))
    end

delete(idx1, idx2=nil) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 76
    def delete(idx1, idx2=nil)
      if (new_idx1 = self.index(idx1)) < 0
        new_idx1 = tagid(idx1)
      end
      if idx2
        if (new_idx2 = self.index(idx2)) < 0
          new_idx2 = tagid(idx2)
        end
        tk_call(@path, 'delete', new_idx1, new_idx2)
      else
        tk_call(@path, 'delete', new_idx1)
      end
      self
    end

index(idx) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 91
    def index(idx)
      number(tk_call(@path, 'index', tagid(idx)))
    end

insert(idx, keys={}) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 95
    def insert(idx, keys={})
      if (new_idx = self.index(idx)) < 0
        new_idx = tagid(idx)
      end
      window(tk_call(@path, 'insert', new_idx, *hash_kv(keys)))
    end

next() click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 102
    def next
      tk_call(@path, 'next')
      self
    end

prev() click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 107
    def prev
      tk_call(@path, 'prev')
      self
    end

scrollbar(bar=nil)
Alias for: yscrollbar
scrollcommand(cmd=Proc.new) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 120
    def scrollcommand(cmd=Proc.new)
      configure_cmd 'scrollcommand', cmd
      self
    end

Also aliased as: xscrollcommand, yscrollcommand
select(idx) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 112
    def select(idx)
      if (new_idx = self.index(idx)) < 0
        new_idx = tagid(idx)
      end
      tk_call(@path, 'select', new_idx)
      self
    end

tagid(tagOrId) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 35
    def tagid(tagOrId)
      if tagOrId.kind_of?(Tk::Itk::Component)
        tagOrId.name
      else
        #_get_eval_string(tagOrId)
        tagOrId
      end
    end

view(*idxs) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 149
    def view(*idxs)
      if idxs.size == 0
        idx = num_or_str(tk_send_without_enc('view'))
        if idx.kind_of?(Fixnum) && idx < 0
          nil
        else
          idx
        end
      else
        tk_send_without_enc('view', *idxs)
        self
      end
    end

Also aliased as: xview, yview
view_moveto(*idxs) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 165
    def view_moveto(*idxs)
      view('moveto', *idxs)
    end

Also aliased as: xview_moveto, yview_moveto
view_scroll(index, what='pages') click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 170
    def view_scroll(index, what='pages')
      view('scroll', index, what)
    end

Also aliased as: xview_scroll, yview_scroll
xscrollbar(bar=nil) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 127
    def xscrollbar(bar=nil)
      if bar
        @scrollbar = bar
        @scrollbar.orient 'horizontal'
        self.scrollcommand {|*arg| @scrollbar.set(*arg)}
        @scrollbar.command {|*arg| self.xview(*arg)}
        Tk.update  # avoid scrollbar trouble
      end
      @scrollbar
    end

xscrollcommand(cmd=Proc.new)
Alias for: scrollcommand
xview(*idxs)
Alias for: view
xview_moveto(*idxs)
Alias for: view_moveto
xview_scroll(index, what='pages')
Alias for: view_scroll
yscrollbar(bar=nil) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 137
    def yscrollbar(bar=nil)
      if bar
        @scrollbar = bar
        @scrollbar.orient 'vertical'
        self.scrollcommand {|*arg| @scrollbar.set(*arg)}
        @scrollbar.command {|*arg| self.yview(*arg)}
        Tk.update  # avoid scrollbar trouble
      end
      @scrollbar
    end

Also aliased as: scrollbar
yscrollcommand(cmd=Proc.new)
Alias for: scrollcommand
yview(*idxs)
Alias for: view
yview_moveto(*idxs)
Alias for: view_moveto
yview_scroll(index, what='pages')
Alias for: view_scroll

### Private Instance Methods

__boolval_optkeys() click to toggle source
Calls superclass method

    # File lib/tkextlib/iwidgets/notebook.rb, line 56
    def __boolval_optkeys
      super() << 'auto'
    end

__item_cget_cmd(id) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 25
    def __item_cget_cmd(id)
      [self.path, 'pagecget', id]
    end

__item_config_cmd(id) click to toggle source

    # File lib/tkextlib/iwidgets/notebook.rb, line 30
    def __item_config_cmd(id)
      [self.path, 'pageconfigure', id]
    end