class Tk::Tcllib::Widget::ToolbarItem - tk-0.2.0 Documentation

# class Tk::Tcllib::Widget::ToolbarItem

### Constants

ToolbarItemID_TBL

### Public Class Methods

id2obj(tbar, id) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 49
    def ToolbarItem.id2obj(tbar, id)
      tpath = tbar.path
      ToolbarItemID_TBL.mutex.synchronize{
        if ToolbarItemID_TBL[tpath]
          ToolbarItemID_TBL[tpath][id]? ToolbarItemID_TBL[tpath][id]: id
        else
          id
        end
      }
    end

new(parent, *args) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 60
    def initialize(parent, *args)
      @parent = @t = parent
      @tpath = parent.path

      @path = @id = @t.tk_send('add', *args)
      # A same id is rejected by the Tcl function.

      ToolbarItemID_TBL.mutex.synchronize{
        ToolbarItemID_TBL[@id] = self
        ToolbarItemID_TBL[@tpath] = {} unless ToolbarItemID_TBL[@tpath]
        ToolbarItemID_TBL[@tpath][@id] = self
      }
    end

### Public Instance Methods

[](key) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 74
    def [](key)
      cget key
    end

[]=(key,val) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 78
    def []=(key,val)
      configure key, val
      val
    end

cget(option) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 86
    def cget(option)
      @t.itemcget(@id, option)
    end

cget_strict(option) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 89
    def cget_strict(option)
      @t.itemcget_strict(@id, option)
    end

cget_tkstring(option) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 83
    def cget_tkstring(option)
      @t.itemcget_tkstring(@id, option)
    end

configinfo(key=nil) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 98
    def configinfo(key=nil)
      @t.itemconfiginfo(@id, key)
    end

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

    # File lib/tkextlib/tcllib/toolbar.rb, line 93
    def configure(key, value=None)
      @t.itemconfigure(@id, key, value)
      self
    end

current_configinfo(key=nil) click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 102
    def current_configinfo(key=nil)
      @t.current_itemconfiginfo(@id, key)
    end

delete() click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 106
    def delete
      @t.delete(@id)
    end

itemid() click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 110
    def itemid
      @t.itemid(@id)
    end

remove() click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 114
    def remove
      @t.remove(@id)
    end

remove_with_destroy() click to toggle source

    # File lib/tkextlib/tcllib/toolbar.rb, line 117
    def remove_with_destroy
      @t.remove_with_destroy(@id)
    end