Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Inti::Gtk::RadioButton Class Reference

A GtkRadioButton C++ wrapper class. More...

#include <inti/gtk/radiobutton.h>

Inheritance diagram for Inti::Gtk::RadioButton:

Inti::Gtk::CheckButton Inti::Gtk::ToggleButton Inti::Gtk::Button Inti::Gtk::Bin Inti::Gtk::Container Inti::Gtk::Widget Inti::Gtk::Object Inti::Atk::Implementor Inti::G::Object Inti::G::TypeInterface Inti::G::TypeInstance Inti::MemoryHandler Inti::G::TypeInstance Inti::ReferencedBase Inti::ReferencedBase List of all members.

Public Types

Public Member Functions

Constructors
Accessors
Methods
Property Proxies

Protected Member Functions

Constructors

Detailed Description

A GtkRadioButton C++ wrapper class.

A single radio button performs the same basic function as a CheckButton, as it's position in the object hierarchy reflects. It is only when multiple radio buttons are grouped together that they become a different user interface component in their own right.

Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are deselected. A RadioButton is one way of giving the user a choice from many options.

The first radio button in a group is constructed with one of the constructors that doesn't have a group argument. These are:

    RadioButton();
    RadioButton(const String& label, bool use_underline = false);
Then subsequent radio buttons in the group are constructed with one of the constructors that requires a group. These are:
    RadioButton(Group *group);
    RadioButton(const RadioButton *group);
    RadioButton(Group *group, const String& label, bool use_underline = false);
    RadioButton(const RadioButton *group, const String& label, bool use_underline = false);
There are two types of group arguments. The first, Group, is a typedef for GSList and can be retrieved by calling get_group(). The second is just a pointer to a RadioButton that already has a group assigned to it. To remove a RadioButton from one group and make it part of a new one, use set_group().

Example: How to create a group of three radio buttons.

    #include <inti/main.h>
    #include <inti/core.h>
    #include <inti/gtk/radiobutton.h>
    #include <inti/gtk/separator.h>
   
    using namespace Inti;
   
    class RadioButtonWindow : public Gtk::Window
    {
    public:
        RadioButtonWindow();
    };
   
    RadioButtonWindow::RadioButtonWindow()
    {
        set_border_width(0);
   
        Gtk::VBox *box1 = new Gtk::VBox;
        add(*box1);
        box1->show();
   
        Gtk::VBox *box2 = new Gtk::VBox(false, 10);
        box2->set_border_width(10);
        box1->pack_start(*box2);
        box2->show();
   
        Gtk::RadioButton *radio_button = new Gtk::RadioButton("button1");
        box2->pack_start(*radio_button);
        radio_button->show();
   
        radio_button = new Gtk::RadioButton(radio_button, "button2");
        radio_button->set_active(true);
        box2->pack_start(*radio_button);
        radio_button->show();
   
        radio_button = new Gtk::RadioButton(radio_button, "button3");
        box2->pack_start(*radio_button);
        radio_button->show();
   
        Gtk::HSeparator *separator = new Gtk::HSeparator;
        box1->pack_start(*separator, false);
        separator->show();
   
        box2 = new Gtk::VBox(false, 10);
        box2->set_border_width(10);
        box1->pack_start(*box2, false);
        box2->show();
   
        Gtk::Button *button = new Gtk::Button("close");
        button->sig_clicked().connect(slot(this, &RadioButtonWindow::dispose));
        box2->pack_start(*button);
        button->set_flags(Gtk::CAN_DEFAULT);
        button->grab_default();
        button->show();
    }
   
    int main (int argc, char *argv[])
    {
        using namespace Main;
   
        init(&argc, &argv);
   
        RadioButtonWindow window;
        window.sig_destroy().connect(slot(&Inti::Main::quit));
        window.show();
   
        run();
        return 0;
    }


Constructor & Destructor Documentation

Inti::Gtk::RadioButton::RadioButton GtkRadioButton *  radio_button,
bool  reference = false
[explicit, protected]
 

Construct a new RadioButton from an existing GtkRadioButton.

Parameters:
radio_button A pointer to a GtkRadioButton.
reference Set false if the initial reference count is floating, set true if it's not.

The radio_button can be a newly created GtkRadioButton or an existing GtkRadioButton (see G::Object::Object).

Inti::Gtk::RadioButton::RadioButton  ) 
 

Construct a new radio button in a new group.

To be of any practical value, a widget should then be packed into the radio button.

Inti::Gtk::RadioButton::RadioButton Group group  )  [explicit]
 

Construct a new radio button and add it to group.

Parameters:
group An existing radio button group, or null if you are creating a new group.

To be of any practical value, a widget should then be packed into the radio button.

Inti::Gtk::RadioButton::RadioButton const RadioButton group  )  [explicit]
 

Construct a new radio button, adding it to the same group as group.

Parameters:
group An existing radio button.

To be of any practical value, a widget should then be packed into the radio button.

Inti::Gtk::RadioButton::RadioButton const String label,
bool  use_underline = false
 

Construct a new radio button with a text label, in a new group.

Parameters:
label The text label to display next to the radio button.
use_underline Set true if label contains a mnemonic character.

Inti::Gtk::RadioButton::RadioButton Group group,
const String label,
bool  use_underline = false
 

Construct a new radio button with a text label and add it to group.

Parameters:
group An existing radio button group, or null if you are creating a new group.
label The text label to display next to the radio button.
use_underline Set true if label contains a mnemonic character.

Inti::Gtk::RadioButton::RadioButton const RadioButton group,
const String label,
bool  use_underline = false
 

Construct a new radio button with a text label, adding it to the same group as group.

Parameters:
group An existing radio button.
label The text label to display next to the radio button.
use_underline Set true if label contains a mnemonic character.


Member Function Documentation

Group* Inti::Gtk::RadioButton::get_group  )  const
 

Retrieves the group assigned to the radio button.

Returns:
A linked list containing all the radio buttons in the same group as this radio button.

void Inti::Gtk::RadioButton::set_group Group group  ) 
 

Sets a radio button's group.

Parameters:
group An existing radio button group, such as one returned from get_group().

It should be noted that this does not change the layout of your interface in any way, so if you are changing the group, it is likely you will need to re-arrange the user interface to reflect these changes.


The documentation for this class was generated from the following file: Main Page - Footer


Generated on Sun Sep 14 20:08:17 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002