mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
HackStudio: Add FindWidget
The find widget appears on Ctrl+F. It uses the GUI::TextEditor search API to search for text, which also takes care of highlighting the search results.
This commit is contained in:
parent
de902ab659
commit
d9d299f884
8 changed files with 186 additions and 4 deletions
44
Userland/DevTools/HackStudio/FindWidget.h
Normal file
44
Userland/DevTools/HackStudio/FindWidget.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Itamar S. <itamar8910@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Editor.h"
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
class Editor;
|
||||
class EditorWrapper;
|
||||
|
||||
class FindWidget final : public GUI::Widget {
|
||||
C_OBJECT(FindWidget)
|
||||
public:
|
||||
~FindWidget() = default;
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
bool visible() const { return m_visible; }
|
||||
|
||||
private:
|
||||
FindWidget(NonnullRefPtr<Editor>);
|
||||
|
||||
void find_next(GUI::TextEditor::SearchDirection);
|
||||
|
||||
static constexpr auto widget_height = 25;
|
||||
|
||||
NonnullRefPtr<Editor> m_editor;
|
||||
RefPtr<GUI::TextBox> m_input_field;
|
||||
RefPtr<GUI::Label> m_index_label;
|
||||
RefPtr<GUI::Button> m_next;
|
||||
RefPtr<GUI::Button> m_previous;
|
||||
bool m_visible { false };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue