Make TreeSearchMode member of TreeSearch
This commit is contained in:
parent
329e90dfc6
commit
3b73f24f33
|
@ -118,11 +118,11 @@ bool TreeSearchPanel::has_focus() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeSearchMode TreeSearchPanel::get_search_mode() {
|
TreeSearch::TreeSearchMode TreeSearchPanel::get_search_mode() {
|
||||||
if (!check_button_filter_highlight || !check_button_filter_highlight->is_pressed()) {
|
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() {
|
String TreeSearchPanel::get_text() {
|
||||||
|
|
|
@ -34,39 +34,7 @@
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
enum TreeSearchMode {
|
class TreeSearchPanel;
|
||||||
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 TreeSearch : public RefCounted {
|
class TreeSearch : public RefCounted {
|
||||||
GDCLASS(TreeSearch, RefCounted)
|
GDCLASS(TreeSearch, RefCounted)
|
||||||
|
@ -116,6 +84,11 @@ protected:
|
||||||
static void _bind_methods() {}
|
static void _bind_methods() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum TreeSearchMode {
|
||||||
|
HIGHLIGHT = 0,
|
||||||
|
FILTER = 1
|
||||||
|
};
|
||||||
|
|
||||||
void update_search(Tree *p_tree);
|
void update_search(Tree *p_tree);
|
||||||
void notify_item_edited(TreeItem *p_item);
|
void notify_item_edited(TreeItem *p_item);
|
||||||
|
|
||||||
|
@ -123,5 +96,34 @@ public:
|
||||||
TreeSearch(TreeSearchPanel *p_search_panel);
|
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 // TREE_SEARCH_H
|
||||||
#endif // ! TOOLS_ENABLED
|
#endif // ! TOOLS_ENABLED
|
||||||
|
|
Loading…
Reference in New Issue