Use toolbutton for clear search term

This commit is contained in:
marynate 2014-06-17 13:38:27 +08:00
parent 8b31ae491f
commit b9a8c39af5
2 changed files with 12 additions and 4 deletions

View file

@ -1023,6 +1023,14 @@ void ProjectListFilter::_filter_option_selected(int p_idx) {
}
}
void ProjectListFilter::_notification(int p_what) {
switch(p_what) {
case NOTIFICATION_ENTER_SCENE: {
clear_search_button->set_icon(get_icon("CloseHover","EditorIcons"));
} break;
}
}
void ProjectListFilter::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_command"),&ProjectListFilter::_command);
@ -1049,8 +1057,7 @@ ProjectListFilter::ProjectListFilter() {
search_box->set_h_size_flags(SIZE_EXPAND_FILL);
add_child(search_box);
clear_search_button = memnew( Button );
clear_search_button->set_text("clear");
clear_search_button = memnew( ToolButton );
clear_search_button->connect("pressed",this,"_command",make_binds(CMD_CLEAR_FILTER));
add_child(clear_search_button);

View file

@ -33,6 +33,7 @@
#include "scene/gui/tree.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/tool_button.h"
class NewProjectDialog;
class ProjectListFilter;
@ -104,7 +105,7 @@ private:
OptionButton *filter_option;
LineEdit *search_box;
Button *clear_search_button;
ToolButton *clear_search_button;
enum FilterOption {
FILTER_NAME,
@ -118,7 +119,7 @@ private:
void _filter_option_selected(int p_idx);
protected:
void _notification(int p_what);
static void _bind_methods();
public: