Class: Clogs::Link

Inherits:
TextDrawable show all
Defined in:
lib/clogs/drawables/text.rb

Overview

A clickable run of text. Clicks are routed by the containing paragraph, which knows where the link's words ended up on screen.

Constant Summary collapse

DEFAULT_COLOR =
[0, 0, 238, 255].freeze

Instance Attribute Summary

Attributes inherited from Drawable

#abs_x, #abs_y, #children, #height, #parent, #shoes_linkable_id, #styles, #width, #x, #y

Instance Method Summary collapse

Methods inherited from TextDrawable

#emphasis_style, #own_style, #resolved_size, #runs, #truthy_underline?

Methods inherited from Drawable

#add_child, #app, #contains?, #destroy_self, #draw, #each_peer, #focus_gained, #focus_lost, #focusable?, for_shoes_class, #hidden?, #initialize, #margin, #measure, #needs_layout!, #notify, #on_click, #on_key, #on_mouse_move, #on_release, #paint, #positioned?, #properties_changed, #redraw!, #remove_child, #requested_height, #requested_width, #set_parent, #style

Constructor Details

This class inherits a constructor from Clogs::Drawable

Instance Method Details

#click!(x, y) ⇒ Object



101
102
103
# File 'lib/clogs/drawables/text.rb', line 101

def click!(x, y)
  notify("click", 1, x, y)
end

#clickable?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/clogs/drawables/text.rb', line 97

def clickable?
  true
end

#style_for_tag(base) ⇒ Object



93
94
95
# File 'lib/clogs/drawables/text.rb', line 93

def style_for_tag(base)
  base.with(color: DEFAULT_COLOR, underline: true)
end