Sha256: 04299d3909c578d2a9acd9b76356f6027422e2ee354e5d05f324b6c7caefcf84

Contents?: true

Size: 856 Bytes

Versions: 2

Compression:

Stored size: 856 Bytes

Contents

class Shoes
  module Swt
    # In Swt a radio button is actually just a
    # button, so a lot of these methods are
    # borrowed from button.rb
    class Radio < CheckButton
      attr_accessor :group

      # Create a radio button
      #
      # @param [Shoes::Radio] dsl The Shoes DSL radio this represents
      # @param [::Swt::Widgets::Composite] parent The parent element of this button
      # @param [Proc] blk The block of code to call when this button is activated
      def initialize(dsl, parent)
        super(dsl, parent, ::Swt::SWT::RADIO)
        self.group = dsl.group
      end

      def group=(value)
        group_lookup = RadioGroup.group_lookup
        group_lookup[@group].remove(self) unless @group.nil?
        @group = value || RadioGroup::DEFAULT_RADIO_GROUP
        group_lookup[@group].add self
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre4 lib/shoes/swt/radio.rb
shoes-swt-4.0.0.pre3 lib/shoes/swt/radio.rb