Serenity Operating System
1/*
2 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <LibGUI/ImageWidget.h>
10#include <LibGUI/Window.h>
11
12namespace NotificationServer {
13
14class NotificationWindow final : public GUI::Window {
15 C_OBJECT(NotificationWindow);
16
17public:
18 virtual ~NotificationWindow() override = default;
19 void set_original_rect(Gfx::IntRect original_rect) { m_original_rect = original_rect; };
20
21 void set_text(DeprecatedString const&);
22 void set_title(DeprecatedString const&);
23 void set_image(Gfx::ShareableBitmap const&);
24
25 static RefPtr<NotificationWindow> get_window_by_id(i32 id);
26
27protected:
28 virtual void enter_event(Core::Event&) override;
29 virtual void leave_event(Core::Event&) override;
30
31private:
32 NotificationWindow(i32 client_id, DeprecatedString const& text, DeprecatedString const& title, Gfx::ShareableBitmap const&);
33
34 virtual void screen_rects_change_event(GUI::ScreenRectsChangeEvent&) override;
35
36 void resize_to_fit_text();
37 void set_height(int);
38
39 Gfx::IntRect m_original_rect;
40 i32 m_id;
41
42 GUI::Label* m_text_label;
43 GUI::Label* m_title_label;
44 GUI::ImageWidget* m_image;
45 bool m_hovering { false };
46};
47
48}