gtkmm  3.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions
Gtk::ToggleAction Class Reference

An action which can be toggled between two states. More...

Inheritance diagram for Gtk::ToggleAction:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~ToggleAction ()
GtkToggleAction* gobj ()
 Provides access to the underlying C GObject.
const GtkToggleAction* gobj () const
 Provides access to the underlying C GObject.
GtkToggleAction* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void toggled ()
 Emits the "toggled" signal on the toggle action.
void set_active (bool is_active=true)
 Sets the checked state on the toggle action.
bool get_active () const
 Returns the checked state of the toggle action.
void set_draw_as_radio (bool draw_as_radio=true)
 Sets whether the action should have proxies like a radio action.
bool get_draw_as_radio () const
 Returns whether the action should have proxies like a radio action.
Glib::SignalProxy0< void > signal_toggled ()
Glib::PropertyProxy< bool > property_draw_as_radio ()
 Whether the proxies for this action look like radio action proxies.
Glib::PropertyProxy_ReadOnly
< bool > 
property_draw_as_radio () const
 Whether the proxies for this action look like radio action proxies.
Glib::PropertyProxy< bool > property_active ()
 Whether the toggle action should be active.
Glib::PropertyProxy_ReadOnly
< bool > 
property_active () const
 Whether the toggle action should be active.

Static Public Member Functions

static Glib::RefPtr< ToggleActioncreate ()
static Glib::RefPtr< ToggleActioncreate (const Glib::ustring& name, const Glib::ustring& label=Glib::ustring(), const Glib::ustring& tooltip=Glib::ustring(), bool is_active=false)
 Creates a toggle action.
static Glib::RefPtr< ToggleActioncreate (const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label=Glib::ustring(), const Glib::ustring& tooltip=Glib::ustring(), bool is_active=false)
 Creates a toggle action with a stock ID.
static Glib::RefPtr< ToggleActioncreate_with_icon_name (const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip, bool is_active=false)
 Creates a toggle action with an icon name.

Protected Member Functions

 ToggleAction ()
 Creates an empty toggle action.
 ToggleAction (const Glib::ustring& name, const StockID& stock_id=StockID(), const Glib::ustring& label=Glib::ustring(), const Glib::ustring& tooltip=Glib::ustring(), bool is_active=false)
 Creates a toggle action.
 ToggleAction (const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label=Glib::ustring(), const Glib::ustring& tooltip=Glib::ustring(), bool is_active=false)
 Creates a toggle action with an icon name.
