mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:05:00 +00:00

This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibCore/DateTime.h>
|
|
#include <LibCore/Timer.h>
|
|
#include <LibGUI/Application.h>
|
|
#include <LibGUI/BoxLayout.h>
|
|
#include <LibGUI/Button.h>
|
|
#include <LibGUI/Calendar.h>
|
|
#include <LibGUI/Frame.h>
|
|
#include <LibGUI/Label.h>
|
|
#include <time.h>
|
|
|
|
namespace Taskbar {
|
|
|
|
class ClockWidget final : public GUI::Frame {
|
|
C_OBJECT(ClockWidget);
|
|
|
|
public:
|
|
virtual ~ClockWidget() override = default;
|
|
|
|
void update_format(ByteString const&);
|
|
|
|
private:
|
|
ClockWidget();
|
|
|
|
virtual void paint_event(GUI::PaintEvent&) override;
|
|
virtual void mousedown_event(GUI::MouseEvent&) override;
|
|
virtual void context_menu_event(GUI::ContextMenuEvent&) override;
|
|
|
|
void tick_clock()
|
|
{
|
|
tzset();
|
|
update();
|
|
}
|
|
|
|
void open();
|
|
void close();
|
|
|
|
void position_calendar_window();
|
|
void jump_to_current_date();
|
|
|
|
void update_selected_calendar_button();
|
|
|
|
ByteString m_time_format;
|
|
RefPtr<GUI::Window> m_calendar_window;
|
|
RefPtr<GUI::Calendar> m_calendar;
|
|
RefPtr<GUI::Button> m_next_date;
|
|
RefPtr<GUI::Button> m_prev_date;
|
|
RefPtr<GUI::Button> m_selected_calendar_button;
|
|
RefPtr<GUI::Button> m_jump_to_button;
|
|
RefPtr<GUI::Button> m_calendar_launcher;
|
|
RefPtr<GUI::Menu> m_context_menu;
|
|
RefPtr<Core::Timer> m_timer;
|
|
int m_time_width { 0 };
|
|
Gfx::IntSize m_window_size { 158, 186 };
|
|
};
|
|
|
|
}
|