summaryrefslogtreecommitdiffstats
path: root/gui/pages.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2015-03-04 22:39:34 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-03-11 13:21:37 +0100
commit74ac6060ccb68e6ae80dbcb44d11f07a17e26034 (patch)
tree292c86e0888392da8f4a73d97f750e0d732a4dc2 /gui/pages.cpp
parentgui: make scroll bars smaller and transparent (diff)
downloadandroid_bootable_recovery-74ac6060ccb68e6ae80dbcb44d11f07a17e26034.tar
android_bootable_recovery-74ac6060ccb68e6ae80dbcb44d11f07a17e26034.tar.gz
android_bootable_recovery-74ac6060ccb68e6ae80dbcb44d11f07a17e26034.tar.bz2
android_bootable_recovery-74ac6060ccb68e6ae80dbcb44d11f07a17e26034.tar.lz
android_bootable_recovery-74ac6060ccb68e6ae80dbcb44d11f07a17e26034.tar.xz
android_bootable_recovery-74ac6060ccb68e6ae80dbcb44d11f07a17e26034.tar.zst
android_bootable_recovery-74ac6060ccb68e6ae80dbcb44d11f07a17e26034.zip
Diffstat (limited to 'gui/pages.cpp')
-rw-r--r--gui/pages.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 18ddf9c33..cd5e340d6 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -208,8 +208,7 @@ FontResource* LoadAttrFont(xml_node<>* element, const char* attrname)
if (name.empty())
return NULL;
else
- return (FontResource*) PageManager::FindResource(name);
- // TODO: make resource lookup type-safe
+ return PageManager::GetResources()->FindFont(name);
}
ImageResource* LoadAttrImage(xml_node<>* element, const char* attrname)
@@ -218,8 +217,7 @@ ImageResource* LoadAttrImage(xml_node<>* element, const char* attrname)
if (name.empty())
return NULL;
else
- return (ImageResource*) PageManager::FindResource(name);
- // TODO: make resource lookup type-safe
+ return PageManager::GetResources()->FindImage(name);
}
AnimationResource* LoadAttrAnimation(xml_node<>* element, const char* attrname)
@@ -228,8 +226,7 @@ AnimationResource* LoadAttrAnimation(xml_node<>* element, const char* attrname)
if (name.empty())
return NULL;
else
- return (AnimationResource*) PageManager::FindResource(name);
- // TODO: make resource lookup type-safe
+ return PageManager::GetResources()->FindAnimation(name);
}
bool LoadPlacement(xml_node<>* node, int* x, int* y, int* w /* = NULL */, int* h /* = NULL */, RenderObject::Placement* placement /* = NULL */)
@@ -649,7 +646,7 @@ int Page::NotifyVarChange(std::string varName, std::string value)
PageSet::PageSet(char* xmlFile)
{
- mResources = NULL;
+ mResources = new ResourceManager;
mCurrentPage = NULL;
mOverlayPage = NULL;
@@ -742,7 +739,7 @@ int PageSet::Load(ZipArchive* package)
LOGINFO("Loading resources...\n");
child = parent->first_node("resources");
if (child)
- mResources = new ResourceManager(child, package);
+ mResources->LoadResources(child, package);
LOGINFO("Loading variables...\n");
child = parent->first_node("variables");
@@ -937,9 +934,9 @@ int PageSet::SetOverlay(Page* page)
return 0;
}
-Resource* PageSet::FindResource(std::string name)
+const ResourceManager* PageSet::GetResources()
{
- return mResources ? mResources->FindResource(name) : NULL;
+ return mResources;
}
Page* PageSet::FindPage(std::string name)
@@ -1307,17 +1304,9 @@ int PageManager::ChangeOverlay(std::string name)
}
}
-Resource* PageManager::FindResource(std::string name)
+const ResourceManager* PageManager::GetResources()
{
- return (mCurrentSet ? mCurrentSet->FindResource(name) : NULL);
-}
-
-Resource* PageManager::FindResource(std::string package, std::string name)
-{
- PageSet* tmp;
-
- tmp = FindPackage(name);
- return (tmp ? tmp->FindResource(name) : NULL);
+ return (mCurrentSet ? mCurrentSet->GetResources() : NULL);
}
int PageManager::SwitchToConsole(void)