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.



1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'lib/a-core.rb', line 1450

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')
  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.



1447
1448
1449
# File 'lib/a-core.rb', line 1447

def menu
  @menu
end

#typeObject

Returns the value of attribute type.



1449
1450
1451
# File 'lib/a-core.rb', line 1449

def type
  @type
end

#underlineObject

Returns the value of attribute underline.



1448
1449
1450
# File 'lib/a-core.rb', line 1448

def underline
  @underline
end

Instance Method Details

#enable=(_value) ⇒ Object



1469
1470
1471
1472
1473
1474
1475
# File 'lib/a-core.rb', line 1469

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