Re: Widgets inside a GtkDrawingArea



Olexiy Avramchenko wrote:
Sander Marechal wrote:
Is there a way to add a button inside (or on top) a GtkDrawingArea using glade? Or using Gtk directly in C? Glade wouldn't let me add one. If it isn't possible, is there an easy way I can "fake" the effect of a button sitting in the middle of the drawing area?

Hi,
You can't add a children widget to drawing area (it's not so easy, at least). Take a look at GtkLayout instead of GtkDrawingArea. This widget provides a window GtkLayout::bin_window that can be used for custom drawing like GtkDrawingArea and also it is a container like GtkFixed.

http://developer.gnome.org/doc/API/2.0/gtk/GtkLayout.html

Thank you, I got it partially how I want it.

The button is sitting neatly on top of the playing area now, but it has a small grey box around it. See the screenshot at [1]. I think that the 1 pixel grey border is added by an invisible container widget that holds the button in question somehow. I have set all the border values on the button to 0 already, so I think it's not the button itself.

Is it possible to remove that container, or set it's grey background to transparent so that the rounded button shape is drawn directly on the green canvas? A GIMPed mockup of the desired result is at [2].

It's no problem if it can't be done in Glade directly. I can simply load the glade XML file in C and execute a couple additional GTK commands on the button or it's container.

Thanks again!

[1] http://www.jejik.com/sander/hearts.png
[2] http://www.jejik.com/sander/hearts2.png

--
Sander Marechal



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