diff options
Diffstat (limited to 'gui/pages.cpp')
-rw-r--r-- | gui/pages.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp index d662f18f8..dc9edc798 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -54,6 +54,7 @@ extern blanktimer blankTimer; std::map<std::string, PageSet*> PageManager::mPageSets; PageSet* PageManager::mCurrentSet; PageSet* PageManager::mBaseSet = NULL; +MouseCursor *PageManager::mMouseCursor = NULL; // Helper routine to convert a string to a color declaration int ConvertStrToColor(std::string str, COLOR* color) @@ -550,6 +551,11 @@ int PageSet::Load(ZipArchive* package) if (child) LoadVariables(child); + LOGINFO("Loading mouse cursor...\n"); + child = parent->first_node("mousecursor"); + if(child) + PageManager::LoadCursorData(child); + LOGINFO("Loading pages...\n"); // This may be NULL if no templates are present templates = parent->first_node("templates"); @@ -849,6 +855,9 @@ int PageManager::ReloadPackage(std::string name, std::string package) if (iter == mPageSets.end()) return -1; + if(mMouseCursor) + mMouseCursor->ResetData(gr_fb_width(), gr_fb_height()); + PageSet* set = (*iter).second; mPageSets.erase(iter); @@ -924,7 +933,25 @@ int PageManager::IsCurrentPage(Page* page) int PageManager::Render(void) { - return (mCurrentSet ? mCurrentSet->Render() : -1); + int res = (mCurrentSet ? mCurrentSet->Render() : -1); + if(mMouseCursor) + mMouseCursor->Render(); + return res; +} + +MouseCursor *PageManager::GetMouseCursor() +{ + if(!mMouseCursor) + mMouseCursor = new MouseCursor(gr_fb_width(), gr_fb_height()); + return mMouseCursor; +} + +void PageManager::LoadCursorData(xml_node<>* node) +{ + if(!mMouseCursor) + mMouseCursor = new MouseCursor(gr_fb_width(), gr_fb_height()); + + mMouseCursor->LoadData(node); } int PageManager::Update(void) @@ -933,7 +960,16 @@ int PageManager::Update(void) if(blankTimer.IsScreenOff()) return 0; #endif - return (mCurrentSet ? mCurrentSet->Update() : -1); + + int res = (mCurrentSet ? mCurrentSet->Update() : -1); + + if(mMouseCursor) + { + int c_res = mMouseCursor->Update(); + if(c_res > res) + res = c_res; + } + return res; } int PageManager::NotifyTouch(TOUCH_STATE state, int x, int y) |