virtual void on_toggled ()
 This is a default handler for the signal signal_toggled().

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::ToggleActionwrap (GtkToggleAction* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

An action which can be toggled between two states.

A Gtk::ToggleAction corresponds roughly to a Gtk::CheckMenuItem. It has an "active" state specifying whether the action has been checked or not.


Constructor & Destructor Documentation

virtual Gtk::ToggleAction::~ToggleAction ( ) [virtual]

Creates an empty toggle action.

Gtk::ToggleAction::ToggleAction ( const Glib::ustring name,
const StockID stock_id = StockID(),
const Glib::ustring label = Glib::ustring(),
const Glib::ustring tooltip = Glib::ustring(),
bool  is_active = false 
) [explicit, protected]

Creates a toggle action.

Parameters:
nameA unique name for the action.
stock_idThe stock icon to display in widgets representing the action.
labelThe label displayed in menu items and on buttons.
tooltipA tooltip for the action.
is_activeThe default checked state of the action.
Gtk::ToggleAction::ToggleAction ( const Glib::ustring name,
const Glib::ustring icon_name,
const Glib::ustring label = Glib::ustring(),
const Glib::ustring tooltip = Glib::ustring(),
bool  is_active = false 
) [explicit, protected]

Creates a toggle action with an icon name.

The toggle action's icon will reflect the specified icon name in the user's icon theme.

Parameters:
nameA unique name for the action.
icon_nameAn IconTheme icon name used for widgets representing the action.
labelThe label displayed in menu items and on buttons.
tooltipA tooltip for the action.
is_activeThe default checked state of the action.

Member Function Documentation

Reimplemented from Gtk::Action.

Reimplemented in Gtk::RadioAction.

static Glib::RefPtr<ToggleAction> Gtk::ToggleAction::create ( const Glib::ustring name,
const Glib::ustring label = Glib::ustring(),
const Glib::ustring tooltip = Glib::ustring(),
bool  is_active = false 
) [static]

Creates a toggle action.

Parameters:
nameA unique name for the action.
labelThe label displayed in menu items and on buttons.
tooltipA tooltip for the action.
is_activeThe default checked state of the action.
Returns:
A new ToggleAction.
static Glib::RefPtr<ToggleAction> Gtk::ToggleAction::create ( const Glib::ustring name,
const Gtk::StockID stock_id,
const Glib::ustring label = Glib::ustring(),
const Glib::ustring tooltip = Glib::ustring(),
bool  is_active = false 
) [static]

Creates a toggle action with a stock ID.

The tock ID is used to set a default icon, text and accelerator for the toggle action.

Parameters:
nameA unique name for the action.
stock_idThe stock icon to display in widgets representing the action.
labelThe label displayed in menu items and on buttons.
tooltipA tooltip for the action.
is_activeThe default checked state of the action.
Returns:
A new ToggleAction.
static Glib::RefPtr<ToggleAction> Gtk::ToggleAction::create_with_icon_name ( const Glib::ustring name,
const Glib::ustring icon_name,
const Glib::ustring label,
const Glib::ustring tooltip,
bool  is_active = false 
) [static]

Creates a toggle action with an icon name.

The toggle action's icon will reflect the specified icon name in the user's icon theme.

Parameters:
nameA unique name for the action.
icon_nameAn IconTheme icon name used for widgets representing the action.
labelThe label displayed in menu items and on buttons.
tooltipA tooltip for the action.
is_activeThe default checked state of the action.
Returns:
A new ToggleAction.

Returns the checked state of the toggle action.

Since gtkmm 2.4:
Returns:
The checked state of the toggle action.

Returns whether the action should have proxies like a radio action.

Since gtkmm 2.4:
Returns:
Whether the action should have proxies like a radio action.
GtkToggleAction* Gtk::ToggleAction::gobj ( ) [inline]

Provides access to the underlying C GObject.

Reimplemented from Gtk::Action.

Reimplemented in Gtk::RadioAction.

const GtkToggleAction* Gtk::ToggleAction::gobj ( ) const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gtk::Action.

Reimplemented in Gtk::RadioAction.

GtkToggleAction* Gtk::ToggleAction::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gtk::Action.

Reimplemented in Gtk::RadioAction.

virtual void Gtk::ToggleAction::on_toggled ( ) [protected, virtual]

This is a default handler for the signal signal_toggled().

Whether the toggle action should be active.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Whether the toggle action should be active.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Whether the proxies for this action look like radio action proxies.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Whether the proxies for this action look like radio action proxies.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
void Gtk::ToggleAction::set_active ( bool  is_active = true)

Sets the checked state on the toggle action.

Since gtkmm 2.4:
Parameters:
is_activeWhether the action should be checked or not.
void Gtk::ToggleAction::set_draw_as_radio ( bool  draw_as_radio = true)

Sets whether the action should have proxies like a radio action.

Since gtkmm 2.4:
Parameters:
draw_as_radioWhether the action should have proxies like a radio action.
Slot Prototype:
void on_my_toggled()

Should be connected if you wish to perform an action whenever the Gtk::ToggleAction state is changed.

Emits the "toggled" signal on the toggle action.

Since gtkmm 2.4:

Friends And Related Function Documentation

Glib::RefPtr< Gtk::ToggleAction > wrap ( GtkToggleAction *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file: