summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/EmojiInputDialog.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-09-01 08:48:07 -0400
committerLinus Groh <mail@linusgroh.de>2022-09-07 14:34:02 +0100
commit11d29bc2ead1aa60e54774c0e7fa9796acad518c (patch)
tree8b9d3087d27c77a8673449bf6aba6951d256e75c /Userland/Libraries/LibGUI/EmojiInputDialog.cpp
parente26831686548bb8c9b39040d99549384faf706dd (diff)
downloadserenity-11d29bc2ead1aa60e54774c0e7fa9796acad518c.zip
LibGUI: Convert EmojiInputDialog to GML
This will allow easily adding components such as a search box. Also, increase the number of emoji per row. This does not fix the issue where too many emoji will cause the dialog to grow limitlessly, but it looks a bit more reasonable now with the number of emoji that we have.
Diffstat (limited to 'Userland/Libraries/LibGUI/EmojiInputDialog.cpp')
-rw-r--r--Userland/Libraries/LibGUI/EmojiInputDialog.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp
index d586ddd93e..145461fda1 100644
--- a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp
+++ b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp
@@ -12,6 +12,7 @@
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/EmojiInputDialog.h>
+#include <LibGUI/EmojiInputDialogGML.h>
#include <LibGUI/Event.h>
#include <LibGUI/Frame.h>
#include <stdlib.h>
@@ -43,20 +44,17 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
: Dialog(parent_window)
{
auto& main_widget = set_main_widget<Frame>();
- main_widget.set_frame_shape(Gfx::FrameShape::Container);
- main_widget.set_frame_shadow(Gfx::FrameShadow::Raised);
- main_widget.set_fill_with_background_color(true);
- auto& main_layout = main_widget.set_layout<VerticalBoxLayout>();
- main_layout.set_margins(1);
- main_layout.set_spacing(0);
+ if (!main_widget.load_from_gml(emoji_input_dialog_gml))
+ VERIFY_NOT_REACHED();
+ auto& emojis_widget = *main_widget.find_descendant_of_type_named<GUI::Widget>("emojis"sv);
auto code_points = supported_emoji_code_points();
size_t index = 0;
- size_t columns = 10;
+ size_t columns = 18;
size_t rows = ceil_div(code_points.size(), columns);
- constexpr int button_size = 18;
+ constexpr int button_size = 20;
// FIXME: I have no idea why this is needed, you'd think that button width * number of buttons would make them fit, but the last one gets cut off.
constexpr int magic_offset = 7;
int dialog_width = button_size * columns + magic_offset;
@@ -66,7 +64,7 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
set_frameless(true);
for (size_t row = 0; row < rows && index < code_points.size(); ++row) {
- auto& horizontal_container = main_widget.add<Widget>();
+ auto& horizontal_container = emojis_widget.add<Widget>();
auto& horizontal_layout = horizontal_container.set_layout<HorizontalBoxLayout>();
horizontal_layout.set_spacing(0);
for (size_t column = 0; column < columns; ++column) {