Class: Reflex::TextView
Instance Attribute Summary collapse
-
#font ⇒ Object
Returns the value of attribute font.
Instance Method Summary collapse
Methods inherited from View
#capturing?, #categories, #category, #category=, #children, #collision, #collision=, #delay, #find_child, has_model, #initialize, #interval, #on_contact, #on_contact_begin, #on_contact_end, #remove_self, #shapes, #style, #styles, #timeout
Methods included from HasTags
#clear_tags, #tag, #tag=, #tags, #untag
Methods included from HasFrame
#inset_by, #move_by, #move_to, #resize_by, #resize_to
Methods included from Hookable
Constructor Details
This class inherits a constructor from Reflex::View
Instance Attribute Details
#font ⇒ Object
Returns the value of attribute font.
16 17 18 |
# File 'lib/reflex/text_view.rb', line 16 def font @font end |
Instance Method Details
#content_bounds ⇒ Object
21 22 23 24 25 26 |
# File 'lib/reflex/text_view.rb', line 21 def content_bounds () s = string return 0, 0 unless s && window font = @font || window.painter.font [font.width(s), font.height].map &:ceil end |
#on_draw(e) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/reflex/text_view.rb', line 28 def on_draw (e) s = string e.painter.push font: @font do text s end end |