Need your help on the widget's width and height

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

 



Hello everyone
    I am writing my own gtk widget
    and i want my own widget's height and width ratio is 0.8, like this:

               widget->allocation.height / widget->allocation.width == 0.8

    and my gtk_mywidget_size_allocate() function like this:

-------- Start of my code
-------------------------------------------------------
static void
gtk_mywidget_size_allocate(GtkWidget     *widget,
                           GtkAllocation *allocation)
{
     ……

    if (allocation->height >= allocation->width * 0.8)
            allocation->height = allocation->width;
    else
            allocation->width = allocation->height/0.8;

    widget->allocation = *allocation;

    ……
}
-------- End of my code -----------------------------

   But ,i found ,in my test application,my own widget's size didn't change
   Who can tell my what's wrroy ?
   And who can tell my how to maintain my widget's height, width ratio to a
constant value ?
   
   Any help would be much appreciated !




		
___________________________________________________________ 
雅虎1G免费邮箱百分百防垃圾信 
http://cn.mail.yahoo.com/
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux