Sha256: 95fd3f29dd7ea12bad0650f54841337f2c0268deef62ed1480a538c082b53a8c

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true
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.pre12 lib/shoes/swt/radio.rb
shoes-swt-4.0.0.pre11 lib/shoes/swt/radio.rb
shoes-swt-4.0.0.pre10 lib/shoes/swt/radio.rb
shoes-swt-4.0.0.pre9 lib/shoes/swt/radio.rb