summaryrefslogtreecommitdiff
path: root/Userland/Services/Taskbar/TaskbarWindow.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-25 22:11:12 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-25 22:14:09 +0100
commit0668b5beef4a30c2d2e95d46c0059151a9ad2d5f (patch)
tree1f2f6f7952fa9b02784fa1f30f0aaaafe396e546 /Userland/Services/Taskbar/TaskbarWindow.cpp
parentfc84076f1841888b8a89f399dd384191de5a9a7d (diff)
downloadserenity-0668b5beef4a30c2d2e95d46c0059151a9ad2d5f.zip
Taskbar: Integrate clock widget into taskbar window
Instead of running the clock widget as a separate menu applet, let's just draw a clock here in the taskbar window.
Diffstat (limited to 'Userland/Services/Taskbar/TaskbarWindow.cpp')
-rw-r--r--Userland/Services/Taskbar/TaskbarWindow.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp
index e1de201504..0f9d80ba32 100644
--- a/Userland/Services/Taskbar/TaskbarWindow.cpp
+++ b/Userland/Services/Taskbar/TaskbarWindow.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,6 +25,7 @@
*/
#include "TaskbarWindow.h"
+#include "ClockWidget.h"
#include "TaskbarButton.h"
#include <AK/Debug.h>
#include <LibCore/ConfigFile.h>
@@ -77,14 +78,19 @@ TaskbarWindow::TaskbarWindow()
GUI::Desktop::the().on_rect_change = [this](const Gfx::IntRect& rect) { on_screen_rect_change(rect); };
- auto& widget = set_main_widget<TaskbarWidget>();
- widget.set_layout<GUI::HorizontalBoxLayout>();
- widget.layout()->set_margins({ 3, 2, 3, 2 });
- widget.layout()->set_spacing(3);
+ auto& main_widget = set_main_widget<TaskbarWidget>();
+ main_widget.set_layout<GUI::HorizontalBoxLayout>();
+ main_widget.layout()->set_margins({ 3, 2, 3, 2 });
+
+ create_quick_launch_bar();
+
+ m_task_button_container = main_widget.add<GUI::Widget>();
+ m_task_button_container->set_layout<GUI::HorizontalBoxLayout>();
+ m_task_button_container->layout()->set_spacing(3);
m_default_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png");
- create_quick_launch_bar();
+ main_widget.add<Taskbar::ClockWidget>();
}
TaskbarWindow::~TaskbarWindow()
@@ -154,7 +160,7 @@ void TaskbarWindow::on_screen_rect_change(const Gfx::IntRect& rect)
NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& identifier)
{
- auto& button = main_widget()->add<TaskbarButton>(identifier);
+ auto& button = m_task_button_container->add<TaskbarButton>(identifier);
button.set_min_size(20, 23);
button.set_max_size(140, 23);
button.set_text_alignment(Gfx::TextAlignment::CenterLeft);