summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2021-04-02 12:19:33 -0400
committerAndreas Kling <kling@serenityos.org>2021-04-02 22:23:21 +0200
commitdc6db819f91f5270a7f270a12fad4fc1f469f432 (patch)
tree939267d51cea7432bef22129070669c06ac29cdc /Userland/Libraries/LibGUI
parent14e074cd2499e017ea690319a649235191e484d0 (diff)
downloadserenity-dc6db819f91f5270a7f270a12fad4fc1f469f432.zip
LibGUI: Always outline selected date and paint today's date bold
Fixes selected dates and today's date not painting correctly when viewed from adjacent months
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/Calendar.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/Userland/Libraries/LibGUI/Calendar.cpp b/Userland/Libraries/LibGUI/Calendar.cpp
index 8733b74b85..fbf2bf1a1e 100644
--- a/Userland/Libraries/LibGUI/Calendar.cpp
+++ b/Userland/Libraries/LibGUI/Calendar.cpp
@@ -517,15 +517,14 @@ void Calendar::paint_event(GUI::PaintEvent& event)
}
auto display_date = String::number(m_tiles[0][i].date_time.day());
- if (m_tiles[0][i].is_today) {
- if (m_tiles[0][i].is_selected && width < 30)
- painter.draw_rect(tile_rect, palette().base_text());
+ if (m_tiles[0][i].is_selected && (width < 30 || height < 30))
+ painter.draw_rect(tile_rect, palette().base_text());
+
+ if (m_tiles[0][i].is_today && !m_tiles[0][i].is_outside_selected_month) {
painter.draw_text(text_rect, display_date, font().bold_variant(), text_alignment, palette().base_text());
} else if (m_tiles[0][i].is_outside_selected_month) {
- painter.draw_text(text_rect, display_date, font(), text_alignment, Color::LightGray);
+ painter.draw_text(text_rect, display_date, m_tiles[0][i].is_today ? font().bold_variant() : font(), text_alignment, Color::LightGray);
} else {
- if ((width < 30 || height < 30) && m_tiles[0][i].is_selected)
- painter.draw_rect(tile_rect, palette().base_text());
painter.draw_text(text_rect, display_date, font(), text_alignment, palette().base_text());
}
i++;
@@ -627,13 +626,12 @@ void Calendar::paint_event(GUI::PaintEvent& event)
}
auto display_date = String::number(m_tiles[l][i].date_time.day());
+ if (m_tiles[l][i].is_selected)
+ painter.draw_rect(tile_rect, palette().base_text());
+
if (m_tiles[l][i].is_today && !m_tiles[l][i].is_outside_selected_month) {
- if (m_tiles[l][i].is_selected)
- painter.draw_rect(tile_rect, palette().base_text());
painter.draw_text(tile_rect, display_date, font().bold_variant(), Gfx::TextAlignment::Center, palette().base_text());
} else if (!m_tiles[l][i].is_outside_selected_month) {
- if (m_tiles[l][i].is_selected)
- painter.draw_rect(tile_rect, palette().base_text());
painter.draw_text(tile_rect, display_date, font(), Gfx::TextAlignment::Center, palette().base_text());
}
i++;