Class: ArcadiaMainToolbar::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.



1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/a-core.rb', line 1072

def initialize(_sender, _args)
  super(_sender, _args)
  _image = TkPhotoImage.new('data' => @image_data) if @image_data
  _command = @command #proc{Arcadia.process_event(@event_class.new(_sender, @event_args))} if @event_class
  _hint = @hint
  _font = @font
  _caption = @caption
  @item_obj = Tk::BWidget::Button.new(_args['frame'], Arcadia.style('toolbarbutton')){
    image  _image if _image
    command _command if _command
    width 20
    height 20
    helptext  _hint if _hint
    text _caption if _caption
  }
  if _args['context_path'] && _args['last_item_for_context']
    @item_obj.pack('after'=>_args['last_item_for_context'].item_obj, 'side' =>'left', :padx=>2, :pady=>0)
  else
    @item_obj.pack('side' =>'left', :padx=>2, :pady=>0)
  end
  if _args['menu_button'] && _args['menu_button'] == 'yes'
    @menu_button = TkMenuButton.new(_args['frame'], Arcadia.style('toolbarbutton')){|mb|
      indicatoron false
      menu TkMenu.new(mb, Arcadia.style('titlemenu'))
      image TkPhotoImage.new('dat' => MENUBUTTON_ARROW_DOWN_GIF)
      padx 0
      pady 0
      pack('side'=> 'left','anchor'=> 's','pady'=>3)
    }     
    Arcadia.menu_root(_args['name'], @menu_button.cget('menu'))  
  end
  #Tk::BWidget::Separator.new(@frame, :orient=>'vertical').pack('side' =>'left', :padx=>2, :pady=>2, :fill=>'y',:anchor=> 'w')
end

Instance Attribute Details

#frameObject

Returns the value of attribute frame.



1070
1071
1072
# File 'lib/a-core.rb', line 1070

def frame
  @frame
end

Returns the value of attribute menu_button.



1071
1072
1073
# File 'lib/a-core.rb', line 1071

def menu_button
  @menu_button
end

Instance Method Details

#enabled=(_value) ⇒ Object



1106
1107
1108
1109
1110
1111
1112
# File 'lib/a-core.rb', line 1106

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