gui: make resources type safe
- add string, int, color and resource loading helpers
- use typed resource classes, and some cleanup in loading code
- remove abstract GetResource() to enforce type safe access
- add height and width query methods to resources and use them
- minor cleanup
- simplify LoadPlacement
Change-Id: I9b81785109a80b3806ad6b50cba4d893b87b0db1
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
index db968ae..5528be9 100644
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -102,7 +102,7 @@
strcpy(resource, "resource1");
attr = child->first_attribute(resource);
while (attr && layoutindex < (MAX_KEYBOARD_LAYOUTS + 1)) {
- keyboardImg[layoutindex - 1] = PageManager::FindResource(attr->value());
+ keyboardImg[layoutindex - 1] = LoadAttrImage(child, resource);
layoutindex++;
resource[8] = (char)(layoutindex + 48);
@@ -113,8 +113,8 @@
// Check the first image to get height and width
if (keyboardImg[0] && keyboardImg[0]->GetResource())
{
- KeyboardWidth = gr_get_width(keyboardImg[0]->GetResource());
- KeyboardHeight = gr_get_height(keyboardImg[0]->GetResource());
+ KeyboardWidth = keyboardImg[0]->GetWidth();
+ KeyboardHeight = keyboardImg[0]->GetHeight();
}
// Load all of the layout maps