summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-10 06:10:27 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-10 06:10:27 +0100
commit464873f8b5a4f3d92ec1123345c3dc551c469a4e (patch)
tree654fb60921239231d7ee2a9ef3698881b4ae99f7 /LibGUI
parentcc04ba9cc9c7b4985c58c3e41ad396e999d75d58 (diff)
downloadserenity-464873f8b5a4f3d92ec1123345c3dc551c469a4e.zip
LibGUI: Draw some cute arrows on the GScrollBar buttons.
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GScrollBar.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/LibGUI/GScrollBar.cpp b/LibGUI/GScrollBar.cpp
index 4f13c3c86a..c2b585c140 100644
--- a/LibGUI/GScrollBar.cpp
+++ b/LibGUI/GScrollBar.cpp
@@ -77,17 +77,53 @@ Rect GScrollBar::scrubber_rect() const
return { 0, (int)y, button_size(), button_size() };
}
+static const char* s_up_arrow_bitmap_data = {
+ " "
+ " "
+ " ## "
+ " #### "
+ " ###### "
+ " ######## "
+ " ## "
+ " ## "
+ " ## "
+ " "
+};
+
+static const char* s_down_arrow_bitmap_data = {
+ " "
+ " ## "
+ " ## "
+ " ## "
+ " ######## "
+ " ###### "
+ " #### "
+ " ## "
+ " "
+ " "
+};
+
+static CharacterBitmap* s_up_arrow_bitmap;
+static CharacterBitmap* s_down_arrow_bitmap;
+
void GScrollBar::paint_event(GPaintEvent&)
{
+ if (!s_up_arrow_bitmap)
+ s_up_arrow_bitmap = CharacterBitmap::create_from_ascii(s_up_arrow_bitmap_data, 10, 10).leak_ref();
+ if (!s_down_arrow_bitmap)
+ s_down_arrow_bitmap = CharacterBitmap::create_from_ascii(s_down_arrow_bitmap_data, 10, 10).leak_ref();
+
Painter painter(*this);
painter.fill_rect(rect(), Color::MidGray);
painter.draw_rect(up_button_rect(), Color::DarkGray, true);
painter.fill_rect_with_gradient(up_button_rect().shrunken(2, 2), Color::LightGray, Color::White);
+ painter.draw_bitmap(up_button_rect().location().translated(3, 3), *s_up_arrow_bitmap, Color::Black);
painter.draw_rect(down_button_rect(), Color::DarkGray, true);
painter.fill_rect_with_gradient(down_button_rect().shrunken(2, 2), Color::LightGray, Color::White);
+ painter.draw_bitmap(down_button_rect().location().translated(3, 3), *s_down_arrow_bitmap, Color::Black);
painter.draw_rect(scrubber_rect(), Color::White, true);
painter.fill_rect_with_gradient(scrubber_rect().shrunken(2, 2), Color::LightGray, Color::White);