On Mon, Mar 24, 2008 at 11:33 PM, Adam Nielsen <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm just starting out with gtkmm (and GTK in general) and I'm trying to > make one of these fancy semi-transparent windows. I have some example C > code, but I'm trying to port it to C++ with gtkmm. > > I'm stuck trying to figure out how to get a Gdk::Window from a > Gtk::Window. The docs at > > http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Widget.html > reflect the C code and say I should do this: > > gtk_widget_realize (window); > gdk_window_set_back_pixmap (window->window, <tt>0</tt>, <tt>false</tt>); > gtk_widget_show (window); > > I'm guessing the C code (and HTML!) were included in the C++ docs by > accident, but the best I can come up with as a C++ translation is this: > (which is in a class descended from Gtk::Window) > > this->realize(); > gdk_window_set_back_pixmap(GTK_WIDGET(this->gobj())->window, 0, > false); > this->show(); > > Which looks horrible, and I don't even know if it works. I thought > maybe I could use Gtk::Window::get_frame() to get a Gdk::Window instead, > but that function always returns NULL, apparently because of the > underlying windowing system.
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. > At any rate, even if I could get a valid Gdk::Window object, the > documentation at > > http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGdk_1_1Window.html > says I should pass 0 as the first parameter to > Gdk::Window::set_back_pixmap(), but this gives me a compile-time error, > because the first parameter is not an integer (it's a const > Glib::RefPtr<Pixmap>&) (I don't remember if you ever got a reply or not, but just in case you didnt...) Yes, this seems like a case where the the C documentation was not customized correctly for the C++ API. I think you should be able to pass a 'NULL' RefPtr<Pixmap> to this parameter and it should work. e.g. Glib::RefPtr<Pixmap> none; w->set_back_pixmap(none ...) I haven't tested it to make sure though. here's a bug I filed for the issue: http://bugzilla.gnome.org/show_bug.cgi?id=525967 -- jonner _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
