Class: ArcadiaMainToolbar::UserItem

Inherits:
ArcadiaUserControl::UserItem show all
Defined in:
lib/a-core.rb

Instance Attribute Summary collapse

Attributes inherited from ArcadiaUserControl::UserItem

#action, #caption, #context, #context_caption, #event_args, #event_class, #hint, #image_data, #item_obj, #name, #rif

Instance Method Summary collapse

Methods inherited from ArcadiaUserControl::UserItem

#background, #foreground, #method_missing

Constructor Details

#initialize(_sender, _args) ⇒ UserItem

Returns a new instance of UserItem.



1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
# 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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ArcadiaUserControl::UserItem

Instance Attribute Details

#frameObject

Returns the value of attribute frame.



1531
1532
1533
# File 'lib/a-core.rb', line 1531

def frame
  @frame
end

Returns the value of attribute menu_button.



1532
1533
1534
# File 'lib/a-core.rb', line 1532

def menu_button
  @menu_button
end

Instance Method Details

#enable=(_value) ⇒ Object



1591
1592
1593
1594
1595
1596
1597
# 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