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.



1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
# File 'lib/a-core.rb', line 1227

def initialize(_sender, _args)
  super(_sender, _args)
  _command = @command #proc{ Arcadia.process_event(@event_class.new(_sender, @event_args)) } if @event_class
  #_menu = @menu[@parent]
  item_args = Hash.new
  item_args['image']=TkPhotoImage.new('data' => @image_data) if @image_data
  item_args['label']=@caption
  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.



1224
1225
1226
# File 'lib/a-core.rb', line 1224

def menu
  @menu
end

#typeObject

Returns the value of attribute type.



1226
1227
1228
# File 'lib/a-core.rb', line 1226

def type
  @type
end

#underlineObject

Returns the value of attribute underline.



1225
1226
1227
# File 'lib/a-core.rb', line 1225

def underline
  @underline
end

Instance Method Details

#enabled=(_value) ⇒ Object



1247
1248
1249
1250
1251
1252
1253
# File 'lib/a-core.rb', line 1247

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