Class: UnderOs::UI::Icon
- Includes:
- IconEngine
- Defined in:
- lib/under_os/ui/icon.rb
Constant Summary
Constants included from Wrap
Wrap::INSTANCES_CACHE, Wrap::RAW_WRAPS_MAP, Wrap::WRAPS_TAGS_MAP
Instance Method Summary collapse
-
#initialize(options) ⇒ Icon
constructor
A new instance of Icon.
- #size(size = nil) ⇒ Object
- #size=(size) ⇒ Object
- #type ⇒ Object
- #type=(type) ⇒ Object
Methods included from IconEngine
Methods inherited from View
Methods included from Manipulation
#append, #clear, #insert, #insertTo, #prepend, #remove
Methods included from Traversing
#children, #empty?, #find, #first, #matches, #parent, #siblings
Methods included from Dimensions
Methods included from Animation
#animate, #fade_in, #fade_out, #highlight
Methods included from Commons
#data, #data=, #hidden, #hide, #id, #id=, #page, #show, #tagName, #toggle, #visible
Methods included from Styles
#addClass, #className, #className=, #classNames, #classNames=, #hasClass, #radioClass, #removeClass, #repaint, #style, #style=, #toggleClass
Methods included from Events
Methods included from Wrap
Constructor Details
#initialize(options) ⇒ Icon
Returns a new instance of Icon.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/under_os/ui/icon.rb', line 7 def initialize() = {type: } if ! .is_a?(Hash) super() self.type = .delete(:type) || :bug self.size = .delete(:size) || 20 @_.sizeToFit @_.showsTouchWhenHighlighted = true end |
Instance Method Details
#size(size = nil) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/under_os/ui/icon.rb', line 28 def size(size=nil) if size self.size = size self else @size end end |
#size=(size) ⇒ Object
37 38 39 40 41 |
# File 'lib/under_os/ui/icon.rb', line 37 def size=(size) @size = size @_.setFont self.class.engine.font(size) @_.sizeToFit end |
#type ⇒ Object
19 20 21 |
# File 'lib/under_os/ui/icon.rb', line 19 def type @type end |
#type=(type) ⇒ Object
23 24 25 26 |
# File 'lib/under_os/ui/icon.rb', line 23 def type=(type) @type = type @_.setTitle self.class.engine.text(type), forState:UIControlStateNormal end |