[gui] [PATCH] Fix List peer's native getSize() method

Thomas Fitzsimmons fitzsim@redhat.com
Tue May 25 18:54:00 GMT 2004


On Tue, 2004-05-25 at 11:25, David Jee wrote:
> Hello,
> 
> I committed the following patch to the java-gui-branch.  It fixes List
> peer's native getSize() method, so that it properly queries for the
> widget's natural size.  The patch also fixes a bug in GtkComponentPeer's
> constructor, which was preventing component peers from receiving
> setBounds() calls.
> 

Hi,

> +  /* Calculate the final height, by comparing the number of rows
> +     in the list to the number of rows requested by the caller.
> +     FIXME: Is there a GTK method that counts the number of rows
> +     in the list? If so, we don't need to bring visible_rows from
> +     the Java peer. */

GTK doesn't provide a convenient way to find the number of visible
rows.  I think your approach is fine, so this FIXME can be removed.

> +  if (rows == visible_rows)
> +    dims[1] = natural_req.height;
> +  else
> +    dims[1] = natural_req.height / visible_rows * rows;

This isn't going to work when there is a horizontal scrollbar on the
list.  You'll need to add a function like
GtkTextAreaPeer.getHScrollbarHeight here.

Tom




More information about the Java-patches mailing list