Class: ProMotion::Menu::Drawer

Inherits:
MMDrawerController
  • Object
show all
Includes:
Gestures, Transition, Visibility, ScreenModule
Defined in:
lib/ProMotion/menu/drawer.rb

Constant Summary

Constants included from Transition

Transition::VISUAL_STATES

Constants included from Gestures

Gestures::HIDE_MASKS, Gestures::SHOW_MASKS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Transition

#mask_for_transition, #transition_animation=

Methods included from Visibility

#hide, included, #show, #show_left, #show_right, #toggle, #toggle_left, #toggle_right

Methods included from Gestures

#mask_for_hide, #mask_for_show, #to_hide=, #to_show=

Class Method Details

.new(center = nil, options = {}) ⇒ Object



9
10
11
12
13
# File 'lib/ProMotion/menu/drawer.rb', line 9

def self.new(center=nil, options={})
  menu = alloc.init
  menu.send(:auto_setup, center, options)
  menu
end

Instance Method Details

#auto_setup(center, options = {}) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/ProMotion/menu/drawer.rb', line 15

def auto_setup(center, options={})
  options[:to_show] ||= :pan_bezel
  options[:to_hide] ||= [:pan_center, :tap_center]
  options[:center] ||= center if center
  shadow = options[:shadow] unless options[:shadow].nil?
  set_attributes self, options
  self.send(:setup) if self.respond_to?(:setup)
end

#center_controllerObject Also known as: content_controller, center, content



51
52
53
# File 'lib/ProMotion/menu/drawer.rb', line 51

def center_controller
  self.centerViewController
end

#center_controller=(c) ⇒ Object Also known as: content_controller=, center=, content=



44
45
46
# File 'lib/ProMotion/menu/drawer.rb', line 44

def center_controller=(c)
  self.centerViewController = prepare_controller_for_pm(c)
end

#controller(side) ⇒ Object



66
67
68
69
70
# File 'lib/ProMotion/menu/drawer.rb', line 66

def controller(side)
  return self.left_controller if side == :left
  return self.right_controller if side == :right
  self.center_controller if [:content, :center].include?(side)
end

#controller=(side = {}) ⇒ Object Also known as: controllers=



58
59
60
61
62
63
# File 'lib/ProMotion/menu/drawer.rb', line 58

def controller=(side={})
  self.left_controller = side[:left] if side[:left]
  self.right_controller = side[:right] if side[:right]
  self.center_controller = side[:center] if side[:center]
  self.center_controller ||= side[:content] if side[:content]
end

#left_controllerObject Also known as: left



29
30
31
# File 'lib/ProMotion/menu/drawer.rb', line 29

def left_controller
  self.leftDrawerViewController
end

#left_controller=(c) ⇒ Object Also known as: left=



24
25
26
# File 'lib/ProMotion/menu/drawer.rb', line 24

def left_controller=(c)
  self.leftDrawerViewController = prepare_controller_for_pm(c)
end

#right_controllerObject Also known as: right



39
40
41
# File 'lib/ProMotion/menu/drawer.rb', line 39

def right_controller
  self.rightDrawerViewController
end

#right_controller=(c) ⇒ Object Also known as: right=



34
35
36
# File 'lib/ProMotion/menu/drawer.rb', line 34

def right_controller=(c)
  self.rightDrawerViewController = prepare_controller_for_pm(c)
end

#shadow=(show_shadow) ⇒ Object



72
73
74
# File 'lib/ProMotion/menu/drawer.rb', line 72

def shadow=(show_shadow)
  self.setShowsShadow(show_shadow)
end