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.



1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
# File 'lib/a-core.rb', line 1307

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

Instance Attribute Details

#frameObject

Returns the value of attribute frame.



1305
1306
1307
# File 'lib/a-core.rb', line 1305

def frame
  @frame
end

Returns the value of attribute menu_button.



1306
1307
1308
# File 'lib/a-core.rb', line 1306

def menu_button
  @menu_button
end

Instance Method Details

#enable=(_value) ⇒ Object



1341
1342
1343
1344
1345
1346
1347
# File 'lib/a-core.rb', line 1341

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