开发者

overlapping widgets gtk

How can i make widgets overlap one 开发者_如何学Pythonanother.

Lower most should be image, rest above can be other widgets like buttons.

overlapping widgets gtk


Subclass the larger(parent) widget. In a create() method or in the constructor, add a layout( or container) widget to the parent widget, then inset the others into the container. Now threat this new subclass as if it were a single, but specialized, version of its super class.

A Window is an example of a parent widget, while Fixed is an example container. A child could be an EventBox enclosing an Image. The composite of all these is a new window object that has pictures that can be clicked.

For the case of a window's titlebar look with a pixmap background, and buttons, try a Window with an Image and a Fixed container to hold the buttons. The Fixed and the Image should be able to overlap as the Fixed is transparent, and an Image has no Window.

If Buttons are truly what's needed, have a look at Button Boxes and Toolbars in the list of GTK Containers. It may be possible to add an Image background to one of those.

A different approach involves an Alignment Widget(from the same list). It specifies where the smaller widgets are positioned and sized in a proportioned manner.

I assumed, OOP, but if it's not, just organize the creation of the widgets from one function. I've made composite widgets functionally in Haskell(Gtk2Hs), and in Guile Gnome Platform (with and without OOP)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