BMenuField: allow to use non-fixed size in combination with layout mode

In fixed size mode, the menu field always uses all the available width.
In non-fixed size mode, the menu field will resize itself to be as small
as possible.

With layout, usually the difference isn't noticeable, since the layout
will already try to resize the control to the smallest possible size.
But there are a few cases where it makes a difference, when the layout
is over-constrained and the menu field can't be made as small as
possible. In that case, the menu field would be forced to fill its
allocated space, where we can instead make it a little smaller.

Change-Id: I911d497218a09aab3824865968558df5d4b3cf98
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6076
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: John Scipione <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
PulkoMandy
2023-02-21 10:47:46 +00:00
committed by Adrien Destugues
parent 40a7fe3f68
commit 5f88744263
3 changed files with 35 additions and 14 deletions
+4
View File
@@ -27,6 +27,10 @@ public:
BMenuField(const char* name,
const char* label, BMenu* menu,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BMenuField(const char* name,
const char* label, BMenu* menu,
bool fixed_size,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BMenuField(const char* label, BMenu* menu,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
BMenuField(BMessage* data);