Re: creating a custom button in GTK--



On Thu, Jan 13, 2005 at 09:40:04 +0100, Akos Maroy wrote:
> Thanks for your reply.

Please, keep the messages Cc'ed to the list.

> >What do you set to the x and y fileds of the allocation?
> >
> >Since you are creating an active widget, it must have a window. Gtk::Bin
> >by itself does not allocate it. Have you done this? (Note: If you
> 
> actually, I've been experimenting with it, but without succss. First, I 
> tried the custom_widget example, which is also part of the 
> documentation, and comes with the source tarball. there, a window is 
> allocated, and something drawn into it. unfortunately, when I compile 
> that sample, it doesn't show anything in the place of MyWidget - somehow 
> the embedded window object just doesn't display... :(

I believe some flags must be properly set and such.

> >subclass Gtk::Button, you would get that for free too).
> 
> and I'd access that window with get_window()? I also found it strange

But we are talking about creating it. It takes to set some flags and
invoking some magic in realize or map or thereabout, but I don't recall
the details.

Anyway, if you subclass Gtk::Button instead of Gtk::Bin, you will get
all this, since Gtk::Button does have a window.

> that get_window() in Bin actually returns the parent window. but maybe 
> this is the explanation: as Bin doesn't actually have a window, that's 
> the best it can do...

Yes. The method is defined that way. It returns the window that the
widget is drawn on.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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