From c8073657fcbfd1bfa72538d7babe4964857e7101 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Fri, 20 Jan 2012 22:07:49 +0000 Subject: [PATCH] More stuff, need to fix memory leak --- Makefile | 43 ++++--- PowderToy++.files | 3 + build/obj/.empty | 0 src/PowderToy.cpp | 22 +--- src/client/Client.cpp | 1 - src/interface/Button.cpp | 30 +---- src/interface/Keys.h | 8 ++ src/interface/Label.cpp | 63 +++++++++-- src/interface/Label.h | 14 ++- src/interface/SaveButton.cpp | 1 + src/interface/Textbox.cpp | 192 ++++++++++++++++++++++++++++++++ src/interface/Textbox.h | 44 ++++++++ src/search/SearchController.cpp | 8 +- src/search/SearchController.h | 1 + src/search/SearchModel.cpp | 4 +- src/search/SearchModel.h | 2 +- src/search/SearchView.cpp | 29 ++++- src/search/SearchView.h | 3 + 18 files changed, 384 insertions(+), 84 deletions(-) create mode 100644 build/obj/.empty create mode 100644 src/interface/Keys.h create mode 100644 src/interface/Textbox.cpp create mode 100644 src/interface/Textbox.h diff --git a/Makefile b/Makefile index 43fa1574b..af59a9b34 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,45 @@ HEADERS := $(wildcard src/*.h) $(wildcard src/*/*.h) SOURCES := $(wildcard src/*.cpp) $(wildcard src/*/*.cpp) -OBJS += $(patsubst src/%.cpp,build/obj/powder.exe/%.o,$(SOURCES)) +OBJS := $(patsubst src/%.cpp,build/obj/%.o,$(SOURCES)) -FOLDERS := $(sort $(dir $(OBJS))) +FOLDERS := -CFLAGS := -w -Isrc/ -Idata/ -DWIN32 -DWINCONSOLE +CFLAGS := -w -Isrc/ -Idata/ OFLAGS := -fkeep-inline-functions #-O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -msse2 -LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 # -mwindows - -CFLAGS += $(OFLAGS) CPPC := g++ CPPC_WIN := i686-w64-mingw32-gcc WIN_RES := i686-w64-mingw32-windres -all: build/powder.exe +all: build/powder + powder.exe: build/powder.exe +powder: build/powder + +build/powder.exe: CFLAGS += -DWIN32 -DWINCONSOLE +build/powder.exe: LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 #-mwindows +build/powder: CFLAGS += -DLIN32 +build/powder: LFLAGS := -lSDL -lm -lbz2 -build/powder.exe: buildpaths $(OBJS) - echo $(OBJS) - $(CPPC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LFLAGS) -o $@ -ggdb + +build/powder.exe: buildpaths-powder.exe $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) + $(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) $(LFLAGS) -o $@ -ggdb build/obj/powder.exe/%.o: src/%.cpp $(HEADERS) - $(CPPC) -c $(CFLAGS) -o $@ $< -ggdb -buildpaths: + $(CPPC) -c $(CFLAGS) $(OFLAGS) -o $@ $< -ggdb +buildpaths-powder.exe: $(shell mkdir build/obj/powder.exe/) - $(shell mkdir $(FOLDERS)) + $(shell mkdir $(sort $(dir $(OBJS)))) + +build/powder: buildpaths-powder $(patsubst build/obj/%.o,build/obj/powder/%.o,$(OBJS)) + $(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder/%.o,$(OBJS)) $(LFLAGS) -o $@ -ggdb +build/obj/powder/%.o: src/%.cpp $(HEADERS) + $(CPPC) -c $(CFLAGS) $(OFLAGS) -o $@ $< -ggdb +buildpaths-powder: + $(shell mkdir build/obj/powder/) + $(shell mkdir $(sort $(dir $(OBJS)))) clean: - rm build/obj/core/*.o - rm build/obj/ui/*.o - rm build/obj/elements/*.o - rm build/obj/*.o + rm -r build/obj/* rm build/*.exe \ No newline at end of file diff --git a/PowderToy++.files b/PowderToy++.files index 765f38029..022927d16 100644 --- a/PowderToy++.files +++ b/PowderToy++.files @@ -333,3 +333,6 @@ src/cajun/elements.h src/cajun/writer.inl src/cajun/reader.inl src/cajun/elements.inl +src/interface/Textbox.h +src/interface/Textbox.cpp +src/interface/Keys.h diff --git a/build/obj/.empty b/build/obj/.empty new file mode 100644 index 000000000..e69de29bb diff --git a/src/PowderToy.cpp b/src/PowderToy.cpp index 5d1db346f..c6f5caffa 100644 --- a/src/PowderToy.cpp +++ b/src/PowderToy.cpp @@ -63,28 +63,14 @@ int main(int argc, char * argv[]) int elapsedTime = 0, currentTime = 0, lastTime = 0, currentFrame = 0; float fps = 0, fpsLimit = 30, delta = 1.0f; - //Renderer * ren; - //Simulation * sim = new Simulation(); - //ren = new Renderer(g, sim); - ui::Engine::Ref().g = new Graphics(); ui::Engine::Ref().g->AttachSDLSurface(SDLOpen()); - ui::Engine * engine = &ui::Engine::Ref();//new ui::Engine(); - //ui::State * engineState = new ui::State(); - ui::Label * fpsLabel = new ui::Label(ui::Point(2, 2), ui::Point(200, 14), std::string("FPS: 0")); - //engineState->AddComponent(fpsLabel); + ui::Engine * engine = &ui::Engine::Ref(); engine->Begin(XRES, YRES); -// engine->SetState(engineState); GameController * gameController = new GameController(); engine->ShowWindow(gameController->GetView()); - /*ui::Sandbox * sandbox = new ui::Sandbox(); - ui::Button * button = new ui::Button(ui::Point(100, 100), ui::Point(100, 100), std::string("poP")); - engineState->AddComponent(fpsLabel); - engineState->AddComponent(sandbox); - engineState->AddComponent(button); - engineState->AddComponent(ControlFactory::MainMenu(0, YRES+MENUSIZE-17, XRES+BARSIZE, 16));*/ SDL_Event event; while(engine->Running()) @@ -98,6 +84,7 @@ int main(int argc, char * argv[]) engine->Exit(); break; case SDL_KEYDOWN: + engine->onKeyPress(event.key.keysym.sym, false, false, false); break; case SDL_KEYUP: break; @@ -113,11 +100,6 @@ int main(int argc, char * argv[]) } event.type = 0; //Clear last event } - //mouseButton = SDL_GetMouseState(&mouseX, &mouseY); - fpsLabel->LabelText = ""; - stringstream fpsText; - fpsText << "FPS: " << fps; - fpsLabel->LabelText = fpsText.str(); engine->Tick(delta); engine->Draw(); diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 1e2e76fa6..a3319b678 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -217,7 +217,6 @@ Thumbnail * Client::GetThumbnail(int saveID, int saveDate) activeThumbRequests[i] = http_async_req_start(NULL, (char *)urlStream.str().c_str(), NULL, 0, 1); activeThumbRequestTimes[i] = currentTime; activeThumbRequestCompleteTimes[i] = 0; - std::cout << "ThumbCache: Requesting " << urlStream.str() << " : " << idString << std::endl; activeThumbRequestIDs[i] = idString; return NULL; } diff --git a/src/interface/Button.cpp b/src/interface/Button.cpp index affa75d74..783c29747 100644 --- a/src/interface/Button.cpp +++ b/src/interface/Button.cpp @@ -130,34 +130,6 @@ void Button::Draw(const Point& screenPos) g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 255, 255, 255, 255); g->drawtext(Position.X+textPosition.X, Position.Y+textPosition.Y, ButtonText, 255, 255, 255, 255); } - /*sf::RenderWindow* rw = reinterpret_cast(userdata); //it better be a RenderWindow or so help your god - - //Draw component here - sf::Text textGraphic(ButtonText); - textGraphic.SetCharacterSize(11); - if(isButtonDown) - textGraphic.SetColor(sf::Color::Black); - else - textGraphic.SetColor(sf::Color::White); - sf::FloatRect tempRect = textGraphic.GetRect(); - textGraphic.SetPosition(ceil(X + Width/2 - tempRect.Width/2), ceil(Y + Height/2 - tempRect.Height/2)); - - if(isMouseInside) - { - if(isButtonDown) - rw->Draw(sf::Shape::Rectangle(X+2, Y+2, Width-4, Width-4, sf::Color::White, 2.f, sf::Color::Black)); - else - rw->Draw(sf::Shape::Rectangle(X+2, Y+2, Width-4, Width-4, sf::Color::Black, 2.f, sf::Color::White)); - } - else - { - if(isButtonDown) - rw->Draw(sf::Shape::Rectangle(X+2, Y+2, Width-4, Width-4, sf::Color::White, 2.f, sf::Color::Black)); - else - rw->Draw(sf::Shape::Rectangle(X+1, Y+1, Width-2, Width-2, sf::Color::Black, 1.f, sf::Color::White)); - } - - rw->Draw(textGraphic);*/ } void Button::OnMouseUnclick(int x, int y, unsigned int button) @@ -218,6 +190,8 @@ void Button::SetActionCallback(ButtonAction * action) Button::~Button() { + if(actionCallback) + delete actionCallback; } } /* namespace ui */ diff --git a/src/interface/Keys.h b/src/interface/Keys.h new file mode 100644 index 000000000..e92370367 --- /dev/null +++ b/src/interface/Keys.h @@ -0,0 +1,8 @@ +#define KEY_UP SDLK_UP +#define KEY_DOWN SDLK_DOWN +#define KEY_RIGHT SDLK_RIGHT +#define KEY_LEFT SDLK_LEFT +#define KEY_HOME SDLK_HOME +#define KEY_END SDLK_END +#define KEY_BACKSPACE SDLK_BACKSPACE +#define KEY_DELETE SDLK_DELETE diff --git a/src/interface/Label.cpp b/src/interface/Label.cpp index cf09d4e42..6fc47e201 100644 --- a/src/interface/Label.cpp +++ b/src/interface/Label.cpp @@ -1,30 +1,39 @@ #include #include "Config.h" #include "Global.h" -#include "interface/Point.h" -#include "interface/Label.h" +#include "Point.h" +#include "Label.h" using namespace ui; Label::Label(Window* parent_state, std::string labelText): Component(parent_state), - LabelText(labelText) + text(labelText), + textPosition(ui::Point(0, 0)), + textVAlign(AlignMiddle), + textHAlign(AlignCentre) { - + TextPosition(); } Label::Label(Point position, Point size, std::string labelText): Component(position, size), - LabelText(labelText) + text(labelText), + textPosition(ui::Point(0, 0)), + textVAlign(AlignMiddle), + textHAlign(AlignCentre) { - + TextPosition(); } Label::Label(std::string labelText): Component(), - LabelText(labelText) + text(labelText), + textPosition(ui::Point(0, 0)), + textVAlign(AlignMiddle), + textHAlign(AlignCentre) { - + TextPosition(); } Label::~Label() @@ -32,9 +41,45 @@ Label::~Label() } +void Label::TextPosition() +{ + //Position.X+(Size.X-Graphics::textwidth((char *)ButtonText.c_str()))/2, Position.Y+(Size.Y-10)/2 + switch(textVAlign) + { + case AlignTop: + textPosition.Y = 3; + break; + case AlignMiddle: + textPosition.Y = (Size.Y-10)/2; + break; + case AlignBottom: + textPosition.Y = Size.Y-11; + break; + } + + switch(textHAlign) + { + case AlignLeft: + textPosition.X = 3; + break; + case AlignCentre: + textPosition.X = (Size.X-Graphics::textwidth((char *)text.c_str()))/2; + break; + case AlignRight: + textPosition.X = (Size.X-Graphics::textwidth((char *)text.c_str()))-2; + break; + } +} + +void Label::SetText(std::string text) +{ + this->text = text; + TextPosition(); +} void Label::Draw(const Point& screenPos) { Graphics * g = Engine::Ref().g; - g->drawtext(Position.X+(Size.X-Graphics::textwidth((char *)LabelText.c_str()))/2, Position.Y+(Size.Y-10)/2, LabelText, 255, 255, 255, 255); + g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, text, 255, 255, 255, 255); } + diff --git a/src/interface/Label.h b/src/interface/Label.h index e56852e81..9b5a454cb 100644 --- a/src/interface/Label.h +++ b/src/interface/Label.h @@ -4,20 +4,28 @@ #include #include "Component.h" +#include "Misc.h" namespace ui { class Label : public Component { + std::string text; + ui::Point textPosition; + HorizontalAlignment textHAlign; + VerticalAlignment textVAlign; public: Label(Window* parent_state, std::string labelText); - Label(Point position, Point size, std::string labelText); - Label(std::string labelText); virtual ~Label(); - std::string LabelText; + void TextPosition(); + void SetText(std::string text); + HorizontalAlignment GetHAlignment() { return textHAlign; } + VerticalAlignment GetVAlignment() { return textVAlign; } + void SetAlignment(HorizontalAlignment hAlign, VerticalAlignment vAlign) { textHAlign = hAlign; textVAlign = vAlign; TextPosition(); } + virtual void Draw(const Point& screenPos); }; diff --git a/src/interface/SaveButton.cpp b/src/interface/SaveButton.cpp index 18f328167..cf1c0f265 100644 --- a/src/interface/SaveButton.cpp +++ b/src/interface/SaveButton.cpp @@ -58,6 +58,7 @@ void SaveButton::Tick(float dt) if(tempThumb) { thumbnail = tempThumb; //Store a local copy of the thumbnail + cout << (void *)(tempThumb) << " " << (void *)(&thumbnail) << endl; if(thumbnail->Data) { if(thumbnail->Size.Y > (Size.Y-25)) diff --git a/src/interface/Textbox.cpp b/src/interface/Textbox.cpp new file mode 100644 index 000000000..3cedc156b --- /dev/null +++ b/src/interface/Textbox.cpp @@ -0,0 +1,192 @@ +#include +#include +#include "Config.h" +#include "Global.h" +#include "interface/Point.h" +#include "interface/Textbox.h" +#include "interface/Keys.h" + +using namespace ui; + +Textbox::Textbox(Window* parent_state, std::string textboxText): + Component(parent_state), + text(textboxText), + textPosition(ui::Point(0, 0)), + textVAlign(AlignMiddle), + textHAlign(AlignCentre), + actionCallback(NULL) +{ + TextPosition(); + cursor = text.length(); +} + +Textbox::Textbox(Point position, Point size, std::string textboxText): + Component(position, size), + text(textboxText), + textPosition(ui::Point(0, 0)), + textVAlign(AlignMiddle), + textHAlign(AlignCentre), + actionCallback(NULL) +{ + TextPosition(); + cursor = text.length(); +} + +Textbox::Textbox(std::string textboxText): + Component(), + text(textboxText), + textPosition(ui::Point(0, 0)), + textVAlign(AlignMiddle), + textHAlign(AlignCentre), + actionCallback(NULL) +{ + TextPosition(); + cursor = text.length(); +} + +Textbox::~Textbox() +{ + if(actionCallback) + delete actionCallback; +} + +void Textbox::TextPosition() +{ + std::string tempText = text; + if(tempText.length() && cursor) + { + tempText.erase(cursor, tempText.length()-cursor); + cursorPosition = Graphics::textwidth((char *)tempText.c_str()); + } + else + { + cursorPosition = 0; + } + //Position.X+(Size.X-Graphics::textwidth((char *)ButtonText.c_str()))/2, Position.Y+(Size.Y-10)/2 + switch(textVAlign) + { + case AlignTop: + textPosition.Y = 3; + break; + case AlignMiddle: + textPosition.Y = (Size.Y-10)/2; + break; + case AlignBottom: + textPosition.Y = Size.Y-11; + break; + } + + switch(textHAlign) + { + case AlignLeft: + textPosition.X = 3; + break; + case AlignCentre: + textPosition.X = (Size.X-Graphics::textwidth((char *)text.c_str()))/2; + break; + case AlignRight: + textPosition.X = (Size.X-Graphics::textwidth((char *)text.c_str()))-2; + break; + } +} + +void Textbox::SetText(std::string text) +{ + this->text = text; + TextPosition(); +} + +std::string Textbox::GetText() +{ + return text; +} + +void Textbox::OnKeyPress(int key, bool shift, bool ctrl, bool alt) +{ + bool changed = false; + try + { + switch(key) + { + case KEY_HOME: + cursor = 0; + break; + case KEY_END: + cursor = text.length(); + break; + case KEY_LEFT: + if(cursor > 0) + cursor--; + break; + case KEY_RIGHT: + if(cursor < text.length()) + cursor++; + break; + case KEY_DELETE: + if(text.length() && cursor < text.length()) + { + if(ctrl) + text.erase(cursor, text.length()-cursor); + else + text.erase(cursor, 1); + changed = true; + } + break; + case KEY_BACKSPACE: + if(text.length() && cursor > 0) + { + if(ctrl) + { + text.erase(0, cursor); + cursor = 0; + } + else + { + text.erase(cursor-1, 1); + cursor--; + } + changed = true; + } + break; + default: + if(key >= ' ' && key < 127) + { + if(cursor == text.length()) + { + text += key; + } + else + { + text.insert(cursor, 1, (char)key); + } + cursor++; + changed = true; + } + } + if(changed && actionCallback) + { + actionCallback->TextChangedCallback(this); + } + } + catch(std::out_of_range e) + { + cursor = 0; + text = ""; + } + TextPosition(); +} + +void Textbox::Draw(const Point& screenPos) +{ + Graphics * g = Engine::Ref().g; + if(IsFocused()) + { + g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255); + g->draw_line(screenPos.X+textPosition.X+cursorPosition, screenPos.Y+3, screenPos.X+textPosition.X+cursorPosition, screenPos.Y+12, 255, 255, 255, XRES+BARSIZE); + } + else + { + g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 160, 160, 160, 255); + } + g->drawtext(screenPos.X+textPosition.X, screenPos.Y+textPosition.Y, text, 255, 255, 255, 255); +} diff --git a/src/interface/Textbox.h b/src/interface/Textbox.h new file mode 100644 index 000000000..5cd14f4d2 --- /dev/null +++ b/src/interface/Textbox.h @@ -0,0 +1,44 @@ +#ifndef TEXTBOX_H +#define TEXTBOX_H + +#include + +#include "Component.h" +#include "Misc.h" + +namespace ui +{ +class Textbox; +class TextboxAction +{ +public: + virtual void TextChangedCallback(ui::Textbox * sender) {} +}; +class Textbox : public Component +{ + std::string text; + ui::Point textPosition; + HorizontalAlignment textHAlign; + VerticalAlignment textVAlign; + int cursor, cursorPosition; + TextboxAction *actionCallback; +public: + Textbox(Window* parent_state, std::string textboxText); + Textbox(Point position, Point size, std::string textboxText); + Textbox(std::string textboxText); + virtual ~Textbox(); + + void TextPosition(); + void SetText(std::string text); + std::string GetText(); + HorizontalAlignment GetHAlignment() { return textHAlign; } + VerticalAlignment GetVAlignment() { return textVAlign; } + void SetAlignment(HorizontalAlignment hAlign, VerticalAlignment vAlign) { textHAlign = hAlign; textVAlign = vAlign; TextPosition(); } + void SetActionCallback(TextboxAction * action) { actionCallback = action; } + virtual void OnKeyPress(int key, bool shift, bool ctrl, bool alt); + + virtual void Draw(const Point& screenPos); +}; +} + +#endif // TEXTBOX_H diff --git a/src/search/SearchController.cpp b/src/search/SearchController.cpp index 90750e01e..11871fd1c 100644 --- a/src/search/SearchController.cpp +++ b/src/search/SearchController.cpp @@ -1,3 +1,4 @@ +#include #include "SearchController.h" #include "SearchModel.h" #include "SearchView.h" @@ -10,8 +11,13 @@ SearchController::SearchController() searchModel->AddObserver(searchView); searchView->AttachController(this); - searchModel->UpdateSaveList(); + searchModel->UpdateSaveList(""); //Set up interface //windowPanel.AddChild(); } + +void SearchController::DoSearch(std::string query) +{ + searchModel->UpdateSaveList(query); +} diff --git a/src/search/SearchController.h b/src/search/SearchController.h index 10dd9bdd5..8676145a0 100644 --- a/src/search/SearchController.h +++ b/src/search/SearchController.h @@ -14,6 +14,7 @@ private: public: SearchController(); SearchView * GetView() { return searchView; } + void DoSearch(std::string query); }; #endif // SEARCHCONTROLLER_H diff --git a/src/search/SearchModel.cpp b/src/search/SearchModel.cpp index 16a99d4ac..96d340a55 100644 --- a/src/search/SearchModel.cpp +++ b/src/search/SearchModel.cpp @@ -7,12 +7,12 @@ SearchModel::SearchModel() { } -void SearchModel::UpdateSaveList() +void SearchModel::UpdateSaveList(std::string query) { lastError = ""; saveList.clear(); notifySaveListChanged(); - saveList = Client::Ref().SearchSaves(0, 12, "", ""); + saveList = Client::Ref().SearchSaves(0, 12, query, ""); if(!saveList.size()) { lastError = Client::Ref().GetLastError(); diff --git a/src/search/SearchModel.h b/src/search/SearchModel.h index e65c15e35..ca6a2932e 100644 --- a/src/search/SearchModel.h +++ b/src/search/SearchModel.h @@ -19,7 +19,7 @@ private: public: SearchModel(); void AddObserver(SearchView * observer); - void UpdateSaveList(); + void UpdateSaveList(std::string query); vector GetSaveList(); string GetLastError() { return lastError; } }; diff --git a/src/search/SearchView.cpp b/src/search/SearchView.cpp index 63a579ede..2ddd76cc0 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 { diff --git a/src/search/SearchView.h b/src/search/SearchView.h index 795fb7479..8777c3039 100644 --- a/src/search/SearchView.h +++ b/src/search/SearchView.h @@ -6,6 +6,7 @@ #include "interface/SaveButton.h" #include "interface/Button.h" #include "interface/Label.h" +#include "interface/Textbox.h" using namespace std; @@ -20,6 +21,8 @@ private: ui::Button * nextButton; ui::Button * previousButton; ui::Label * errorLabel; + ui::Textbox * searchField; + void doSearch(); public: void NotifySaveListChanged(SearchModel * sender); SearchView();