Class: ArcadiaMainMenu::UserItem

Inherits:
UserItem
  • Object
show all
Defined in:
lib/a-core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_sender, _args) ⇒ UserItem

Returns a new instance of UserItem.



1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
# File 'lib/a-core.rb', line 1650

def initialize(_sender, _args)
  super(_sender, _args)
  item_args = Hash.new
  item_args[:image]=Arcadia.image_res(@image_data) if @image_data
  item_args[:label]=@caption
  item_args[:font]=Arcadia.conf('menu.font') if !OS.mac?
  item_args[:underline]=@underline.to_i if @underline != nil
  item_args[:compound]='left'
  item_args[:command]=@command
  if @type.nil? && @commnad.nil? && @name == '-'
    @type=:separator
    item_args.clear
  elsif @type.nil?
    @type=:command
  end
  @item_obj = @menu.insert('end', @type ,item_args)
  @index = @menu.index('last')
end

Instance Attribute Details

Returns the value of attribute menu.



1647
1648
1649
# File 'lib/a-core.rb', line 1647

def menu
  @menu
end

#typeObject

Returns the value of attribute type.



1649
1650
1651
# File 'lib/a-core.rb', line 1649

def type
  @type
end

#underlineObject

Returns the value of attribute underline.



1648
1649
1650
# File 'lib/a-core.rb', line 1648

def underline
  @underline
end

Instance Method Details

#enable=(_value) ⇒ Object



1669
1670
1671
1672
1673
1674
1675
# File 'lib/a-core.rb', line 1669

def enable=(_value)
  if _value
    @item_obj.entryconfigure(@index,'state'=>'normal')
  else
    @item_obj.entryconfigure(@index,'state'=>'disable')
  end
end