diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.h b/Userland/Libraries/LibGUI/AbstractScrollableWidget.h index 7f160660937..6e33e2ceb49 100644 --- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.h +++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.h @@ -56,6 +56,7 @@ public: void scroll_to_top(); void scroll_to_bottom(); + void update_scrollbar_ranges(); void set_automatic_scrolling_timer(bool active); virtual Gfx::IntPoint automatic_scroll_delta_from_position(Gfx::IntPoint const&) const; @@ -89,7 +90,6 @@ protected: virtual void on_automatic_scrolling_timer_fired() {}; int autoscroll_threshold() const { return m_autoscroll_threshold; } void update_scrollbar_visibility(); - void update_scrollbar_ranges(); private: class AbstractScrollableWidgetScrollbar final : public Scrollbar { diff --git a/Userland/Libraries/LibGUI/CMakeLists.txt b/Userland/Libraries/LibGUI/CMakeLists.txt index 65fd6414974..ae8fa20e23d 100644 --- a/Userland/Libraries/LibGUI/CMakeLists.txt +++ b/Userland/Libraries/LibGUI/CMakeLists.txt @@ -1,6 +1,7 @@ compile_gml(EmojiInputDialog.gml EmojiInputDialogGML.h emoji_input_dialog_gml) compile_gml(FontPickerDialog.gml FontPickerDialogGML.h font_picker_dialog_gml) compile_gml(FilePickerDialog.gml FilePickerDialogGML.h file_picker_dialog_gml) +compile_gml(IncrementalSearchBanner.gml IncrementalSearchBannerGML.h incremental_search_banner_gml) compile_gml(PasswordInputDialog.gml PasswordInputDialogGML.h password_input_dialog_gml) set(SOURCES @@ -57,6 +58,7 @@ set(SOURCES Icon.cpp IconView.cpp ImageWidget.cpp + IncrementalSearchBanner.cpp INILexer.cpp INISyntaxHighlighter.cpp InputBox.cpp @@ -133,6 +135,7 @@ set(GENERATED_SOURCES EmojiInputDialogGML.h FilePickerDialogGML.h FontPickerDialogGML.h + IncrementalSearchBannerGML.h PasswordInputDialogGML.h ) diff --git a/Userland/Libraries/LibGUI/Forward.h b/Userland/Libraries/LibGUI/Forward.h index 2a11e532836..0ad380d3448 100644 --- a/Userland/Libraries/LibGUI/Forward.h +++ b/Userland/Libraries/LibGUI/Forward.h @@ -37,6 +37,7 @@ class HorizontalSlider; class Icon; class IconView; class ImageWidget; +class IncrementalSearchBanner; class JsonArrayModel; class KeyEvent; class Label; diff --git a/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp b/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp new file mode 100644 index 00000000000..eeab9a573c8 --- /dev/null +++ b/Userland/Libraries/LibGUI/IncrementalSearchBanner.cpp @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2022, Itamar S. + * Copyright (c) 2022, the SerenityOS developers. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace GUI { + +IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor) + : m_editor(editor) +{ + load_from_gml(incremental_search_banner_gml); + m_index_label = find_descendant_of_type_named