diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-18 11:26:11 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-18 11:26:11 +0200 |
commit | fa174461abdc5c33de16428109c7d46b4f150093 (patch) | |
tree | 21cf16a2426f8a6b76195e1816ceea69778fbd70 /src/ui/sidebarwidget.c | |
parent | 21f6248a3dc906a0c296b937dd1aa697784e6ea3 (diff) |
Scrollbar fading and periodic commands
Added a new mechanism to issue periodic but not per-frame commands. This is used for main-thread operations like checking if it's time to fade away the scrollbars.
Scrollbars are faded away completely on Apple platforms. Adjusted list right margins accordingly.
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 802669c7..ac119575 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -143,7 +143,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
143 | iDate on; | 143 | iDate on; |
144 | initCurrent_Time(&now); | 144 | initCurrent_Time(&now); |
145 | init_Date(&on, &now); | 145 | init_Date(&on, &now); |
146 | const int thisYear = on.year; | 146 | const iDate today = on; |
147 | iZap(on); | 147 | iZap(on); |
148 | size_t numItems = 0; | 148 | size_t numItems = 0; |
149 | iConstForEach(PtrArray, i, listEntries_Feeds()) { | 149 | iConstForEach(PtrArray, i, listEntries_Feeds()) { |
@@ -1306,6 +1306,11 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
1306 | const iBool isHover = isHover_Widget(constAs_Widget(list)) && | 1306 | const iBool isHover = isHover_Widget(constAs_Widget(list)) && |
1307 | constHoverItem_ListWidget(list) == d; | 1307 | constHoverItem_ListWidget(list) == d; |
1308 | const int scrollBarWidth = scrollBarWidth_ListWidget(list); | 1308 | const int scrollBarWidth = scrollBarWidth_ListWidget(list); |
1309 | #if defined (iPlatformApple) | ||
1310 | const int blankWidth = 0; | ||
1311 | #else | ||
1312 | const int blankWidth = scrollBarWidth; | ||
1313 | #endif | ||
1309 | const int itemHeight = height_Rect(itemRect); | 1314 | const int itemHeight = height_Rect(itemRect); |
1310 | const int iconColor = isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId) | 1315 | const int iconColor = isHover ? (isPressing ? uiTextPressed_ColorId : uiIconHover_ColorId) |
1311 | : uiIcon_ColorId; | 1316 | : uiIcon_ColorId; |
@@ -1345,7 +1350,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
1345 | if (d != constItem_ListWidget(list, 0)) { | 1350 | if (d != constItem_ListWidget(list, 0)) { |
1346 | drawHLine_Paint(p, | 1351 | drawHLine_Paint(p, |
1347 | addY_I2(pos, 2 * gap_UI), | 1352 | addY_I2(pos, 2 * gap_UI), |
1348 | width_Rect(itemRect) - scrollBarWidth, | 1353 | width_Rect(itemRect) - blankWidth, |
1349 | uiSeparator_ColorId); | 1354 | uiSeparator_ColorId); |
1350 | } | 1355 | } |
1351 | drawRange_Text( | 1356 | drawRange_Text( |
@@ -1463,7 +1468,7 @@ static void draw_SidebarItem_(const iSidebarItem *d, iPaint *p, iRect itemRect, | |||
1463 | iInt2 drawPos = addY_I2(topLeft_Rect(itemRect), d->id); | 1468 | iInt2 drawPos = addY_I2(topLeft_Rect(itemRect), d->id); |
1464 | drawHLine_Paint(p, | 1469 | drawHLine_Paint(p, |
1465 | addY_I2(drawPos, -gap_UI), | 1470 | addY_I2(drawPos, -gap_UI), |
1466 | width_Rect(itemRect) - scrollBarWidth, | 1471 | width_Rect(itemRect) - blankWidth, |
1467 | uiSeparator_ColorId); | 1472 | uiSeparator_ColorId); |
1468 | drawRange_Text( | 1473 | drawRange_Text( |
1469 | uiLabelLargeBold_FontId, | 1474 | uiLabelLargeBold_FontId, |