[haiku-bugs] Re: [Haiku] #7447: *LayoutBuilder::DefaultInsets()

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Sun, 17 Apr 2011 14:31:48 -0000

#7447: *LayoutBuilder::DefaultInsets()
----------------------------------+----------------------------
   Reporter:  jonas.kirilla       |      Owner:  yourpalal
       Type:  enhancement         |     Status:  assigned
   Priority:  normal              |  Milestone:  R1
  Component:  Kits/Interface Kit  |    Version:  R1/Development
 Resolution:                      |   Keywords:
 Blocked By:                      |   Blocking:
Has a Patch:  0                   |   Platform:  All
----------------------------------+----------------------------
Changes (by bonefish):

 * cc: stippi (added)
 * status:  reopened => assigned
 * owner:  axeld => yourpalal


Comment:

 Replying to [comment:4 jonas.kirilla]:
 > Yes, some shorthand for BControlLook-based insets. (But I'm not sure if
 the item spacing BControlLook provides applies to insets.)

 Maybe a set of constants for different inset situations could be defined
 and `BControlLook` could provide the respective inset values. Maybe that
 even depends on the kind of frame around the inset area.

 > There are some uses of
 (BTwoDimensionalLayout::)SetInsets(B_USE_DEFAULT_SPACING,
 B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING) which
 could perhaps be helped by a single-argument version - SetInsets(float
 side) - or a no-argument version.

 Yep, a single argument version of SetInsets() can certainly be added for
 convenience to both BTwoDimensionalLayout and the builders and also a
 version with two arguments (horizontal/vertical). I'm not in favor of a
 no-argument version, as it is not clear what inset values it would set.

 > Perhaps a BInsets class, grouping a quad of floats, sort of BRect-like,
 defaulting to non-zero values?

 Introducing a BInsets class is possible (since the layout management API
 was inspired by Java's I considered it back then), but not for this
 purpose. We should introduce such class only, if we decide that it is
 passed around and used enough to improve convenience. I didn't add it,
 because it turned out that there were really only the `{Set,Get}Insets()`
 methods where it would have been used.

 > (Or one could make the layout classes default to non-zero insets. I
 don't know what makes the most sense.)

 Indeed. :-) The default constructor should initialize the object to 0
 insets. Global constants or getters (e.g. in BControlLook) could be added
 to provide insets for different situations. That's also what should be
 analyzed first: What are the situations and how do we want to provide the
 insets? Whether a BInsets class is introduced can be decided when that is
 clearer.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7447#comment:5>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: