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.



1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
# File 'lib/a-core.rb', line 1332

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 = 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('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.



1330
1331
1332
# File 'lib/a-core.rb', line 1330

def frame
  @frame
end

Returns the value of attribute menu_button.



1331
1332
1333
# File 'lib/a-core.rb', line 1331

def menu_button
  @menu_button
end

Instance Method Details

#enable=(_value) ⇒ Object



1366
1367
1368
1369
1370
1371
1372
# File 'lib/a-core.rb', line 1366

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