mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
CharacterMap: Add a find-by-name window
This works the same way as the command-line usage, searching against the display name as provided by LibUnicode. I've modified the search loop to cover every possible unicode code-point, since my previous logic was flawed. Code-points are not dense, there are gaps, so simply iterating up to the count of them will skip ones with higher values. Surprisingly, iterating all 1,114,112 of them still runs in a third of a second. Computers are fast!
This commit is contained in:
parent
2bf7abcb28
commit
2a7c638cd9
8 changed files with 202 additions and 24 deletions
30
Userland/Applications/CharacterMap/CharacterSearchWidget.h
Normal file
30
Userland/Applications/CharacterMap/CharacterSearchWidget.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CharacterMapWidget.h"
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/ListView.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
|
||||
class CharacterSearchWidget final : public GUI::Widget {
|
||||
C_OBJECT(CharacterSearchWidget);
|
||||
|
||||
public:
|
||||
virtual ~CharacterSearchWidget() override;
|
||||
|
||||
Function<void(u32)> on_character_selected;
|
||||
|
||||
private:
|
||||
CharacterSearchWidget();
|
||||
|
||||
void search();
|
||||
|
||||
RefPtr<GUI::TextBox> m_search_input;
|
||||
RefPtr<GUI::Button> m_search_button;
|
||||
RefPtr<GUI::ListView> m_results_list;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue