[haiku-commits] Re: haiku: hrev48503 - src/preferences/filetypes src/kits/interface docs/user/interface

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 15 Dec 2014 11:44:37 +0100

On 15.12.2014 11:15, pulkomandy@xxxxxxxxxxxxx wrote:
LayoutItem: better documentation for SetExplicitMinSize.

This is a bit counter-intuitive, at least to me, as forcing the minimal
size can lead to the item being smaller than it would otherwise.

----------------------------------------------------------------------------

diff --git a/docs/user/interface/LayoutItem.dox 
b/docs/user/interface/LayoutItem.dox
index 6c85de1..3a73c09 100644
--- a/docs/user/interface/LayoutItem.dox
+++ b/docs/user/interface/LayoutItem.dox
@@ -164,6 +164,11 @@
        \fn void BLayoutItem::SetExplicitMinSize(BSize size) = 0
        \brief Set this item's explicit min size, to be used in MinSize().

+       This forces the minimal size for the item and overrides any constraints
+       that would normally be used to compute it. Most importantly, the minimal
+       size of children is ignored, so setting this can lead to the children 
not
+       fitting the view.
+
        \since Haiku R1
  */

I think it is only confusing, if the general concept is not clear. A view (or layout item) has a minimum size, which is returned by MinSize(). Generally this minimum size is unrelated to the children of the view. Usually, however, it is computed from the size constraints of the children and other properties (e.g. layout direction of BGroupLayout) either by the view itself or by a layout set on the view. In either case, there still is only this one minimum size, and it can be set/overridden explicitly by SetExplicitMinSize(). There is no concept of additional view size constraints. If you want those, you'll have to override MinSize().

I guess the SetExplicit*Size() methods should mention B_SIZE_UNSET, since that is indeed not obvious.

CU, Ingo


Other related posts: