Re: Multiple documents
- From: "David M. Cook" <dave davidcook org>
- To: gtk-app-devel-list gnome org
- Subject: Re: Multiple documents
- Date: Tue, 26 Aug 2003 10:18:28 -0700
On Tue, Aug 26, 2003 at 03:15:20PM +0000, Chris Garrett wrote:
That is pretty much the way I thought I would have to do it. However, I am
experiencing some confusion about how to ensure that callbacks from the
canvas end up resulting in changes on the correct image.
I use a bit of a hack for this (in Python, but think it should be fairly
clear how to translate to C.)
def canHandleRequests(self):
"""Whether this controller can handle requests, i.e. its toplevel
has been mapped and is not hidden, and its view has focus."""
toplevel = self.view.get_toplevel()
return (toplevel.window
and not (toplevel.window.get_state() # WITHDRAWN=hidden
& gtk.gdk.WINDOW_STATE_WITHDRAWN)
and self.view.is_focus() )
toplevel.window is the gdk window for the toplevel. Substitute whatever
widget you want to handle signals for "view". In my callbacks I check this
before handling the signal. I'm kind of hoping someone will tell me I'm
crazy and there's a more elegant way to do this ;}
Another way has already been described: keep track of what window should
currently handle the signal. But then you still need a way to decide if a
window should handle a signal. In a notebook this is easy; just get the
current page.
Dave Cook
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]