summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/IncrementalSearchBanner.h
blob: 5b6e80a26977a5d4c594a09cb9631592b1d6d3d5 (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
45
/*
 * Copyright (c) 2022, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibGUI/TextEditor.h>
#include <LibGUI/Widget.h>

namespace GUI {

class IncrementalSearchBanner final : public Widget {
    C_OBJECT(IncrementalSearchBanner);

public:
    virtual ~IncrementalSearchBanner() override = default;

    void show();
    void hide();

protected:
    explicit IncrementalSearchBanner(TextEditor&);

    virtual void paint_event(PaintEvent&) override;
    virtual Optional<UISize> calculated_min_size() const override;

private:
    void search(TextEditor::SearchDirection);

    NonnullRefPtr<TextEditor> m_editor;
    RefPtr<Button> m_close_button;
    RefPtr<Button> m_next_button;
    RefPtr<Button> m_previous_button;
    RefPtr<Button> m_wrap_search_button;
    RefPtr<Button> m_match_case_button;
    RefPtr<Label> m_index_label;
    RefPtr<TextBox> m_search_textbox;

    TextDocument::SearchShouldWrap m_wrap_search { true };
    bool m_match_case { false };
};

}