java-gnome version 4.0.15

org.gnome.gtk
Class CellRendererToggle

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.Object
                  extended by org.gnome.gtk.CellRenderer
                      extended by org.gnome.gtk.CellRendererToggle

public class CellRendererToggle
extends CellRenderer

Renders a Toggle Button into a TreeViewColumn. This CellRenderer may be used to present boolean data to the user. The fundamental mapping method is setActive() which you use to indicate the particular DataColumnBoolean from the underlying TreeModel which will provide the boolean values.

Since:
4.0.8
Author:
Andreas Kuehntopf

Nested Class Summary
static interface CellRendererToggle.Toggled
          Signal emitted after user toggles the rendered toggle button in a cell.
 
Constructor Summary
CellRendererToggle(TreeViewColumn vertical)
          Construct a new CellRendererToggle.
 
Method Summary
 void connect(CellRendererToggle.Toggled handler)
          Hook up a signal handler to receive "toggled" events on this CellRenderer.
 boolean getActive()
          Get the current state of the toggle button.
 void setActivatable(boolean setting)
          Indicate if the CellRendererToggle's toggle button is actually activatable, which means that clicking the toggle button causes a change in the CellRendererToggle's state.
 void setActive(boolean setting)
          Indicate if the CellRendererToggle's toggle button should be active.
 void setActive(DataColumnBoolean column)
          Indicate a DataColumnBoolean you want the state of the CellRendererToggle to be bound to.
 void setRadio(boolean setting)
          Indicate the appearance of this CellRenderer.
 
Methods inherited from class org.gnome.gtk.CellRenderer
setAlignment, setBackground, setBackground, setVisible
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CellRendererToggle

public CellRendererToggle(TreeViewColumn vertical)
Construct a new CellRendererToggle. Specify the TreeViewColumn it will belong to.

Since:
4.0.8
Method Detail

connect

public void connect(CellRendererToggle.Toggled handler)
Hook up a signal handler to receive "toggled" events on this CellRenderer. A typical example of how this is used is as follows:
 final DataColumnBoolean column;
 final TreeView view;
 final ListStore store;
 final TreeViewColumn vertical;
 
 store = new ListStore(new DataColumn[] {
     column = new DataColumnBoolean()
 });
 
 view = new TreeView(store);
 vertical = view.appendColumn();
 CellRendererToggle renderer = new CellRendererToggle(vertical);
 renderer.setActive(column);
 renderer.connect(new TOGGLED() {
     public void onToggled(CellRendererToggle renderer, TreePath path) {
         System.out.println("Path " + path + " toggled to " + renderer.getActive());
     }
 });
 

Since:
4.0.8

getActive

public boolean getActive()
Get the current state of the toggle button.

Since:
4.0.8

setActivatable

public void setActivatable(boolean setting)
Indicate if the CellRendererToggle's toggle button is actually activatable, which means that clicking the toggle button causes a change in the CellRendererToggle's state. Please note that toggling the toggle button does not cause a change in the underlying model.

A CellRendererToggle is activatable by default.

Since:
4.0.8

setActive

public void setActive(boolean setting)
Indicate if the CellRendererToggle's toggle button should be active.

If you want to bind the state of the toggle button to a DataColumn you might want to use the overloaded method setActive().

Since:
4.0.8

setActive

public void setActive(DataColumnBoolean column)
Indicate a DataColumnBoolean you want the state of the CellRendererToggle to be bound to. This is the method you should use if you want make the toggle's state dynamic based on data in the TreeModel underlying the TreeView you are presenting in.

Since:
4.0.8

setRadio

public void setRadio(boolean setting)
Indicate the appearance of this CellRenderer. If this is set to true a radio button is used instead of the default check box.

Since:
4.0.8


java-gnome