summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-18 09:55:19 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-18 09:55:19 +0200
commit014cb1a55b70bfc2c5defbdeee3e13827f463e32 (patch)
tree65262437f700e28e72968823ff202442acd9c756 /Libraries
parent5aba8cc7506262b16b9a3cc4b2e2e4f6d402a0af (diff)
downloadserenity-014cb1a55b70bfc2c5defbdeee3e13827f463e32.zip
LibGUI: Tweak EmojiInputDialog layout :^)
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/EmojiInputDialog.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Libraries/LibGUI/EmojiInputDialog.cpp b/Libraries/LibGUI/EmojiInputDialog.cpp
index 3a29ddc21c..74429fdd5f 100644
--- a/Libraries/LibGUI/EmojiInputDialog.cpp
+++ b/Libraries/LibGUI/EmojiInputDialog.cpp
@@ -70,7 +70,7 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
auto codepoints = supported_emoji_codepoints();
size_t index = 0;
- size_t columns = 5;
+ size_t columns = 6;
size_t rows = ceil_div(codepoints.size(), columns);
for (size_t row = 0; row < rows && index < codepoints.size(); ++row) {
@@ -78,18 +78,18 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window)
auto& horizontal_layout = horizontal_container.set_layout<HorizontalBoxLayout>();
horizontal_layout.set_spacing(0);
for (size_t column = 0; column < columns; ++column) {
- StringBuilder builder;
- builder.append(Utf32View(&codepoints[index++], 1));
- auto emoji_text = builder.to_string();
- auto& button = horizontal_container.add<Button>(emoji_text);
- button.set_button_style(Gfx::ButtonStyle::CoolBar);
- button.on_click = [this, button = &button](auto) {
- m_selected_emoji_text = button->text();
- done(ExecOK);
- };
- if (index >= codepoints.size()) {
- horizontal_layout.add_spacer();
- break;
+ if (index < codepoints.size()) {
+ StringBuilder builder;
+ builder.append(Utf32View(&codepoints[index++], 1));
+ auto emoji_text = builder.to_string();
+ auto& button = horizontal_container.add<Button>(emoji_text);
+ button.set_button_style(Gfx::ButtonStyle::CoolBar);
+ button.on_click = [this, button = &button](auto) {
+ m_selected_emoji_text = button->text();
+ done(ExecOK);
+ };
+ } else {
+ horizontal_container.add<Widget>();
}
}
}