class ArcadiaMainToolbar::UserItem

Attributes

frame[RW]
menu_button[RW]

Public Class Methods

new(_sender, _args) click to toggle source
Calls superclass method ArcadiaUserControl::UserItem::new
# File lib/a-core.rb, line 1533
    def initialize(_sender, _args)
      super(_sender, _args)
      _image = Arcadia.image_res(@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 = Arcadia.wf.toolbutton(_args['frame']){
        image  _image if _image
        command _command if _command
#        height 23
        width 23
        padding "5 0"
        text _caption if _caption
      }
      return if @item_obj.nil?
      @item_obj.hint=_hint

#      @item_obj = Tk::BWidget::Button.new(_args['frame'], Arcadia.style('toolbarbutton')){
#        image  _image if _image
#        command _command if _command
#        width 23
#        height 23
#        helptext  _hint if _hint
#        #compound 'left'
#      }
      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'

#        item_menu = TkMenu.new(mb)
#        if !OS.mac?
#          item_menu.configure(Arcadia.style('menu'))
#        end
        item_menu = Arcadia.wf.menu(mb)
        @menu_button = Arcadia.wf.menubutton(_args['frame']){|mb|
          menu item_menu
         # image Arcadia.image_res(MENUBUTTON_ARROW_DOWN_GIF)
          pack('side'=> 'left','anchor'=> 's','pady'=>3)
        }
      
      
#        @menu_button = TkMenuButton.new(_args['frame'], Arcadia.style('toolbarbutton')){|mb|
#          indicatoron false
#          menu TkMenu.new(mb, Arcadia.style('menu'))
#          image Arcadia.image_res(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

Public Instance Methods

enable=(_value) click to toggle source
# File lib/a-core.rb, line 1591
def enable=(_value)
  if _value
    @item_obj.state='normal'
  else
    @item_obj.state='disabled' if !OS.mac? # Workaround for #1100117 on mac
  end
end