Method: Fidgit::ColorWell#initialize

Defined in:
lib/fidgit/elements/color_well.rb

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

Returns a new instance of ColorWell.

Parameters:

  • value (Object)
  • text (String)

    The string to display in the label.

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

    a customizable set of options

Options Hash (options):

  • :checked (Boolean)
  • :shortcut (Symbol) — default: nil

    Adds a shortcut key for this element, that activates it. :auto takes the first letter of the text.

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

    Text justification.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fidgit/elements/color_well.rb', line 9

def initialize(options = {}, &block)
  options = {
    width: default(:width),
    height: default(:height),
    color: default(:color),
    outline_color: default(:outline_color),
    checked_border_color: default(:checked, :border_color),
  }.merge! options

  @outline_color = options[:outline_color].dup

  super('', (options[:color] || options[:value]).dup, options)
end