diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-10 19:45:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-10 22:32:12 +0200 |
commit | 4e766c8159c54948b55cce6fd65a92c0e022ff86 (patch) | |
tree | b783ab5f823c1c8d0d4200f5b37b14c451b8471f /Services | |
parent | f15b467b5dc93e6253625c794296dde8156b8dcf (diff) | |
download | serenity-4e766c8159c54948b55cce6fd65a92c0e022ff86.zip |
Taskbar: Let's custom paint the background instead of using GUI::Frame
Previously we were wasting the bottom pixel row on darkness. Use the
base button color all the way to the bottom row and offset the top
highlight by one pixel instead.
Diffstat (limited to 'Services')
-rw-r--r-- | Services/Taskbar/TaskbarWindow.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/Services/Taskbar/TaskbarWindow.cpp b/Services/Taskbar/TaskbarWindow.cpp index 7e2638ebd0..92b49f7914 100644 --- a/Services/Taskbar/TaskbarWindow.cpp +++ b/Services/Taskbar/TaskbarWindow.cpp @@ -33,11 +33,31 @@ #include <LibGUI/Button.h> #include <LibGUI/Desktop.h> #include <LibGUI/Frame.h> +#include <LibGUI/Painter.h> #include <LibGUI/Window.h> +#include <LibGfx/Palette.h> #include <stdio.h> //#define EVENT_DEBUG +class TaskbarWidget final : public GUI::Widget { + C_OBJECT(TaskbarWidget); + +public: + virtual ~TaskbarWidget() override {} + +private: + TaskbarWidget() {} + + virtual void paint_event(GUI::PaintEvent& event) override + { + GUI::Painter painter(*this); + painter.add_clip_rect(event.rect()); + painter.fill_rect(rect(), palette().button()); + painter.draw_line({ 0, 1 }, { width() - 1, 1 }, palette().threed_highlight()); + } +}; + TaskbarWindow::TaskbarWindow() { set_window_type(GUI::WindowType::Taskbar); @@ -47,14 +67,10 @@ TaskbarWindow::TaskbarWindow() GUI::Desktop::the().on_rect_change = [this](const Gfx::Rect& rect) { on_screen_rect_change(rect); }; - auto& widget = set_main_widget<GUI::Frame>(); - widget.set_fill_with_background_color(true); + auto& widget = set_main_widget<TaskbarWidget>(); widget.set_layout<GUI::HorizontalBoxLayout>(); widget.layout()->set_margins({ 3, 2, 3, 2 }); widget.layout()->set_spacing(3); - widget.set_frame_thickness(1); - widget.set_frame_shape(Gfx::FrameShape::Panel); - widget.set_frame_shadow(Gfx::FrameShadow::Raised); m_default_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"); |