mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
LibGUI: Draw some cute arrows on the GScrollBar buttons.
This commit is contained in:
parent
cc04ba9cc9
commit
464873f8b5
Notes:
sideshowbarker
2024-07-19 15:48:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/464873f8b5a
1 changed files with 36 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue