Class: ArcadiaMainToolbar

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

Defined Under Namespace

Classes: UserItem

Constant Summary collapse

SUF =
'user_toolbar'

Instance Method Summary collapse

Methods inherited from ArcadiaUserControl

#items

Constructor Details

#initialize(_arcadia, _frame) ⇒ ArcadiaMainToolbar

Returns a new instance of ArcadiaMainToolbar.



1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
# File 'lib/a-core.rb', line 1103

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 Method Details

#new_item(_sender, _args = nil) ⇒ Object



1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
# File 'lib/a-core.rb', line 1115

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



1137
1138
1139
1140
1141
1142
# File 'lib/a-core.rb', line 1137

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