GtkToggleButton

Description

Create buttons which retain their state

Methods and Functions

gtkToggleButtonNew(show = TRUE)
gtkToggleButtonNewWithLabel(label, show = TRUE)
gtkToggleButtonNewWithMnemonic(label, show = TRUE)
gtkToggleButtonSetMode(object, draw.indicator)
gtkToggleButtonGetMode(object)
gtkToggleButtonToggled(object)
gtkToggleButtonGetActive(object)
gtkToggleButtonSetActive(object, is.active)
gtkToggleButtonGetInconsistent(object)
gtkToggleButtonSetInconsistent(object, setting)
gtkToggleButton(label, show = TRUE)

Hierarchy

1
2
3
4
5
6
7
8
9
GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkButton
                                       +----GtkToggleButton
                                             +----GtkCheckButton

Interfaces

GtkToggleButton implements AtkImplementorIface, GtkBuildable and GtkActivatable.

Detailed Description

A GtkToggleButton is a GtkButton which will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to its normal state.

A toggle button is created by calling either gtkToggleButtonNew or gtkToggleButtonNewWithLabel. If using the former, it is advisable to pack a widget, (such as a GtkLabel and/or a GtkPixmap), into the toggle button's container. (See GtkButton for more information).

The state of a GtkToggleButton can be set specifically using gtkToggleButtonSetActive, and retrieved using gtkToggleButtonGetActive.

To simply switch the state of a toggle button, use gtk_toggle_button_toggled.

Creating two GtkToggleButton widgets.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Let's make two toggle buttons
make_toggles <- function() {
  dialog <- gtkDialog(show = F)
  toggle1 <- gtkToggleButton("Hi, i'm a toggle button.")
  
  ## Makes this toggle button invisible
  toggle1$setMode(TRUE)
   
  gSignalConnect(toggle1, "toggled", output_state)
  dialog[["actionArea"]]$packStart(toggle1, FALSE, FALSE, 2)

  toggle2 <- gtkToggleButton("Hi, i'm another button.")
  toggle2$setMode(FALSE)
  gSignalConnect(toggle2, "toggled", output_state)
  dialog[["actionArea"]]$packStart(toggle2, FALSE, FALSE, 2)

  dialog$showAll()
}

Structures

GtkToggleButton

The GtkToggleButton struct contains private data only, and should be manipulated using the functions below.

drawIndicator

[logical]

Convenient Construction

gtkToggleButton is the result of collapsing the constructors of GtkToggleButton (gtkToggleButtonNew, gtkToggleButtonNewWithLabel, gtkToggleButtonNewWithMnemonic) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.

Signals

toggled(togglebutton, user.data)

Should be connected if you wish to perform an action whenever the GtkToggleButton's state is changed.

togglebutton

the object which received the signal.

user.data

user data set when the signal handler was connected.

Properties

active [logical : Read / Write]

If the toggle button should be pressed in or not. Default value: FALSE

draw-indicator [logical : Read / Write]

If the toggle part of the button is displayed. Default value: FALSE

inconsistent [logical : Read / Write]

If the toggle button is in an "in between" state. Default value: FALSE

Author(s)

Derived by RGtkGen from GTK+ documentation

References

http://library.gnome.org/devel//gtk/GtkToggleButton.html

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.