1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:55:08 +00:00
serenity/Userland/Libraries/LibGUI/EmojiInputDialog.h
Timothy Flynn 1c32823dd8 LibGUI: Create the emoji buttons only once for EmojiInputDialog
To prevent lag when the displayed code points are redrawn in support of
a search box, only create the GUI::Button objects for the emoji a single
time. Re-use those buttons when adding them to the dialog.
2022-09-07 14:34:02 +01:00

36 lines
716 B
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Dialog.h>
namespace GUI {
class EmojiInputDialog final : public Dialog {
C_OBJECT(EmojiInputDialog);
struct Emoji {
u32 code_point { 0 };
RefPtr<Button> button;
};
public:
String const& selected_emoji_text() const { return m_selected_emoji_text; }
private:
virtual void event(Core::Event&) override;
explicit EmojiInputDialog(Window* parent_window);
Vector<Emoji> supported_emoji();
void update_displayed_emoji();
RefPtr<Widget> m_emojis_widget;
Vector<Emoji> m_emojis;
String m_selected_emoji_text;
};
}