diff --git a/editor/tree_search.cpp b/editor/tree_search.cpp index 0711272..7941a15 100644 --- a/editor/tree_search.cpp +++ b/editor/tree_search.cpp @@ -118,11 +118,11 @@ bool TreeSearchPanel::has_focus() { return false; } -TreeSearchMode TreeSearchPanel::get_search_mode() { +TreeSearch::TreeSearchMode TreeSearchPanel::get_search_mode() { if (!check_button_filter_highlight || !check_button_filter_highlight->is_pressed()) { - return TreeSearchMode::HIGHLIGHT; + return TreeSearch::TreeSearchMode::HIGHLIGHT; } - return TreeSearchMode::FILTER; + return TreeSearch::TreeSearchMode::FILTER; } String TreeSearchPanel::get_text() { diff --git a/editor/tree_search.h b/editor/tree_search.h index a1c8259..0d1ac71 100644 --- a/editor/tree_search.h +++ b/editor/tree_search.h @@ -34,39 +34,7 @@ using namespace godot; -enum TreeSearchMode { - HIGHLIGHT = 0, - FILTER = 1 -}; - -class TreeSearchPanel : public HFlowContainer { - GDCLASS(TreeSearchPanel, HFlowContainer) - -private: - Button *toggle_button_filter_highlight; - Button *close_button; - Label *label_filter; - LineEdit *line_edit_search; - CheckBox *check_button_filter_highlight; - void _initialize_controls(); - void _initialize_close_callbacks(); - void _add_spacer(float width_multiplier = 1.f); - - void _on_draw_highlight(TreeItem *p_item, Rect2 p_rect); - void _emit_text_submitted(const String &p_text); - void _emit_update_requested(); - void _notification(int p_what); - -protected: - static void _bind_methods(); - -public: - TreeSearchMode get_search_mode(); - String get_text(); - void show_and_focus(); - TreeSearchPanel(); - bool has_focus(); -}; +class TreeSearchPanel; class TreeSearch : public RefCounted { GDCLASS(TreeSearch, RefCounted) @@ -116,6 +84,11 @@ protected: static void _bind_methods() {} public: + enum TreeSearchMode { + HIGHLIGHT = 0, + FILTER = 1 + }; + void update_search(Tree *p_tree); void notify_item_edited(TreeItem *p_item); @@ -123,5 +96,34 @@ public: TreeSearch(TreeSearchPanel *p_search_panel); }; +class TreeSearchPanel : public HFlowContainer { + GDCLASS(TreeSearchPanel, HFlowContainer) + +private: + Button *toggle_button_filter_highlight; + Button *close_button; + Label *label_filter; + LineEdit *line_edit_search; + CheckBox *check_button_filter_highlight; + void _initialize_controls(); + void _initialize_close_callbacks(); + void _add_spacer(float width_multiplier = 1.f); + + void _on_draw_highlight(TreeItem *p_item, Rect2 p_rect); + void _emit_text_submitted(const String &p_text); + void _emit_update_requested(); + void _notification(int p_what); + +protected: + static void _bind_methods(); + +public: + TreeSearch::TreeSearchMode get_search_mode(); + String get_text(); + void show_and_focus(); + TreeSearchPanel(); + bool has_focus(); +}; + #endif // TREE_SEARCH_H #endif // ! TOOLS_ENABLED