I'm working on a class called "LayoutManager" which provides interface to layout child windows or controls within parent window.
There are several enumerations within a class used to control alignment, ex:
/** Alignment options for Horizontal orientation */
enum class HorizontalAlignment
// Child windows are aligned from left to right
// Child windows are centered
// Child windows are aligned from right to left
Left and Right alignment is self explanatory, for ex. let's say you have 5 buttons,
with Left alignment this means they're aligned like this:
|Parent left border, 1,2,3,4,5, empty space...|
With the Right alignment they're aligned in reverse order from the right:
|Parent right border, empty space, 5,4,3,2,1, parent right border|
But with center alignment there is a problem because how exactly should center alignment work? there are 4 possibilities:
Option 1 (from center out):
|[window space], 4, 2, 1, 3, 5, [window space]|
Option 2 (center left to right)
|[window space], 1, 2, 3, 4, 5, [window space]|
Option 3 (center right to left)
|[window space], 5,4,3,2,1, [window space]|
Option 2 further brings a question as to whether center out should favor right over left when centering out, ex:
Option 4 (from center out but slightly different order):
|[window space], 5, 3, 1, 2, 4, [window space]|
Thus for Center alignment there are in total 4 behaviors on how to implement it, all 4 options center child windows but in different manner.
What would you say, which of these 4 possibilities should be "the right" way to implement Center alignment?
What should be expected behavior?
I would also like to add that numerical order of child windows, ex, 1,2,3,4,5 is well known, the order corresponds to the order in which child windows were created and attached to parent.
Therefore during creation of child window one can have control over alignment order prior to alignment.
But this doesn't help in determining or controlling how center alignment should work.