Class: ArcadiaMainToolbar

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

Defined Under Namespace

Classes: UserItem

Constant Summary collapse

SUF =
'user_toolbar'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ArcadiaUserControl

#items

Constructor Details

#initialize(_arcadia, _frame) ⇒ ArcadiaMainToolbar

Returns a new instance of ArcadiaMainToolbar.



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
# File 'lib/a-core.rb', line 1351

def initialize(_arcadia, _frame)
  @arcadia = _arcadia
  @frame = _frame
  @frame.borderwidth(Arcadia.conf('panel.borderwidth'))
  #@frame.highlightbackground(Arcadia.conf('panel.highlightbackground'))
  @frame.relief(Arcadia.conf('panel.relief'))
 
  @context_frames = Hash.new  
  @last_context = nil
  @last_item_for_context = Hash.new
end

Instance Attribute Details

#frameObject (readonly)

Returns the value of attribute frame.



1303
1304
1305
# File 'lib/a-core.rb', line 1303

def frame
  @frame
end

Instance Method Details

#new_item(_sender, _args = nil) ⇒ Object



1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
# File 'lib/a-core.rb', line 1363

def new_item(_sender, _args= nil)
  _context = _args['context']
  _context_path = _args['context_path']
  
  if @last_context && _context != @last_context && _context_path.nil? 
    new_separator
  end
  @last_context = _context
  _args['frame']=@frame
  if _context_path && @last_item_for_context[_context_path]
    _args['last_item_for_context']=@last_item_for_context[_context_path]
  end
  
  super(_sender, _args)
  if _context_path && items[_args['name']]
    @last_item_for_context[_context_path] = items[_args['name']]
  end
  if _context && items[_args['name']]
    @last_item_for_context[_context] = items[_args['name']]
  end
end

#new_separatorObject



1385
1386
1387
1388
1389
1390
# File 'lib/a-core.rb', line 1385

def new_separator
  Tk::BWidget::Separator.new(@frame, 
  :orient=>'vertical',
  :background=>Arcadia.conf('button.highlightbackground')
  ).pack('side' =>'left', :padx=>2, :pady=>2, :fill=>'y',:anchor=> 'w')
end