summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/labelwidget.c8
-rw-r--r--src/ui/sidebarwidget.c23
-rw-r--r--src/ui/util.c10
-rw-r--r--src/ui/widget.c2
4 files changed, 35 insertions, 8 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index f6ddfd43..4dd66a28 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -198,6 +198,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int
198 const iBool isSel = (flags & selected_WidgetFlag) != 0; 198 const iBool isSel = (flags & selected_WidgetFlag) != 0;
199 const iBool isFrameless = (flags & frameless_WidgetFlag) != 0; 199 const iBool isFrameless = (flags & frameless_WidgetFlag) != 0;
200 const iBool isButton = d->click.button != 0; 200 const iBool isButton = d->click.button != 0;
201 const iBool isMenuItem = !cmp_String(id_Widget(parent_Widget(d)), "menu");
201 const iBool isKeyRoot = (w->root == get_Window()->keyRoot); 202 const iBool isKeyRoot = (w->root == get_Window()->keyRoot);
202 const iBool isDarkTheme = isDark_ColorTheme(colorTheme_App()); 203 const iBool isDarkTheme = isDark_ColorTheme(colorTheme_App());
203 /* Default color state. */ 204 /* Default color state. */
@@ -215,7 +216,12 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int
215 *meta = uiTextDisabled_ColorId; 216 *meta = uiTextDisabled_ColorId;
216 } 217 }
217 if (isSel) { 218 if (isSel) {
218 *bg = uiBackgroundSelected_ColorId; 219 if (isMenuItem) {
220 *bg = uiBackgroundUnfocusedSelection_ColorId;
221 }
222 else {
223 *bg = uiBackgroundSelected_ColorId;
224 }
219// if (!isKeyRoot) { 225// if (!isKeyRoot) {
220// *bg = uiEmbossSelected1_ColorId; //uiBackgroundUnfocusedSelection_ColorId; 226// *bg = uiEmbossSelected1_ColorId; //uiBackgroundUnfocusedSelection_ColorId;
221// } 227// }
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 3d663afd..2219eba9 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -264,10 +264,12 @@ static iBool isBookmarkFolded_SidebarWidget_(const iSidebarWidget *d, const iBoo
264 return iFalse; 264 return iFalse;
265} 265}
266 266
267static void updateItems_SidebarWidget_(iSidebarWidget *d) { 267static void updateItemsWithFlags_SidebarWidget_(iSidebarWidget *d, iBool keepActions) {
268 clear_ListWidget(d->list); 268 clear_ListWidget(d->list);
269 releaseChildren_Widget(d->blank); 269 releaseChildren_Widget(d->blank);
270 if (!keepActions) {
270 releaseChildren_Widget(d->actions); 271 releaseChildren_Widget(d->actions);
272 }
271 d->actions->rect.size.y = 0; 273 d->actions->rect.size.y = 0;
272 destroy_Widget(d->menu); 274 destroy_Widget(d->menu);
273 destroy_Widget(d->modeMenu); 275 destroy_Widget(d->modeMenu);
@@ -348,7 +350,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
348 break; 350 break;
349 } 351 }
350 } 352 }
351 /* Actions. */ { 353 /* Actions. */
354 if (!keepActions) {
352 addActionButton_SidebarWidget_( 355 addActionButton_SidebarWidget_(
353 d, check_Icon " ${sidebar.action.feeds.markallread}", "feeds.markallread", expand_WidgetFlag | 356 d, check_Icon " ${sidebar.action.feeds.markallread}", "feeds.markallread", expand_WidgetFlag |
354 tight_WidgetFlag); 357 tight_WidgetFlag);
@@ -362,6 +365,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
362 iWidget *dropButton = addChild_Widget( 365 iWidget *dropButton = addChild_Widget(
363 d->actions, 366 d->actions,
364 iClob(makeMenuButton_LabelWidget(items[d->feedsMode].label, items, 2))); 367 iClob(makeMenuButton_LabelWidget(items[d->feedsMode].label, items, 2)));
368 setId_Widget(dropButton, "feeds.modebutton");
369 checkIcon_LabelWidget((iLabelWidget *) dropButton);
365 setFixedSize_Widget( 370 setFixedSize_Widget(
366 dropButton, 371 dropButton,
367 init_I2(iMaxi(20 * gap_UI, measure_Text( 372 init_I2(iMaxi(20 * gap_UI, measure_Text(
@@ -371,6 +376,10 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
371 6 * gap_UI), 376 6 * gap_UI),
372 -1)); 377 -1));
373 } 378 }
379 else {
380 updateDropdownSelection_LabelWidget(findChild_Widget(d->actions, "feeds.modebutton"),
381 format_CStr(" arg:%d", d->feedsMode));
382 }
374 d->menu = makeMenu_Widget( 383 d->menu = makeMenu_Widget(
375 as_Widget(d), 384 as_Widget(d),
376 (iMenuItem[]){ { openTab_Icon " ${feeds.entry.newtab}", 0, 0, "feed.entry.opentab" }, 385 (iMenuItem[]){ { openTab_Icon " ${feeds.entry.newtab}", 0, 0, "feed.entry.opentab" },
@@ -653,6 +662,10 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
653 updateMouseHover_ListWidget(d->list); 662 updateMouseHover_ListWidget(d->list);
654} 663}
655 664
665static void updateItems_SidebarWidget_(iSidebarWidget *d) {
666 updateItemsWithFlags_SidebarWidget_(d, iFalse);
667}
668
656static size_t findItem_SidebarWidget_(const iSidebarWidget *d, int id) { 669static size_t findItem_SidebarWidget_(const iSidebarWidget *d, int id) {
657 /* Note that this is O(n), so only meant for infrequent use. */ 670 /* Note that this is O(n), so only meant for infrequent use. */
658 for (size_t i = 0; i < numItems_ListWidget(d->list); i++) { 671 for (size_t i = 0; i < numItems_ListWidget(d->list); i++) {
@@ -1315,9 +1328,9 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1315 } 1328 }
1316 return iTrue; 1329 return iTrue;
1317 } 1330 }
1318 else if (isCommand_Widget(w, ev, "menu.closed")) { 1331// else if (isCommand_Widget(w, ev, "menu.closed")) {
1319 // invalidateItem_ListWidget(d->list, d->contextIndex); 1332 // invalidateItem_ListWidget(d->list, d->contextIndex);
1320 } 1333// }
1321 else if (isCommand_Widget(w, ev, "bookmark.open")) { 1334 else if (isCommand_Widget(w, ev, "bookmark.open")) {
1322 const iSidebarItem *item = d->contextItem; 1335 const iSidebarItem *item = d->contextItem;
1323 if (d->mode == bookmarks_SidebarMode && item) { 1336 if (d->mode == bookmarks_SidebarMode && item) {
@@ -1474,7 +1487,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1474 } 1487 }
1475 else if (equalWidget_Command(cmd, w, "feeds.mode")) { 1488 else if (equalWidget_Command(cmd, w, "feeds.mode")) {
1476 d->feedsMode = arg_Command(cmd); 1489 d->feedsMode = arg_Command(cmd);
1477 updateItems_SidebarWidget_(d); 1490 updateItemsWithFlags_SidebarWidget_(d, iTrue);
1478 return iTrue; 1491 return iTrue;
1479 } 1492 }
1480 else if (equal_Command(cmd, "feeds.markallread") && d->mode == feeds_SidebarMode) { 1493 else if (equal_Command(cmd, "feeds.markallread") && d->mode == feeds_SidebarMode) {
diff --git a/src/ui/util.c b/src/ui/util.c
index 84de4b74..cfb2b230 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -1036,7 +1036,8 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {
1036 setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse); 1036 setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse);
1037 arrange_Widget(d); /* need to know the height */ 1037 arrange_Widget(d); /* need to know the height */
1038 iBool allowOverflow = iFalse; 1038 iBool allowOverflow = iFalse;
1039 /* A vertical offset determined by a possible selected label in the menu. */ { 1039 /* A vertical offset determined by a possible selected label in the menu. */
1040 if (windowCoord.y < rootSize.y - lineHeight_Text(uiNormal_FontSize) * 3) {
1040 iConstForEach(ObjectList, child, children_Widget(d)) { 1041 iConstForEach(ObjectList, child, children_Widget(d)) {
1041 const iWidget *item = constAs_Widget(child.object); 1042 const iWidget *item = constAs_Widget(child.object);
1042 if (flags_Widget(item) & selected_WidgetFlag) { 1043 if (flags_Widget(item) & selected_WidgetFlag) {
@@ -1269,6 +1270,9 @@ const iString *removeMenuItemLabelPrefixes_String(const iString *d) {
1269} 1270}
1270 1271
1271void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *selectedCommand) { 1272void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *selectedCommand) {
1273 if (!dropButton) {
1274 return;
1275 }
1272 iWidget *menu = findChild_Widget(as_Widget(dropButton), "menu"); 1276 iWidget *menu = findChild_Widget(as_Widget(dropButton), "menu");
1273 if (flags_Widget(menu) & nativeMenu_WidgetFlag) { 1277 if (flags_Widget(menu) & nativeMenu_WidgetFlag) {
1274 unselectAllNativeMenuItems_Widget(menu); 1278 unselectAllNativeMenuItems_Widget(menu);
@@ -1277,6 +1281,7 @@ void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *s
1277 setSelected_NativeMenuItem(item, iTrue); 1281 setSelected_NativeMenuItem(item, iTrue);
1278 updateText_LabelWidget( 1282 updateText_LabelWidget(
1279 dropButton, removeMenuItemLabelPrefixes_String(collectNewCStr_String(item->label))); 1283 dropButton, removeMenuItemLabelPrefixes_String(collectNewCStr_String(item->label)));
1284 checkIcon_LabelWidget(dropButton);
1280 } 1285 }
1281 return; 1286 return;
1282 } 1287 }
@@ -1287,6 +1292,7 @@ void updateDropdownSelection_LabelWidget(iLabelWidget *dropButton, const char *s
1287 setFlags_Widget(as_Widget(item), selected_WidgetFlag, isSelected); 1292 setFlags_Widget(as_Widget(item), selected_WidgetFlag, isSelected);
1288 if (isSelected) { 1293 if (isSelected) {
1289 updateText_LabelWidget(dropButton, sourceText_LabelWidget(item)); 1294 updateText_LabelWidget(dropButton, sourceText_LabelWidget(item));
1295 checkIcon_LabelWidget(dropButton);
1290 } 1296 }
1291 } 1297 }
1292 } 1298 }
@@ -2352,6 +2358,7 @@ iWidget *makePreferences_Widget(void) {
2352 { "radio device:1 id:prefs.pinsplit", 0, 0, (const void *) pinSplitItems }, 2358 { "radio device:1 id:prefs.pinsplit", 0, 0, (const void *) pinSplitItems },
2353 { "padding" }, 2359 { "padding" },
2354 { "dropdown id:prefs.uilang", 0, 0, (const void *) langItems }, 2360 { "dropdown id:prefs.uilang", 0, 0, (const void *) langItems },
2361 { "toggle id:prefs.time.24h" },
2355 { NULL } 2362 { NULL }
2356 }; 2363 };
2357 const iMenuItem uiPanelItems[] = { 2364 const iMenuItem uiPanelItems[] = {
@@ -2436,6 +2443,7 @@ iWidget *makePreferences_Widget(void) {
2436 const iMenuItem aboutPanelItems[] = { 2443 const iMenuItem aboutPanelItems[] = {
2437 { format_CStr("heading text:%s", cstr_String(aboutText)) }, 2444 { format_CStr("heading text:%s", cstr_String(aboutText)) },
2438 { "button text:" clock_Icon " ${menu.releasenotes}", 0, 0, "!open url:about:version" }, 2445 { "button text:" clock_Icon " ${menu.releasenotes}", 0, 0, "!open url:about:version" },
2446 { "padding" },
2439 { "button text:" globe_Icon " ${menu.website}", 0, 0, "!open url:https://gmi.skyjake.fi/lagrange" }, 2447 { "button text:" globe_Icon " ${menu.website}", 0, 0, "!open url:https://gmi.skyjake.fi/lagrange" },
2440 { "button text:" envelope_Icon " @jk@skyjake.fi", 0, 0, "!open url:https://skyjake.fi/@jk" }, 2448 { "button text:" envelope_Icon " @jk@skyjake.fi", 0, 0, "!open url:https://skyjake.fi/@jk" },
2441 { "padding" }, 2449 { "padding" },
diff --git a/src/ui/widget.c b/src/ui/widget.c
index a171a6cd..cedda461 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -1528,7 +1528,7 @@ static void addToPotentiallyVisible_Widget_(const iWidget *d, iPtrArray *pvs, iR
1528 } 1528 }
1529 if (isFullyContainedByOther_Rect(bounds, *fullyMasked)) { 1529 if (isFullyContainedByOther_Rect(bounds, *fullyMasked)) {
1530 return; /* can't be seen */ 1530 return; /* can't be seen */
1531 } 1531 }
1532 pushBack_PtrArray(pvs, d); 1532 pushBack_PtrArray(pvs, d);
1533 if (d->bgColor >= 0 && ~d->flags & noBackground_WidgetFlag && 1533 if (d->bgColor >= 0 && ~d->flags & noBackground_WidgetFlag &&
1534 isFullyContainedByOther_Rect(*fullyMasked, bounds)) { 1534 isFullyContainedByOther_Rect(*fullyMasked, bounds)) {