mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:55:08 +00:00

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.
36 lines
716 B
C++
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;
|
|
};
|
|
|
|
}
|