[haiku-commits] Re: r36756 - haiku/trunk/src/kits/interface

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 08 May 2010 22:26:23 +0200

On 2010-05-08 at 21:45:13 [+0200], ithamar.adema@xxxxxxxxxxxxxxxx wrote:
> Author: ithamar
> Date: 2010-05-08 21:45:13 +0200 (Sat, 08 May 2010)
> New Revision: 36756
> Changeset: http://dev.haiku-os.org/changeset/36756/haiku
> 
> Modified:
>    haiku/trunk/src/kits/interface/ListView.cpp
> Log:
> * Revert MinSize() and PreferredSize() to the normal BView variants, since 
> unlike the comment says GetPreferredSize() actually looks at the content of 
> the listview to determine the size.
> 
> 
> Modified: haiku/trunk/src/kits/interface/ListView.cpp
> ===================================================================
> --- haiku/trunk/src/kits/interface/ListView.cpp    2010-05-08 19:44:38 UTC 
> (rev 36755)
> +++ haiku/trunk/src/kits/interface/ListView.cpp    2010-05-08 19:45:13 UTC 
> (rev 36756)
> @@ -616,9 +616,7 @@
>  BSize
>  BListView::MinSize()
>  {
> -    // We need a stable min size: the BView implementation uses
                    ^^^^^^
> -    // GetPreferredSize(), which by default just returns the current size.
> -    return BLayoutUtils::ComposeSize(ExplicitMinSize(), BSize(10, 10));
> +    return BView::MinSize();
>  }
>  
>  
> @@ -632,9 +630,7 @@
>  BSize
>  BListView::PreferredSize()
>  {
> -    // We need a stable preferred size: the BView implementation uses
                    ^^^^^^
> -    // GetPreferredSize(), which by default just returns the current size.
> -    return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), BSize(100, 
> 50));
> +    return BView::PreferredSize();
>  }


If GetPreferredSize() looks at the content and reports different sizes, we 
are back to the broken behavior, which the above tried to fix. In another 
words, MinSize() and PreferredSize() need to return stable sizes, at least 
until InvalidateLayout() has been called. I don't believe you want to call 
InvalidateLayout() on each item operation in a BListView.

Best regards,
-Stephan

Other related posts: