#
#		Python GUI - Check boxes - Gtk
#

import gtk
from GCheckBoxes import CheckBox as GCheckBox

class CheckBox(GCheckBox):
    
    def __init__(self, title = "New Control", **kwds):
        gtk_checkbox = gtk.CheckButton(title)
        gtk_checkbox.show()
        self._gtk_connect(gtk_checkbox, 'clicked', self._gtk_clicked_signal)
        self._gtk_inhibit_action = 0
        GCheckBox.__init__(self, _gtk_outer = gtk_checkbox, **kwds)
    
    def get_on(self):
        return self._gtk_outer_widget.get_active()
    
    def set_on(self, v):
        self._gtk_inhibit_action = 1
        self._gtk_outer_widget.set_active(v)
        self._gtk_inhibit_action = 0

    def _gtk_clicked_signal(self):
        if not self._gtk_inhibit_action:
            if not self._auto_toggle:
                self.on = not self.on
            self.do_action()
