Sha256: c74e58e11b942e5a6c377f5ce2d0dba724bce57dc61714b9b2c37d91e0cc529c

Contents?: true

Size: 844 Bytes

Versions: 4

Compression:

Stored size: 844 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] app The app element of this button
      # @param [Proc] blk The block of code to call when this button is activated
      def initialize(dsl, app)
        super(dsl, app, ::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

4 entries across 4 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre8 lib/shoes/swt/radio.rb
shoes-swt-4.0.0.pre7 lib/shoes/swt/radio.rb
shoes-swt-4.0.0.pre6 lib/shoes/swt/radio.rb
shoes-swt-4.0.0.pre5 lib/shoes/swt/radio.rb