Class: RubyMotionQuery::Stylesheet
- Inherits:
-
Object
- Object
- RubyMotionQuery::Stylesheet
- Defined in:
- motion/ruby_motion_query/stylesheet.rb
Class Attribute Summary (collapse)
-
+ (Object) application_was_setup
Returns the value of attribute application_was_setup.
Instance Attribute Summary (collapse)
-
- (Object) controller
readonly
Returns the value of attribute controller.
Instance Method Summary (collapse)
- - (Object) app_height
- - (Object) app_size
- - (Object) app_width
- - (Object) application_setup
- - (Object) color
- - (Object) content_height
-
- (Object) content_size
Content size of the controller's rootview, if it is a UIScrollView, UICollectionView, UITableView, etc.
- - (Object) content_width
- - (Object) device
- - (Object) font
- - (Boolean) four_inch?
- - (Object) image
-
- (Stylesheet) initialize(controller)
constructor
A new instance of Stylesheet.
- - (Boolean) ipad?
- - (Boolean) iphone?
- - (Boolean) landscape?
- - (Boolean) portrait?
- - (Boolean) retina?
-
- (Object) rmq
Convenience methods -------------------.
- - (Object) screen_height
- - (Object) screen_size
- - (Object) screen_width
- - (Object) setup
- - (Object) window
Constructor Details
- (Stylesheet) initialize(controller)
Returns a new instance of Stylesheet
108 109 110 111 112 113 114 115 116 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 108 def initialize(controller) @controller = RubyMotionQuery::RMQ.weak_ref(controller) unless Stylesheet.application_was_setup Stylesheet.application_was_setup = true application_setup end setup end |
Class Attribute Details
+ (Object) application_was_setup
Returns the value of attribute application_was_setup
129 130 131 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 129 def application_was_setup @application_was_setup end |
Instance Attribute Details
- (Object) controller (readonly)
Returns the value of attribute controller
106 107 108 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 106 def controller @controller end |
Instance Method Details
- (Object) app_height
175 176 177 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 175 def app_height app_size.height end |
- (Object) app_size
179 180 181 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 179 def app_size device.screen.applicationFrame.size end |
- (Object) app_width
171 172 173 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 171 def app_width app_size.width end |
- (Object) application_setup
118 119 120 121 122 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 118 def application_setup # Override to do your overall setup for your applications. This # is where you want to add your custom fonts and colors # This only gets called once end |
- (Object) color
217 218 219 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 217 def color RMQ.color end |
- (Object) content_height
199 200 201 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 199 def content_height content_size.height end |
- (Object) content_size
Content size of the controller's rootview, if it is a UIScrollView, UICollectionView, UITableView, etc
205 206 207 208 209 210 211 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 205 def content_size if @controller.view.respond_to?(:contentSize) @controller.view.contentSize else CGSizeZero end end |
- (Object) content_width
195 196 197 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 195 def content_width content_size.width end |
- (Object) device
141 142 143 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 141 def device RMQ.device end |
- (Object) font
221 222 223 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 221 def font RMQ.font end |
- (Boolean) four_inch?
159 160 161 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 159 def four_inch? RMQ.device.four_inch? end |
- (Object) image
213 214 215 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 213 def image RMQ.image end |
- (Boolean) ipad?
155 156 157 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 155 def ipad? device.ipad? end |
- (Boolean) iphone?
152 153 154 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 152 def iphone? device.iphone? end |
- (Boolean) landscape?
145 146 147 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 145 def landscape? device.landscape? end |
- (Boolean) portrait?
148 149 150 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 148 def portrait? device.portrait? end |
- (Boolean) retina?
163 164 165 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 163 def retina? RMQ.device.retina? end |
- (Object) rmq
Convenience methods -------------------
133 134 135 136 137 138 139 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 133 def rmq if @controller.nil? RMQ.new else @controller.rmq end end |
- (Object) screen_height
187 188 189 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 187 def screen_height screen_size.height end |
- (Object) screen_size
191 192 193 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 191 def screen_size device.screen.bounds.size end |
- (Object) screen_width
183 184 185 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 183 def screen_width screen_size.width end |
- (Object) setup
124 125 126 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 124 def setup # Override if you need to do setup in your specific stylesheet end |
- (Object) window
167 168 169 |
# File 'motion/ruby_motion_query/stylesheet.rb', line 167 def window RMQ.app.window end |