Re: Can't get Gdk::Window from Gtk::Window



On Mon, 2008-04-07 at 18:32 +1000, Adam Nielsen wrote:
> >>  I'm stuck trying to figure out how to get a Gdk::Window from a
> >>  Gtk::Window.
> > 
> > You should be able to use Gtk::Widget::get_window().  This will return
> > NULL before the widget is realized, but after it is realized it should
> > return a valid Gdk::Window.
> 
> That seems to work, I wasn't all that clear on how the inheritance 
> worked between Gtk::Window and Gtk::Widget.

just to be clear: a Gtk::Window IS-A Widget, whereas *some* Widgets
HAVE-A Gdk::Window (note the difference between Gdk:: and Gtk::)

put differently, Gtk::Window is a widget representing a window
containing 1 or more other widgets (actually, it can contain none, but i
digress :). by contrast, a Gdk::Window is a low-level object
representing something provided by the underlying windowing system (X
Window, Quartz, GDI, DirectFB etc etc). Some widgets have their own
low-level window, which is a "child" of the window owned by a
Gtk::Window; other widgets do not have their own Gdk::Window but instead
draw on the one owned by an ancestor (their parent container, or its
parent, etc etc)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]