Assuming the the True state of the GtkToggleButton locks the handle of the GtkPaned, this behavior can be achieved by:
- connecting the GtkPaned to the button-press event
- returning with the GtkToggleButton state from the handler
Here is a minimalistic example in python using pygtk
import gtk
def on_paned_button_press_event(*args):
return toggle.get_active() # This is step 2.
win = gtk.Window()
win.set_title('Lock/Unlock the GtkPaned handle example')
win.set_size_request(400, 100)
paned = gtk.HPaned()
toggle = gtk.ToggleButton('Toggle me')
toggle.set_size_request(100, -1)
paned.add1(toggle)
paned.add2(gtk.Label('Toggle the button on the left to lock/unlock the handle'))
paned.connect('button-press-event', on_paned_button_press_event) # This is step 1.
win.add(paned)
win.connect('destroy', gtk.main_quit)
win.show_all()
gtk.main()
It might still be possible to move the handle with the keyboard, so you'd want to connect to the move-handle signal as well for a complete lock.