summaryrefslogtreecommitdiff
path: root/src/ui/sidebarwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r--src/ui/sidebarwidget.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 37504661..28f7c37d 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -195,6 +195,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
195 iDate date; 195 iDate date;
196 init_Date(&date, &visit->when); 196 init_Date(&date, &visit->when);
197 if (date.day != on.day || date.month != on.month || date.year != on.year) { 197 if (date.day != on.day || date.month != on.month || date.year != on.year) {
198 on = date;
198 /* Date separator. */ 199 /* Date separator. */
199 iSidebarItem sep; 200 iSidebarItem sep;
200 init_SidebarItem(&sep); 201 init_SidebarItem(&sep);
@@ -202,8 +203,11 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
202 set_String(&sep.meta, 203 set_String(&sep.meta,
203 collect_String(format_Date( 204 collect_String(format_Date(
204 &date, date.year != thisYear ? "%b %d %Y" : "%b %d"))); 205 &date, date.year != thisYear ? "%b %d %Y" : "%b %d")));
206 pushBack_Array(&d->items, &sep);
207 /* Date separators are two items tall. */
208 init_SidebarItem(&sep);
209 sep.isSeparator = iTrue;
205 pushBack_Array(&d->items, &sep); 210 pushBack_Array(&d->items, &sep);
206 on = date;
207 } 211 }
208 pushBack_Array(&d->items, &item); 212 pushBack_Array(&d->items, &item);
209 } 213 }
@@ -771,14 +775,19 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
771 } 775 }
772 else if (contains_Widget(w, mouse)) { 776 else if (contains_Widget(w, mouse)) {
773 hover = itemIndex_SidebarWidget_(d, mouse); 777 hover = itemIndex_SidebarWidget_(d, mouse);
774 if (hover != iInvalidPos && d->mode != identities_SidebarMode) { 778 }
775 setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_HAND); 779 setHoverItem_SidebarWidget_(d, hover);
780 /* Update cursor. */
781 if (contains_Widget(w, mouse)) {
782 const iSidebarItem *item = constHoverItem_SidebarWidget_(d);
783 if (item && d->mode != identities_SidebarMode) {
784 setCursor_Window(get_Window(), item->isSeparator ? SDL_SYSTEM_CURSOR_ARROW
785 : SDL_SYSTEM_CURSOR_HAND);
776 } 786 }
777 else { 787 else {
778 setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_ARROW); 788 setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_ARROW);
779 } 789 }
780 } 790 }
781 setHoverItem_SidebarWidget_(d, hover);
782 } 791 }
783 if (ev->type == SDL_MOUSEWHEEL && isHover_Widget(w)) { 792 if (ev->type == SDL_MOUSEWHEEL && isHover_Widget(w)) {
784#if defined (iPlatformApple) 793#if defined (iPlatformApple)
@@ -928,16 +937,20 @@ static void draw_SidebarWidget_(const iSidebarWidget *d) {
928 const int fg = isHover ? (isPressing ? uiTextPressed_ColorId 937 const int fg = isHover ? (isPressing ? uiTextPressed_ColorId
929 : uiTextFramelessHover_ColorId) 938 : uiTextFramelessHover_ColorId)
930 : uiText_ColorId; 939 : uiText_ColorId;
931 if (!isEmpty_String(&item->meta)) { 940 if (item->isSeparator) {
932 drawHLine_Paint( 941 if (!isEmpty_String(&item->meta)) {
933 &p, topLeft_Rect(itemRect), width_Rect(itemRect), uiIcon_ColorId); 942 unsetClip_Paint(&p);
934 drawRange_Text( 943 iInt2 drawPos = addY_I2(topLeft_Rect(itemRect), d->itemHeight * 0.666f);
935 default_FontId, 944 drawHLine_Paint(
936 add_I2(topLeft_Rect(itemRect), 945 &p, drawPos, width_Rect(itemRect), uiIcon_ColorId);
937 init_I2(3 * gap_UI, 946 drawRange_Text(
938 (d->itemHeight - lineHeight_Text(default_FontId)) / 2)), 947 default_FontId,
939 uiIcon_ColorId, 948 add_I2(drawPos,
940 range_String(&item->meta)); 949 init_I2(3 * gap_UI,
950 (d->itemHeight - lineHeight_Text(default_FontId)) / 2)),
951 uiIcon_ColorId,
952 range_String(&item->meta));
953 }
941 } 954 }
942 else { 955 else {
943 iUrl parts; 956 iUrl parts;