Re: GtkImageMenuItem size incorrect



On 5/6/07, David Nečas (Yeti) <yeti physics muni cz> wrote:
On Sun, May 06, 2007 at 10:22:52AM +0530, Gaurav Jain wrote:
>
> I'm trying to create some GtkImageMenuItems in the menu of my
> application, and I found strange sizing issues.
>
> I noticed that even if the height of the GtkImage that is added to the
> menu item is 16 pixels, the actual height of the menu item that is
> shown on the screen is dependent on the width of the GtkImage.  In
> other words, if I have a GtkImage of 32 X 16 added to the menu item,
> the height of the entire menu item becomes around 32 pixels.
>
> This is strange behavior, as I expected the height to remain at around
> 16 pixels since the GtkImage's height is only 16.  If in the same menu
> I add other menu items without any GtkImage then their height is
> normal.
>
> Is this a GTK bug?  Is there a workaround that I can use to ensure
> that the height of the menu item doesn't increase unnecessarily?

The height requested is something like max(height, width).
It has been `working' this way since Gtk+ 2.4 (and it broke
my apps at that time).  It seems to be already reported:

  http://bugzilla.gnome.org/show_bug.cgi?id=336031

I suppose everyone affected just shrugs and packs an image
+ label to the menu item himself instead of using
GtkImageMenuItem (that's what I do too).

Yeti

Thanks Yeti for the information!  One more help please - could you
please tell me how to pack an image + Label to a GtkMenuItem?  I'm
unsure how you managed this, because if I try to replace the existing
child label in the GtkMenuItem with a hbox containing both an image
and label it doesn't work.

Thanks again!
Gaurav


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