Skip to main content

RadioButtonExt

Trait RadioButtonExt 

Source
pub trait RadioButtonExt:
    IsA<RadioButton>
    + Sealed
    + 'static {
    // Provided methods
    fn group(&self) -> Vec<RadioButton> { ... }
    fn join_group(&self, group_source: Option<&impl IsA<RadioButton>>) { ... }
    fn connect_group_changed<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all RadioButton methods.

§Implementors

RadioButton

Provided Methods§

Source

fn group(&self) -> Vec<RadioButton>

Retrieves the group assigned to a radio button.

§Returns

a linked list containing all the radio buttons in the same group as self. The returned list is owned by the radio button and must not be modified or freed.

Source

fn join_group(&self, group_source: Option<&impl IsA<RadioButton>>)

Joins a RadioButton object to the group of another RadioButton object

Use this in language bindings instead of the group() and gtk_radio_button_set_group() methods

A common way to set up a group of radio buttons is the following:

⚠️ The following code is in C ⚠️

  GtkRadioButton *radio_button;
  GtkRadioButton *last_button;

  while (some_condition)
    {
       radio_button = gtk_radio_button_new (NULL);

       gtk_radio_button_join_group (radio_button, last_button);
       last_button = radio_button;
    }
§group_source

a radio button object whos group we are joining, or None to remove the radio button from its group

Source

fn connect_group_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Emitted when the group of radio buttons that a radio button belongs to changes. This is emitted when a radio button switches from being alone to being part of a group of 2 or more buttons, or vice-versa, and when a button is moved from one group of 2 or more buttons to a different one, but not when the composition of the group that a button belongs to changes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§