Module: MotionPrime::CellSectionMixin
- Extended by:
- MotionSupport::Concern
- Included in:
- BaseFieldSection, BaseHeaderSection
- Defined in:
- motion-prime/sections/_cell_section_mixin.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#pending_display ⇒ Object
readonly
Returns the value of attribute pending_display.
- #table ⇒ Object
Instance Method Summary collapse
- #cell_name ⇒ Object
- #cell_type ⇒ Object
- #container_bounds ⇒ Object
- #dealloc ⇒ Object
- #display ⇒ Object
- #init_container_element(options = {}) ⇒ Object
-
#load_container_element(options = {}) ⇒ Object
FIXME: Why this duplicates functionality from other parts, e.g.
- #pending_display! ⇒ Object
-
#render_container(options = {}, &block) ⇒ Object
should do nothing, because table section will care about it.
- #section_styles ⇒ Object
Instance Attribute Details
#pending_display ⇒ Object (readonly)
Returns the value of attribute pending_display.
7 8 9 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 7 def pending_display @pending_display end |
#table ⇒ Object
13 14 15 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 13 def table @table ||= [:table].try(:weak_ref) end |
Instance Method Details
#cell_name ⇒ Object
27 28 29 30 31 32 33 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 27 def cell_name self.class.custom_cell_name || begin return name unless table table_name = table.name.gsub('_table', '') name.gsub("#{table_name}_", '') end end |
#cell_type ⇒ Object
21 22 23 24 25 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 21 def cell_type @cell_type ||= begin self.is_a?(BaseFieldSection) ? :field : :cell end end |
#container_bounds ⇒ Object
35 36 37 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 35 def container_bounds @container_bounds ||= CGRectMake(0, 0, table.table_view.bounds.size.width, container_height) end |
#dealloc ⇒ Object
78 79 80 81 82 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 78 def dealloc # TODO: remove this when solve this problem: dealloc TableCells on TableView.reloadData (in case when reuseIdentifier has been used) container_view.section = nil if container_view.respond_to?(:setSection) super end |
#display ⇒ Object
73 74 75 76 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 73 def display @pending_display = false container_view.setNeedsDisplay end |
#init_container_element(options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 44 def init_container_element( = {}) @container_element ||= begin .merge!({ screen: screen, section: self.weak_ref, has_drawn_content: true }) [:styles] ||= [] [:styles] = [:"#{table.name}_first_cell"] if table.data.first == self [:styles] = [:"#{table.name}_last_cell"] if table.data.last == self MotionPrime::BaseElement.factory(:table_view_cell, ) end end |
#load_container_element(options = {}) ⇒ Object
FIXME: Why this duplicates functionality from other parts, e.g. draw_in?
59 60 61 62 63 64 65 66 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 59 def load_container_element( = {}) init_container_element() load_elements @container_element. unless @container_element. if respond_to?(:prerender_elements_for_state) && prerender_enabled? prerender_elements_for_state(:normal) end end |
#pending_display! ⇒ Object
68 69 70 71 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 68 def pending_display! @pending_display = true display unless table. end |
#render_container(options = {}, &block) ⇒ Object
should do nothing, because table section will care about it.
40 41 42 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 40 def render_container( = {}, &block) block.call end |
#section_styles ⇒ Object
17 18 19 |
# File 'motion-prime/sections/_cell_section_mixin.rb', line 17 def section_styles @section_styles ||= table.try(:cell_styles, self) || {} end |