Class: Fidgit::ToolTip

Inherits:
TextLine show all
Defined in:
lib/fidgit/elements/tool_tip.rb

Constant Summary

Constants inherited from TextLine

Fidgit::TextLine::VALID_JUSTIFICATION

Constants inherited from Element

Element::DEFAULT_SCHEMA_FILE, Element::VALID_ALIGN_H, Element::VALID_ALIGN_V

Instance Attribute Summary

Attributes inherited from TextLine

#color, #justify

Attributes inherited from Element

#align_h, #align_v, #background_color, #border_thickness, #font, #padding_bottom, #padding_left, #padding_right, #padding_top, #parent, #tip, #z

Instance Method Summary collapse

Methods inherited from TextLine

#draw_foreground, #min_width, #text, #text=, #to_s

Methods inherited from Element

#default, #drag?, #draw, #draw_frame, #draw_rect, #enabled=, #enabled?, #height, #height=, #max_height, #max_width, #min_height, #min_width, new, original_new, #outer_height, #outer_width, #recalc, schema, #to_s, #update, #width, #width=, #with, #x, #y

Methods included from Event

#events, included, new_event_handlers, #publish, #subscribe, #unsubscribe

Constructor Details

#initialize(options = {}, &block) ⇒ ToolTip

Returns a new instance of ToolTip.

Parameters:

  • text (String)

    The string to display in the label.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :icon (Gosu::Image, nil) — default: nil
  • :justify (:left, :right, :center) — default: :left

    Text justification.


13
14
15
16
17
18
19
20
21
22
# File 'lib/fidgit/elements/tool_tip.rb', line 13

def initialize(options = {}, &block)
  options = {
    z: Float::INFINITY,
    background_color: default(:background_color),
    border_color: default(:border_color),
    text: '',
  }.merge! options

  super(options[:text], options)
end

Instance Method Details

#hit?(x, y) ⇒ Boolean

Returns:

  • (Boolean)

7
# File 'lib/fidgit/elements/tool_tip.rb', line 7

def hit?(x, y); false; end

#x=(value) ⇒ Object


5
# File 'lib/fidgit/elements/tool_tip.rb', line 5

def x=(value); super(value); recalc; value; end

#y=(value) ⇒ Object


6
# File 'lib/fidgit/elements/tool_tip.rb', line 6

def y=(value); super(value); recalc; value; end