2020-02-16 21:28:08 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-02-16 21:28:08 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-03-11 23:16:23 +03:00
|
|
|
#include <LibGUI/ImageWidget.h>
|
2020-02-16 21:28:08 +03:00
|
|
|
#include <LibGUI/Window.h>
|
|
|
|
|
|
|
|
namespace NotificationServer {
|
|
|
|
|
|
|
|
class NotificationWindow final : public GUI::Window {
|
|
|
|
C_OBJECT(NotificationWindow);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~NotificationWindow() override;
|
2020-06-10 11:57:59 +03:00
|
|
|
void set_original_rect(Gfx::IntRect original_rect) { m_original_rect = original_rect; };
|
2020-02-16 21:28:08 +03:00
|
|
|
|
2021-03-12 00:43:01 +03:00
|
|
|
void set_text(const String&);
|
|
|
|
void set_title(const String&);
|
|
|
|
void set_image(const Gfx::ShareableBitmap&);
|
|
|
|
|
2021-03-11 23:09:37 +03:00
|
|
|
static RefPtr<NotificationWindow> get_window_by_id(i32 id);
|
|
|
|
|
2021-07-26 00:35:50 +03:00
|
|
|
protected:
|
|
|
|
virtual void enter_event(Core::Event&) override;
|
|
|
|
virtual void leave_event(Core::Event&) override;
|
|
|
|
|
2020-02-16 21:28:08 +03:00
|
|
|
private:
|
2021-03-11 22:59:37 +03:00
|
|
|
NotificationWindow(i32 client_id, const String& text, const String& title, const Gfx::ShareableBitmap&);
|
2020-02-16 21:51:44 +03:00
|
|
|
|
2021-06-13 15:16:06 +03:00
|
|
|
virtual void screen_rects_change_event(GUI::ScreenRectsChangeEvent&) override;
|
2021-04-04 01:07:27 +03:00
|
|
|
|
2021-07-26 00:35:50 +03:00
|
|
|
void resize_to_fit_text();
|
|
|
|
void set_height(int);
|
|
|
|
|
2020-06-10 11:57:59 +03:00
|
|
|
Gfx::IntRect m_original_rect;
|
2021-03-11 22:59:37 +03:00
|
|
|
i32 m_id;
|
2021-03-11 23:16:23 +03:00
|
|
|
|
|
|
|
GUI::Label* m_text_label;
|
|
|
|
GUI::Label* m_title_label;
|
|
|
|
GUI::ImageWidget* m_image;
|
2021-07-26 00:35:50 +03:00
|
|
|
bool m_hovering { false };
|
2020-02-16 21:28:08 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|