Sha256: 6997161f3f58b4e95a240c1c5755e7bf437d8f325ebad9626d900bdaaf9d0cf9

Contents?: true

Size: 916 Bytes

Versions: 21

Compression:

Stored size: 916 Bytes

Contents

# encoding: utf-8

module Fidgit
  class ColorWell < RadioButton
    alias_method :color, :value

    # @param (see RadioButton#initialize)
    # @option (see RadioButton#initialize)
    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

    protected
    def draw_background
      super

      draw_frame x + 2, y + 2, width - 4, height - 4, 1, z, @outline_color

      nil
    end

    protected
    def draw_foreground
      draw_rect x + 3, y + 3, width - 6, height - 6, z, value

      nil
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fidgit-0.2.4 lib/fidgit/elements/color_well.rb
fidgit-0.2.3 lib/fidgit/elements/color_well.rb
fidgit-0.2.2 lib/fidgit/elements/color_well.rb
fidgit-0.2.1 lib/fidgit/elements/color_well.rb
fidgit-0.2.0 lib/fidgit/elements/color_well.rb
fidgit-0.1.10 lib/fidgit/elements/color_well.rb
fidgit-0.1.9 lib/fidgit/elements/color_well.rb
fidgit-0.1.8 lib/fidgit/elements/color_well.rb
fidgit-0.1.7 lib/fidgit/elements/color_well.rb
fidgit-0.1.6 lib/fidgit/elements/color_well.rb
fidgit-0.1.5 lib/fidgit/elements/color_well.rb
fidgit-0.1.4 lib/fidgit/elements/color_well.rb
fidgit-0.1.3 lib/fidgit/elements/color_well.rb
fidgit-0.1.2 lib/fidgit/elements/color_well.rb
fidgit-0.1.1 lib/fidgit/elements/color_well.rb
fidgit-0.1.0 lib/fidgit/elements/color_well.rb
fidgit-0.0.6alpha lib/fidgit/elements/color_well.rb
fidgit-0.0.5alpha lib/fidgit/elements/color_well.rb
fidgit-0.0.4alpha lib/fidgit/elements/color_well.rb
fidgit-0.0.3alpha lib/fidgit/elements/color_well.rb