summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/FindWidget.h
blob: 246ad7a4b947d7098aaf78c1c37b02e6a2080cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 };
};

}