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.



958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
# File 'lib/a-core.rb', line 958

def initialize(_sender, _args)
  super(_sender, _args)
  _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.



955
956
957
# File 'lib/a-core.rb', line 955

def menu
  @menu
end

#typeObject

Returns the value of attribute type.



957
958
959
# File 'lib/a-core.rb', line 957

def type
  @type
end

#underlineObject

Returns the value of attribute underline.



956
957
958
# File 'lib/a-core.rb', line 956

def underline
  @underline
end

Instance Method Details

#enabled=(_value) ⇒ Object



980
981
982
983
984
985
986
# File 'lib/a-core.rb', line 980

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