Class: MotionPrime::ButtonElement

Inherits:
BaseElement show all
Includes:
ElementContentPaddingMixin, ElementContentTextMixin
Defined in:
motion-prime/elements/button.rb

Instance Attribute Summary

Attributes inherited from BaseElement

#name, #options, #screen, #section, #styles, #view, #view_name

Instance Method Summary collapse

Methods included from ElementContentTextMixin

#attributed_text?, #attributed_text_for_text, #cached_content_height, #cached_content_width, #content_font, #content_height, #content_text, #content_width, #current_attributed_text, #height_for_attributed_text, #height_for_text, #multiline_content_width, #width_for_attributed_text, #width_for_text

Methods included from ElementTextMixin

#attributed_string, #extract_attributed_string_options, #html_string

Methods included from ElementContentPaddingMixin

#cached_content_outer_height, #cached_content_outer_width, #content_outer_height, #content_outer_width, #content_padding_bottom, #content_padding_height, #content_padding_left, #content_padding_right, #content_padding_top, #content_padding_width, #default_padding_for

Methods inherited from BaseElement

#add_target, after_render, before_render, #bind_gesture, #cell_element?, #cell_section?, #compute_options!, #computed_options, #dealloc, factory, #hide, #initialize, #notify_section_after_render, #notify_section_before_render, #reload!, #render, #render!, #rerender!, #show, #update, #update_options, #update_with_options

Methods included from HasClassFactory

#camelize_factory, #class_factory, #low_camelize_factory, #underscore_factory

Methods included from HasStyleOptions

#extract_font_from

Methods included from HasStyleChainBuilder

#build_styles_chain

Methods included from HasNormalizer

#debug_info, #element?, #normalize_object, #normalize_options, #normalize_value

Constructor Details

This class inherits a constructor from MotionPrime::BaseElement

Instance Method Details

#fontObject



24
25
26
# File 'motion-prime/elements/button.rb', line 24

def font
  extract_font_from(computed_options[:title_label]) || :system.uifont
end

#size_to_fitObject



8
9
10
11
12
13
14
# File 'motion-prime/elements/button.rb', line 8

def size_to_fit
  if computed_options[:size_to_fit]
    if computed_options[:width]
      view.setHeight cached_content_outer_height
    end
  end
end

#text_valueObject



20
21
22
# File 'motion-prime/elements/button.rb', line 20

def text_value
  view.try(:currentTitle) || computed_options[:title]
end

#view_classObject



16
17
18
# File 'motion-prime/elements/button.rb', line 16

def view_class
  "MPButton"
end