Class: Cura::Component::Textbox
- Defined in:
- lib/cura/component/textbox.rb
Overview
A component containing editable text.
Instance Attribute Summary collapse
-
#mask_character ⇒ String
Get the mask character for this textbox.
Attributes included from Attributes::HasAncestry
Attributes included from Attributes::HasOffsets
Attributes included from Attributes::HasEvents
Instance Method Summary collapse
-
#clear ⇒ Textbox
Clear all characters within this textbox.
-
#height=(value) ⇒ Integer
Set the height of this textbox.
-
#initialize(attributes = {}) ⇒ Textbox
constructor
A new instance of Textbox.
-
#width=(value) ⇒ Integer
Set the width of this textbox.
Methods inherited from Label
#bold=, #bold?, #draw, #height, #horizontal_alignment, #horizontal_alignment=, #lines, #text, #text=, #text_height, #text_width, #underline?, #underlined=, #vertical_alignment, #vertical_alignment=, #width
Methods included from Attributes::HasAttributes
Methods inherited from Base
#application, #background, #contains_coordinates?, #cursor, #draw, #focus, #focused?, #foreground, inherited, #inspect, #pencil, type, #update
Methods included from Attributes::HasVisibility
Methods included from Attributes::HasRelativeCoordinates
Methods included from Attributes::HasCoordinates
Methods included from Attributes::HasAncestry
Methods included from Attributes::HasOffsets
#border, #border=, #margin, #margin=, #padding, #padding=
Methods included from Attributes::HasColors
#background, #background=, #foreground, #foreground=
Methods included from Attributes::HasFocusability
Methods included from Attributes::HasEvents
Methods included from Attributes::HasDimensions
Constructor Details
#initialize(attributes = {}) ⇒ Textbox
Returns a new instance of Textbox.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cura/component/textbox.rb', line 34 def initialize(attributes={}) @focusable = true @foreground = Cura::Color.black @background = Cura::Color.white super # TODO # @width = 1 if @width != :auto && @width < 1 # @height = 1 if @height != :auto && @height < 1 end |
Instance Attribute Details
#mask_character ⇒ String
Get the mask character for this textbox.
60 61 62 |
# File 'lib/cura/component/textbox.rb', line 60 def mask_character @mask_character end |
Instance Method Details
#clear ⇒ Textbox
Clear all characters within this textbox.
49 50 51 52 53 54 55 |
# File 'lib/cura/component/textbox.rb', line 49 def clear @text = "" set_cursor_position self end |
#height=(value) ⇒ Integer
Set the height of this textbox.
88 89 90 91 92 |
# File 'lib/cura/component/textbox.rb', line 88 def height=(value) super @height = 1 if @height < 1 end |
#width=(value) ⇒ Integer
Set the width of this textbox.
78 79 80 81 82 |
# File 'lib/cura/component/textbox.rb', line 78 def width=(value) super @width = 1 if @width < 1 end |