Class: Scarpe::Webview::EditLine

Inherits:
Drawable show all
Defined in:
lib/scarpe/wv/edit_line.rb

Constant Summary

Constants included from Shoes::Log

Shoes::Log::DEFAULT_COMPONENT, Shoes::Log::DEFAULT_DEBUG_LOG_CONFIG, Shoes::Log::DEFAULT_LOG_CONFIG

Instance Attribute Summary collapse

Attributes inherited from Drawable

#children, #parent, #shoes_linkable_id

Attributes inherited from Shoes::Linkable

#linkable_id

Instance Method Summary collapse

Methods inherited from Drawable

#add_child, #bind, #destroy_self, display_class_for, #full_window_redraw!, #handler_js_code, #html_element, #html_id, #inspect, #needs_update!, #promise_update, #remove_child, #set_parent, #shoes_styles, #to_html

Methods included from Shoes::Log

configure_logger, #log_init, logger

Methods inherited from Shoes::Linkable

#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_all_shoes_events, #unsub_shoes_event

Constructor Details

#initialize(properties) ⇒ EditLine

Returns a new instance of EditLine.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/scarpe/wv/edit_line.rb', line 7

def initialize(properties)
  super

  # The JS handler sends a "change" event, which we forward to the Shoes drawable tree
  bind("change") do |new_text|
    send_self_event(new_text, event_name: "change")
  end
  bind("hover") do |new_text|
    send_self_event(new_text, event_name: "hover")
  end
end

Instance Attribute Details

#fontObject (readonly)

Returns the value of attribute font.



5
6
7
# File 'lib/scarpe/wv/edit_line.rb', line 5

def font
  @font
end

#strokeObject (readonly)

Returns the value of attribute stroke.



5
6
7
# File 'lib/scarpe/wv/edit_line.rb', line 5

def stroke
  @stroke
end

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/scarpe/wv/edit_line.rb', line 5

def text
  @text
end

#tooltipObject (readonly)

Returns the value of attribute tooltip.



5
6
7
# File 'lib/scarpe/wv/edit_line.rb', line 5

def tooltip
  @tooltip
end

#widthObject (readonly)

Returns the value of attribute width.



5
6
7
# File 'lib/scarpe/wv/edit_line.rb', line 5

def width
  @width
end

Instance Method Details

#elementObject



28
29
30
# File 'lib/scarpe/wv/edit_line.rb', line 28

def element
  render("edit_line")
end

#properties_changed(changes) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/scarpe/wv/edit_line.rb', line 19

def properties_changed(changes)
  t = changes.delete("text")
  if t
    html_element.value = t
  end

  super
end