mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
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!
31 lines
628 B
C++
31 lines
628 B
C++
/*
|
|
* 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;
|
|
};
|