Skip to content

Commit 4e766c8

Browse files
committed
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.
1 parent f15b467 commit 4e766c8

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

Services/Taskbar/TaskbarWindow.cpp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,31 @@
3333
#include <LibGUI/Button.h>
3434
#include <LibGUI/Desktop.h>
3535
#include <LibGUI/Frame.h>
36+
#include <LibGUI/Painter.h>
3637
#include <LibGUI/Window.h>
38+
#include <LibGfx/Palette.h>
3739
#include <stdio.h>
3840

3941
//#define EVENT_DEBUG
4042

43+
class TaskbarWidget final : public GUI::Widget {
44+
C_OBJECT(TaskbarWidget);
45+
46+
public:
47+
virtual ~TaskbarWidget() override {}
48+
49+
private:
50+
TaskbarWidget() {}
51+
52+
virtual void paint_event(GUI::PaintEvent& event) override
53+
{
54+
GUI::Painter painter(*this);
55+
painter.add_clip_rect(event.rect());
56+
painter.fill_rect(rect(), palette().button());
57+
painter.draw_line({ 0, 1 }, { width() - 1, 1 }, palette().threed_highlight());
58+
}
59+
};
60+
4161
TaskbarWindow::TaskbarWindow()
4262
{
4363
set_window_type(GUI::WindowType::Taskbar);
@@ -47,14 +67,10 @@ TaskbarWindow::TaskbarWindow()
4767

4868
GUI::Desktop::the().on_rect_change = [this](const Gfx::Rect& rect) { on_screen_rect_change(rect); };
4969

50-
auto& widget = set_main_widget<GUI::Frame>();
51-
widget.set_fill_with_background_color(true);
70+
auto& widget = set_main_widget<TaskbarWidget>();
5271
widget.set_layout<GUI::HorizontalBoxLayout>();
5372
widget.layout()->set_margins({ 3, 2, 3, 2 });
5473
widget.layout()->set_spacing(3);
55-
widget.set_frame_thickness(1);
56-
widget.set_frame_shape(Gfx::FrameShape::Panel);
57-
widget.set_frame_shadow(Gfx::FrameShadow::Raised);
5874

5975
m_default_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png");
6076

0 commit comments

Comments
 (0)