diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-10 06:53:55 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-10 06:53:55 +0300 |
commit | ef30731ff7ecc0687ebf4b85db89dc83a4748266 (patch) | |
tree | 6d031da3f2c8e342cf209980827fe92b36079ca0 /src/ui/widget.c | |
parent | cfcd6bd672829edfbb325e3d264570c034ccc0f1 (diff) |
Tab bar is hidden when there is a single tab
Needed some fixes in the widget arrangement behavior.
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index 51841d64..3e34c285 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -186,6 +186,8 @@ void arrange_Widget(iWidget *d) { | |||
186 | /* Resize children to fill the parent widget. */ | 186 | /* Resize children to fill the parent widget. */ |
187 | const size_t childCount = size_ObjectList(d->children); | 187 | const size_t childCount = size_ObjectList(d->children); |
188 | if (d->flags & resizeChildren_WidgetFlag) { | 188 | if (d->flags & resizeChildren_WidgetFlag) { |
189 | const iInt2 dirs = init_I2((d->flags & resizeWidthOfChildren_WidgetFlag) != 0, | ||
190 | (d->flags & resizeHeightOfChildren_WidgetFlag) != 0); | ||
189 | /* Collapse hidden children. */ | 191 | /* Collapse hidden children. */ |
190 | iForEach(ObjectList, c, d->children) { | 192 | iForEach(ObjectList, c, d->children) { |
191 | iWidget *child = as_Widget(c.object); | 193 | iWidget *child = as_Widget(c.object); |
@@ -221,21 +223,21 @@ void arrange_Widget(iWidget *d) { | |||
221 | if (isCollapsed_Widget_(child)) continue; | 223 | if (isCollapsed_Widget_(child)) continue; |
222 | if (child->flags & expand_WidgetFlag) { | 224 | if (child->flags & expand_WidgetFlag) { |
223 | if (d->flags & arrangeHorizontal_WidgetFlag) { | 225 | if (d->flags & arrangeHorizontal_WidgetFlag) { |
224 | setWidth_Widget_(child, avail.x); | 226 | if (dirs.x) setWidth_Widget_(child, avail.x); |
225 | setHeight_Widget_(child, d->rect.size.y); | 227 | if (dirs.y) setHeight_Widget_(child, d->rect.size.y); |
226 | } | 228 | } |
227 | else if (d->flags & arrangeVertical_WidgetFlag) { | 229 | else if (d->flags & arrangeVertical_WidgetFlag) { |
228 | setWidth_Widget_(child, d->rect.size.x); | 230 | if (dirs.x) setWidth_Widget_(child, d->rect.size.x); |
229 | setHeight_Widget_(child, avail.y); | 231 | if (dirs.y) setHeight_Widget_(child, avail.y); |
230 | } | 232 | } |
231 | } | 233 | } |
232 | else { | 234 | else { |
233 | /* Fill the off axis, though. */ | 235 | /* Fill the off axis, though. */ |
234 | if (d->flags & arrangeHorizontal_WidgetFlag) { | 236 | if (d->flags & arrangeHorizontal_WidgetFlag) { |
235 | setHeight_Widget_(child, d->rect.size.y); | 237 | if (dirs.y) setHeight_Widget_(child, d->rect.size.y); |
236 | } | 238 | } |
237 | else if (d->flags & arrangeVertical_WidgetFlag) { | 239 | else if (d->flags & arrangeVertical_WidgetFlag) { |
238 | setWidth_Widget_(child, d->rect.size.x); | 240 | if (dirs.x) setWidth_Widget_(child, d->rect.size.x); |
239 | } | 241 | } |
240 | } | 242 | } |
241 | } | 243 | } |
@@ -252,8 +254,8 @@ void arrange_Widget(iWidget *d) { | |||
252 | iForEach(ObjectList, i, d->children) { | 254 | iForEach(ObjectList, i, d->children) { |
253 | iWidget *child = as_Widget(i.object); | 255 | iWidget *child = as_Widget(i.object); |
254 | if (!isCollapsed_Widget_(child)) { | 256 | if (!isCollapsed_Widget_(child)) { |
255 | setWidth_Widget_(child, childSize.x); | 257 | if (dirs.x) setWidth_Widget_(child, childSize.x); |
256 | setHeight_Widget_(child, childSize.y); | 258 | if (dirs.y) setHeight_Widget_(child, childSize.y); |
257 | } | 259 | } |
258 | } | 260 | } |
259 | } | 261 | } |