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.



1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
# File 'lib/a-core.rb', line 1214

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.



1211
1212
1213
# File 'lib/a-core.rb', line 1211

def menu
  @menu
end

#typeObject

Returns the value of attribute type.



1213
1214
1215
# File 'lib/a-core.rb', line 1213

def type
  @type
end

#underlineObject

Returns the value of attribute underline.



1212
1213
1214
# File 'lib/a-core.rb', line 1212

def underline
  @underline
end

Instance Method Details

#enabled=(_value) ⇒ Object



1234
1235
1236
1237
1238
1239
1240
# File 'lib/a-core.rb', line 1234

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