Class: ProMotion::Menu::Drawer

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

Constant Summary

Constants included from Gestures

Gestures::HIDE_MASKS, Gestures::SHOW_MASKS

Class Method Summary collapse

Instance Method Summary collapse

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



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

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



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

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



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

def center_controller
  self.centerViewController
end

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



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

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

#controller(side) ⇒ Object



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

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=



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

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



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

def left_controller
  self.leftDrawerViewController
end

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



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

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

#right_controllerObject Also known as: right



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

def right_controller
  self.rightDrawerViewController
end

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



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

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

#shadow=(show_shadow) ⇒ Object



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

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