2020-05-17 21:49:54 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-05-17 21:49:54 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-09-07 15:50:45 -04:00
|
|
|
#include <AK/Optional.h>
|
|
|
|
|
#include <AK/OwnPtr.h>
|
2020-05-17 21:49:54 +02:00
|
|
|
#include <LibGUI/Dialog.h>
|
2022-09-07 13:42:15 -04:00
|
|
|
#include <LibUnicode/Emoji.h>
|
2020-05-17 21:49:54 +02:00
|
|
|
|
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
|
|
class EmojiInputDialog final : public Dialog {
|
|
|
|
|
C_OBJECT(EmojiInputDialog);
|
|
|
|
|
|
2022-09-06 10:30:37 -04:00
|
|
|
struct Emoji {
|
|
|
|
|
u32 code_point { 0 };
|
|
|
|
|
RefPtr<Button> button;
|
2022-09-07 13:42:15 -04:00
|
|
|
Optional<Unicode::Emoji> emoji;
|
2022-09-06 10:30:37 -04:00
|
|
|
};
|
|
|
|
|
|
2020-05-17 21:49:54 +02:00
|
|
|
public:
|
2022-04-01 20:58:27 +03:00
|
|
|
String const& selected_emoji_text() const { return m_selected_emoji_text; }
|
2020-05-17 21:49:54 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
virtual void event(Core::Event&) override;
|
|
|
|
|
explicit EmojiInputDialog(Window* parent_window);
|
|
|
|
|
|
2022-09-06 10:30:37 -04:00
|
|
|
Vector<Emoji> supported_emoji();
|
2022-09-06 08:25:02 -04:00
|
|
|
void update_displayed_emoji();
|
|
|
|
|
|
2022-09-07 15:50:45 -04:00
|
|
|
OwnPtr<ActionGroup> m_category_action_group;
|
|
|
|
|
Optional<Unicode::EmojiGroup> m_selected_category;
|
|
|
|
|
|
2022-09-06 10:59:44 -04:00
|
|
|
RefPtr<TextBox> m_search_box;
|
2022-09-07 15:50:45 -04:00
|
|
|
RefPtr<Toolbar> m_toolbar;
|
2022-09-06 08:25:02 -04:00
|
|
|
RefPtr<Widget> m_emojis_widget;
|
2022-09-06 10:30:37 -04:00
|
|
|
Vector<Emoji> m_emojis;
|
2020-05-17 21:49:54 +02:00
|
|
|
String m_selected_emoji_text;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|