[haiku-development] Re: AddGlue() as a metaphor behaves opposite what is expected

  • From: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 26 Feb 2017 08:31:48 +0100

On Sat, Feb 25, 2017 at 09:16:22AM -0500, Brian Hill wrote:

This may be a slight rant but I am always struggling with remembering the 
proper use of the layout builder AddGlue() function.  It exhibits a totally 
opposite behavior from real life glue, which is used to stick two things 
together so they do not separate.  AddGlue() does the opposite, adds an 
expandable space layout item so the two things you stick the AddGlue() to can 
move apart.  It is probably too late to change, but can we deprecate 
AddGlue() and replace it with something else like AddEmptySpace(), 
AddWhiteSpace() or even AddNegativeSpace()?

"negative" space? What is that? :)

A nice thing about the BLayoutBuilder classes (where this is used) is
that they are template classes and almost completely inlined in the
places where they are used. So, we can change them without breaking the
ABI.

However, AddGlue has the advantage that it is short and easy to type.
Maybe a simple AddSpace or AddPadding would do?

I think some other UI toolkits call this a "filler", when it consist
mostly of empty space. Go figure :)

-- 
Adrien.

Other related posts: