Crea  Modifica  FrontPage  Indici  Cerca  Ultime modifiche  History  RSS  Login

Gtk::ToggleButton

class Gtk::ToggleButton

A Gtk::ToggleButton is a Gtk::Button which will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to it's normal state.

The state of a Gtk::ToggleButton can be set specifically using Gtk::ToggleButton#active=, and retrieved using Gtk::ToggleButton#active?.

To simply switch the state of a toggle button, use Gtk::ToggleButton#toggled.

Class Methods

Gtk::ToggleButton.new(label = nil, use_underline = false)
Creates a new Gtk::ToggleButton with a Gtk::Label to the right of it. If use_underline is true, the label will be created underscores in label indicate the mnemonic for the check button.
  • label : the text label to display next to the radio button.
  • use_underline : true if the label will be created underscores in label indicate the mnemonic for check button.
  • Returns: a new Gtk::ToggleButton.
Gtk::ToggleButton.new(stock)
Creates a new Gtk::ToggleButton with a Gtk::Stock constant value.

Instance Methods

active?
Queries a Gtk::ToggleButton and returns it's current state. Returns: true if the toggle button is pressed in and false if it is raised.
active=(active)
Sets the status of the toggle button. Set to true if you want the Gtk::ToggleButton to be 'pressed in', and false to raise it. This action causes the toggled signal to be emitted.
  • active: true or false.
  • Returns: active.
set_active(active)
Same as Gtk::ToggleButton#active=.
  • active: true or false.
  • Returns: self
draw_indicator?
Gets the value set by Gtk::ToggleButton#draw_indicator=.
  • Returns: true if the toggle part of the button is displayed, false otherwise
draw_indicator=(draw_indicator)
Sets the toggle part of the button is displayed or not.
  • draw_indicator: true if the toggle part of the button is displayed, false otherwise
  • Returns: draw_inidicator
set_draw_indicator(draw_indicator)
Same as Gtk::ToggleButton#draw_indicator=.
  • draw_indicator: true if the toggle part of the button is displayed, false otherwise
  • Returns: self
inconsistent?
Gets the value set by Gtk::ToggleButton#inconsistent=.
  • Returns: true if the button is displayed as inconsistent, false otherwise
inconsistent=(setting)
If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. This function turns on "in between" display. Normally you would turn off the inconsistent state again if the user toggles the toggle button. This has to be done manually, Gtk::ToggleButton#inconsistent= only affects visual appearance, it doesn't affect the semantics of the button.
  • setting: true if state is inconsistent
  • Returns: setting
set_inconsistent(setting)
Same as Gtk::ToggleButton#inconsistent=.
  • setting: true if state is inconsistent
  • Returns: self
mode?
Retrieves whether the button is displayed as a separate indicator and label. See Gtk::ToggleButton#mode=.
  • Returns: true if the togglebutton is drawn as a separate indicator and label.
mode=(draw_indicator)
Sets whether the button is displayed as a separate indicator and label. You can call this method on a checkbutton or a radiobutton with draw_indicator = false to make the button look like a normal button. This function only effects instances of classes like Gtk::CheckButton and Gtk::RadioButton that derive from Gtk::ToggleButton, not instances of Gtk::ToggleButton itself.
  • draw_indicator : if true, draw the button as a separate indicator and label; if false, draw the button like a normal button
  • Returns: draw_indicator
set_mode(draw_indicator)
Same as Gtk::ToggleButton#mode=.
  • draw_indicator : if true, draw the button as a separate indicator and label; if false, draw the button like a normal button
  • Returns: self
toggled
Emits the toggled signal on the Gtk::ToggleButton. There is no good reason for an application ever to call this function.
  • Returns: self

Properties

active: true or false (Read/Write)
If the toggle button should be pressed in or not
draw-indicator: true or false (Read/Write)
If the toggle part of the button is displayed
inconsistent: true or false (Read/Write)
If the toggle button is in an "in between" state

Signals

toggled: self
  • self: the object which received the signal.

See Also

- Masao

Ultima modifica:2005/11/17 02:43:41
Parola chiave:
Referenze:[Gtk::Toolbar] [Gtk::ToggleButton] [Gtk::CheckButton] [Gtk::ToggleToolButton] [Gtk::RC] [Gtk::RadioButton]