diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-20 22:07:49 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-20 22:07:49 (GMT) |
| commit | c8073657fcbfd1bfa72538d7babe4964857e7101 (patch) | |
| tree | f3488e993c9828121b2f89ed2f639d2ebbe54dc9 /src/search/SearchView.cpp | |
| parent | c5e8b345219cd7d8ca4b0aa638f59a1fed2cd83b (diff) | |
| download | powder-c8073657fcbfd1bfa72538d7babe4964857e7101.zip powder-c8073657fcbfd1bfa72538d7babe4964857e7101.tar.gz | |
More stuff, need to fix memory leak
Diffstat (limited to 'src/search/SearchView.cpp')
| -rw-r--r-- | src/search/SearchView.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/search/SearchView.cpp b/src/search/SearchView.cpp index 63a579e..2ddd76c 100644 --- a/src/search/SearchView.cpp +++ b/src/search/SearchView.cpp @@ -1,6 +1,7 @@ #include "SearchView.h" #include "interface/SaveButton.h" #include "interface/Label.h" +#include "interface/Textbox.h" #include "Misc.h" SearchView::SearchView(): @@ -11,10 +12,34 @@ SearchView::SearchView(): nextButton = new ui::Button(ui::Point(XRES+BARSIZE-52, YRES+MENUSIZE-18), ui::Point(50, 16), "Next \x95"); previousButton = new ui::Button(ui::Point(1, YRES+MENUSIZE-18), ui::Point(50, 16), "\x96 Prev"); + class SearchAction : public ui::TextboxAction + { + SearchView * v; + public: + SearchAction(SearchView * _v) { v = _v; } + void TextChangedCallback(ui::Textbox * sender) + { + v->doSearch(); + } + }; + searchField = new ui::Textbox(ui::Point(60, 10), ui::Point((XRES+BARSIZE)-((50*2)+16+10+50+10), 16), ""); + searchField->SetAlignment(AlignLeft, AlignBottom); + searchField->SetActionCallback(new SearchAction(this)); + nextButton->SetAlignment(AlignRight, AlignBottom); previousButton->SetAlignment(AlignLeft, AlignBottom); AddComponent(nextButton); AddComponent(previousButton); + AddComponent(searchField); + + ui::Label * searchPrompt = new ui::Label(ui::Point(10, 10), ui::Point(50, 16), "Search:"); + searchPrompt->SetAlignment(AlignLeft, AlignBottom); + AddComponent(searchPrompt); +} + +void SearchView::doSearch() +{ + c->DoSearch(searchField->GetText()); } SearchView::~SearchView() @@ -36,9 +61,9 @@ void SearchView::NotifySaveListChanged(SearchModel * sender) AddComponent(errorLabel); } if(sender->GetLastError().length()) - errorLabel->LabelText = sender->GetLastError(); + errorLabel->SetText(sender->GetLastError()); else - errorLabel->LabelText = "No saves found"; + errorLabel->SetText("No saves found"); } else { |
