diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/window.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 251eb5c4..2b04244c 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -404,7 +404,13 @@ static void updatePadding_Window_(iWindow *d) { | |||
404 | float left, top, right, bottom; | 404 | float left, top, right, bottom; |
405 | safeAreaInsets_iOS(&left, &top, &right, &bottom); | 405 | safeAreaInsets_iOS(&left, &top, &right, &bottom); |
406 | setPadding_Widget(findChild_Widget(d->root, "navdiv"), left, top, right, 0); | 406 | setPadding_Widget(findChild_Widget(d->root, "navdiv"), left, top, right, 0); |
407 | setPadding_Widget(findChild_Widget(d->root, "toolbar"), left, 0, right, bottom); | 407 | iWidget *toolBar = findChild_Widget(d->root, "toolbar"); |
408 | if (isPortrait_App()) { | ||
409 | setPadding_Widget(toolBar, left, 0, right, bottom); | ||
410 | } | ||
411 | else { | ||
412 | setPadding1_Widget(toolBar, 0); | ||
413 | } | ||
408 | } | 414 | } |
409 | #endif | 415 | #endif |
410 | } | 416 | } |
@@ -426,14 +432,26 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
426 | } | 432 | } |
427 | } | 433 | } |
428 | if (isPhone) { | 434 | if (isPhone) { |
435 | static const char *buttons[] = { | ||
436 | "navbar.back", "navbar.forward", "navbar.ident", "navbar.home", "navbar.menu" | ||
437 | }; | ||
429 | setFlags_Widget(findWidget_App("toolbar"), hidden_WidgetFlag, isLandscape_App()); | 438 | setFlags_Widget(findWidget_App("toolbar"), hidden_WidgetFlag, isLandscape_App()); |
430 | setFlags_Widget(findWidget_App("navbar.back"), hidden_WidgetFlag, isPortrait_App()); | 439 | iForIndices(i, buttons) { |
431 | setFlags_Widget(findWidget_App("navbar.forward"), hidden_WidgetFlag, isPortrait_App()); | 440 | iLabelWidget *btn = findChild_Widget(navBar, buttons[i]); |
432 | setFlags_Widget(findWidget_App("navbar.ident"), hidden_WidgetFlag, isPortrait_App()); | 441 | setFlags_Widget(as_Widget(btn), hidden_WidgetFlag, isPortrait_App()); |
433 | setFlags_Widget(findWidget_App("navbar.home"), hidden_WidgetFlag, isPortrait_App()); | 442 | if (isLandscape_App()) { |
434 | setFlags_Widget(findWidget_App("navbar.menu"), hidden_WidgetFlag, isPortrait_App()); | 443 | /* Collapsing sets size to zero and the label doesn't know when to update |
444 | its own size automatically. */ | ||
445 | updateSize_LabelWidget(btn); | ||
446 | } | ||
447 | } | ||
448 | arrange_Widget(get_Window()->root); | ||
449 | } | ||
450 | else { | ||
451 | arrange_Widget(navBar); | ||
435 | } | 452 | } |
436 | arrange_Widget(navBar); | 453 | printf("navbar hgt:%i\n", height_Widget(findWidget_App("navbar"))); |
454 | printf("navbar.child[0] w:%i\n", width_Widget(child_Widget(findWidget_App("navbar"), 0))); | ||
437 | refresh_Widget(navBar); | 455 | refresh_Widget(navBar); |
438 | postCommand_Widget(navBar, "layout.changed id:navbar"); | 456 | postCommand_Widget(navBar, "layout.changed id:navbar"); |
439 | return iFalse; | 457 | return iFalse; |
@@ -1477,7 +1495,7 @@ uint32_t id_Window(const iWindow *d) { | |||
1477 | } | 1495 | } |
1478 | 1496 | ||
1479 | iInt2 rootSize_Window(const iWindow *d) { | 1497 | iInt2 rootSize_Window(const iWindow *d) { |
1480 | return d->root->rect.size; | 1498 | return d ? d->root->rect.size : zero_I2(); |
1481 | } | 1499 | } |
1482 | 1500 | ||
1483 | iInt2 coord_Window(const iWindow *d, int x, int y) { | 1501 | iInt2 coord_Window(const iWindow *d, int x, int y) { |