class Sirens::RadioButtonView

Public Class Methods

new(previous_button:, on_toggled:) click to toggle source

Initializing

Calls superclass method
# File lib/views/radio_button_view.rb, line 17
def initialize(previous_button:, on_toggled:)
    @previous_button = previous_button.main_handle unless previous_button.nil?

    @on_toggled_block = on_toggled

    super()
end
view_accepted_styles() click to toggle source

Answer the styles accepted by this view.

Calls superclass method
# File lib/views/radio_button_view.rb, line 10
def view_accepted_styles()
    super() + [:label].freeze
end

Public Instance Methods

click() click to toggle source

Actions

# File lib/views/radio_button_view.rb, line 47
def click()
    main_handle.clicked
end
get_value() click to toggle source

Querying

# File lib/views/radio_button_view.rb, line 53
def get_value()
    main_handle.active?
end
initialize_handles() click to toggle source
# File lib/views/radio_button_view.rb, line 25
def initialize_handles()
    @main_handle = Gtk::RadioButton.new(member: @previous_button)
end
label() click to toggle source
# File lib/views/radio_button_view.rb, line 41
def label()
    main_handle.label
end
label=(value) click to toggle source

Styles

# File lib/views/radio_button_view.rb, line 37
def label=(value)
    main_handle.label = value
end
on_toggled() click to toggle source

Events

# File lib/views/radio_button_view.rb, line 63
def on_toggled()
    @on_toggled_block.call(state: get_value)
end
set_value(boolean) click to toggle source
# File lib/views/radio_button_view.rb, line 57
def set_value(boolean)
    main_handle.active = boolean
end
subscribe_to_ui_events() click to toggle source
# File lib/views/radio_button_view.rb, line 29
def subscribe_to_ui_events()
    main_handle.signal_connect('clicked') {
        on_toggled
    }
end