diff options
Diffstat (limited to 'src/ui/root.c')
-rw-r--r-- | src/ui/root.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/ui/root.c b/src/ui/root.c index 76ef05c4..233de51c 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -269,6 +269,7 @@ iAnyObject *findWidget_Root(const char *id) { | |||
269 | } | 269 | } |
270 | 270 | ||
271 | void destroyPending_Root(iRoot *d) { | 271 | void destroyPending_Root(iRoot *d) { |
272 | iRoot *oldRoot = current_Root(); | ||
272 | setCurrent_Root(d); | 273 | setCurrent_Root(d); |
273 | iForEach(PtrSet, i, d->pendingDestruction) { | 274 | iForEach(PtrSet, i, d->pendingDestruction) { |
274 | iWidget *widget = *i.value; | 275 | iWidget *widget = *i.value; |
@@ -282,7 +283,7 @@ void destroyPending_Root(iRoot *d) { | |||
282 | iRelease(widget); | 283 | iRelease(widget); |
283 | remove_PtrSetIterator(&i); | 284 | remove_PtrSetIterator(&i); |
284 | } | 285 | } |
285 | setCurrent_Root(NULL); | 286 | setCurrent_Root(oldRoot); |
286 | } | 287 | } |
287 | 288 | ||
288 | void postArrange_Root(iRoot *d) { | 289 | void postArrange_Root(iRoot *d) { |
@@ -414,6 +415,7 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) { | |||
414 | else { | 415 | else { |
415 | addChildPos_Widget(findChild_Widget(root, "stack"), iClob(sidebar), back_WidgetAddPos); | 416 | addChildPos_Widget(findChild_Widget(root, "stack"), iClob(sidebar), back_WidgetAddPos); |
416 | setWidth_SidebarWidget(sidebar, (float) width_Widget(root) / (float) gap_UI); | 417 | setWidth_SidebarWidget(sidebar, (float) width_Widget(root) / (float) gap_UI); |
418 | setWidth_SidebarWidget(sidebar2, (float) width_Widget(root) / (float) gap_UI); | ||
417 | } | 419 | } |
418 | return iFalse; | 420 | return iFalse; |
419 | } | 421 | } |
@@ -595,7 +597,7 @@ static void updateNavBarSize_(iWidget *navBar) { | |||
595 | if (isPhone) { | 597 | if (isPhone) { |
596 | static const char *buttons[] = { "navbar.back", "navbar.forward", "navbar.sidebar", | 598 | static const char *buttons[] = { "navbar.back", "navbar.forward", "navbar.sidebar", |
597 | "navbar.ident", "navbar.home", "navbar.menu" }; | 599 | "navbar.ident", "navbar.home", "navbar.menu" }; |
598 | iWidget *toolBar = findWidget_App("toolbar"); | 600 | iWidget *toolBar = findWidget_Root("toolbar"); |
599 | setVisualOffset_Widget(toolBar, 0, 0, 0); | 601 | setVisualOffset_Widget(toolBar, 0, 0, 0); |
600 | setFlags_Widget(toolBar, hidden_WidgetFlag, isLandscape_App()); | 602 | setFlags_Widget(toolBar, hidden_WidgetFlag, isLandscape_App()); |
601 | iForIndices(i, buttons) { | 603 | iForIndices(i, buttons) { |
@@ -1216,7 +1218,9 @@ void createUserInterface_Root(iRoot *d) { | |||
1216 | setFlags_Widget(toolBar, moveToParentBottomEdge_WidgetFlag | | 1218 | setFlags_Widget(toolBar, moveToParentBottomEdge_WidgetFlag | |
1217 | parentCannotResizeHeight_WidgetFlag | | 1219 | parentCannotResizeHeight_WidgetFlag | |
1218 | resizeWidthOfChildren_WidgetFlag | | 1220 | resizeWidthOfChildren_WidgetFlag | |
1219 | arrangeHeight_WidgetFlag | arrangeHorizontal_WidgetFlag, iTrue); | 1221 | arrangeHeight_WidgetFlag | arrangeHorizontal_WidgetFlag | |
1222 | commandOnClick_WidgetFlag | | ||
1223 | drawBackgroundToBottom_WidgetFlag, iTrue); | ||
1220 | setBackgroundColor_Widget(toolBar, tmBannerBackground_ColorId); | 1224 | setBackgroundColor_Widget(toolBar, tmBannerBackground_ColorId); |
1221 | setId_Widget(addChildFlags_Widget(toolBar, | 1225 | setId_Widget(addChildFlags_Widget(toolBar, |
1222 | iClob(newLargeIcon_LabelWidget("\U0001f870", "navigate.back")), | 1226 | iClob(newLargeIcon_LabelWidget("\U0001f870", "navigate.back")), |
@@ -1244,17 +1248,17 @@ void createUserInterface_Root(iRoot *d) { | |||
1244 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); | 1248 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); |
1245 | setTextColor_LabelWidget(i.object, tmBannerIcon_ColorId); | 1249 | setTextColor_LabelWidget(i.object, tmBannerIcon_ColorId); |
1246 | // setBackgroundColor_Widget(i.object, tmBannerSideTitle_ColorId); | 1250 | // setBackgroundColor_Widget(i.object, tmBannerSideTitle_ColorId); |
1247 | } | 1251 | } |
1248 | const iMenuItem items[] = { | 1252 | const iMenuItem items[] = { |
1249 | { pin_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, | 1253 | { pin_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, |
1250 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, | 1254 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, |
1251 | { clock_Icon " ${sidebar.history}", 0, 0, "toolbar.showview arg:2" }, | 1255 | { clock_Icon " ${sidebar.history}", 0, 0, "toolbar.showview arg:2" }, |
1252 | { page_Icon " ${toolbar.outline}", 0, 0, "toolbar.showview arg:4" }, | 1256 | { page_Icon " ${toolbar.outline}", 0, 0, "toolbar.showview arg:4" }, |
1253 | }; | 1257 | }; |
1254 | iWidget *menu = makeMenu_Widget(findChild_Widget(toolBar, "toolbar.view"), | 1258 | iWidget *menu = makeMenu_Widget(findChild_Widget(toolBar, "toolbar.view"), |
1255 | items, iElemCount(items)); | 1259 | items, iElemCount(items)); |
1256 | setId_Widget(menu, "toolbar.menu"); /* view menu */ | 1260 | setId_Widget(menu, "toolbar.menu"); /* view menu */ |
1257 | } | 1261 | } |
1258 | #endif | 1262 | #endif |
1259 | updatePadding_Root(d); | 1263 | updatePadding_Root(d); |
1260 | /* Global context menus. */ { | 1264 | /* Global context menus. */ { |
@@ -1319,6 +1323,11 @@ void createUserInterface_Root(iRoot *d) { | |||
1319 | } | 1323 | } |
1320 | updateMetrics_Root(d); | 1324 | updateMetrics_Root(d); |
1321 | updateNavBarSize_(navBar); | 1325 | updateNavBarSize_(navBar); |
1326 | if (deviceType_App() == phone_AppDeviceType) { | ||
1327 | const float sidebarWidth = width_Widget(root) / (float) gap_UI; | ||
1328 | setWidth_SidebarWidget(findChild_Widget(root, "sidebar"), sidebarWidth); | ||
1329 | setWidth_SidebarWidget(findChild_Widget(root, "sidebar2"), sidebarWidth); | ||
1330 | } | ||
1322 | } | 1331 | } |
1323 | 1332 | ||
1324 | void showToolbars_Root(iRoot *d, iBool show) { | 1333 | void showToolbars_Root(iRoot *d, iBool show) { |