class MotionWizard::WizardNavigationBar

Public Instance Methods

create_index_items() click to toggle source
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 12
def create_index_items
  @number_of_steps.times do |i|
    index_item = @wizard_controller.create_index_item_at(i)
    @index_items << index_item
    addSubview(index_item)
  end
end
init_with_number_of_steps(number_of_steps, wizard_controller) click to toggle source
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 3
def init_with_number_of_steps(number_of_steps, wizard_controller)
  self.init
  @number_of_steps = number_of_steps
  @index_items = []
  @wizard_controller = WeakRef.new(wizard_controller)
  create_index_items
  self
end
remove_all_index_items() click to toggle source
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 37
def remove_all_index_items
  @index_items.each{|i| i.removeFromSuperview}
  @index_items.clear
end
reset!() click to toggle source
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 31
def reset!
  remove_all_index_items
  create_index_items
  resize_indexes
end
resize_indexes() click to toggle source
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 42
def resize_indexes
  return unless @number_of_steps
  index_width = (self.frame.size.width).to_f / @number_of_steps
  @index_items.each_with_index do |index_item, i|
    index_item.frame = [[index_width*i, 0], [index_width, self.size.height]]
    setup_index_item_at(index_item, i)
  end
end
select(index) click to toggle source
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 20
def select(index)
  @index_items[@selected_step].unselect if @selected_step && @index_items[@selected_step].respond_to?(:unselect)
  @selected_step = index
  @index_items[@selected_step].select if @selected_step && @index_items[@selected_step].respond_to?(:select)
end
setFrame(frame) click to toggle source
Calls superclass method
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 26
def setFrame(frame)
  super
  resize_indexes
end
setup_index_item_at(index_item, i) click to toggle source
# File lib/motion-wizard/views/wizard_navigation_bar.rb, line 51
def setup_index_item_at(index_item, i)
  @wizard_controller.setup_index_item_at(index_item, i)
end