Class: UnderOs::UI::Icon
- Inherits:
-
View
- Object
- View
- UnderOs::UI::Icon
- Includes:
- IconEngine
- Defined in:
- lib/under_os/ui/icon.rb
Instance Method Summary collapse
- #disable ⇒ Object
- #disabled ⇒ Object (also: #disabled?)
- #disabled=(value) ⇒ Object
- #enable ⇒ Object
-
#initialize(options) ⇒ Icon
constructor
A new instance of Icon.
- #size(size = nil) ⇒ Object
- #size=(size) ⇒ Object
- #type ⇒ Object
- #type=(type) ⇒ Object
Constructor Details
#initialize(options) ⇒ Icon
Returns a new instance of Icon.
7 8 9 10 11 12 13 14 15 16 17 18 |
# 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 self.disable if [:disabled] @_.sizeToFit @_.showsTouchWhenHighlighted = true end |
Instance Method Details
#disable ⇒ Object
54 55 56 |
# File 'lib/under_os/ui/icon.rb', line 54 def disable self.disabled = true end |
#disabled ⇒ Object Also known as: disabled?
44 45 46 |
# File 'lib/under_os/ui/icon.rb', line 44 def disabled ! @_.isEnabled end |
#disabled=(value) ⇒ Object
50 51 52 |
# File 'lib/under_os/ui/icon.rb', line 50 def disabled=(value) @_.enabled = ! value end |
#enable ⇒ Object
58 59 60 |
# File 'lib/under_os/ui/icon.rb', line 58 def enable self.disabled = false end |
#size(size = nil) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/under_os/ui/icon.rb', line 29 def size(size=nil) if size self.size = size self else @size end end |
#size=(size) ⇒ Object
38 39 40 41 42 |
# File 'lib/under_os/ui/icon.rb', line 38 def size=(size) @size = size @_.setFont self.class.engine.font(size) @_.sizeToFit end |
#type ⇒ Object
20 21 22 |
# File 'lib/under_os/ui/icon.rb', line 20 def type @type end |
#type=(type) ⇒ Object
24 25 26 27 |
# File 'lib/under_os/ui/icon.rb', line 24 def type=(type) @type = type @_.setTitle self.class.engine.text(type), forState:UIControlStateNormal end |