IncrementalSearchBanner.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2022, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGUI/TextEditor.h>
  8. #include <LibGUI/Widget.h>
  9. namespace GUI {
  10. class IncrementalSearchBanner final : public Widget {
  11. C_OBJECT(IncrementalSearchBanner);
  12. public:
  13. virtual ~IncrementalSearchBanner() override = default;
  14. void show();
  15. void hide();
  16. protected:
  17. explicit IncrementalSearchBanner(TextEditor&);
  18. virtual void paint_event(PaintEvent&) override;
  19. virtual Optional<UISize> calculated_min_size() const override;
  20. private:
  21. void search(TextEditor::SearchDirection);
  22. NonnullRefPtr<TextEditor> m_editor;
  23. RefPtr<Button> m_close_button;
  24. RefPtr<Button> m_next_button;
  25. RefPtr<Button> m_previous_button;
  26. RefPtr<Button> m_wrap_search_button;
  27. RefPtr<Button> m_match_case_button;
  28. RefPtr<Label> m_index_label;
  29. RefPtr<TextBox> m_search_textbox;
  30. TextDocument::SearchShouldWrap m_wrap_search { true };
  31. bool m_match_case { false };
  32. };
  33. }