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/button.cpp b/gui/button.cpp
index 943d719..6ea0bee 100644
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -98,9 +98,7 @@
 	child = node->first_node("icon");
 	if (child)
 	{
-		attr = child->first_attribute("resource");
-		if (attr)
-			mButtonIcon = PageManager::FindResource(attr->value());
+		mButtonIcon = LoadAttrImage(child, "resource");
 	}
 
 	memset(&mHighlightColor, 0, sizeof(COLOR));
@@ -122,14 +120,13 @@
 		LoadPlacement(node->first_node("placement"), &x, &y, &w, &h, &TextPlacement);
 	}
 	SetRenderPos(x, y, w, h);
-	return;
 }
 
 GUIButton::~GUIButton()
 {
-	if (mButtonImg)	 	delete mButtonImg;
-	if (mButtonLabel)   delete mButtonLabel;
-	if (mAction)		delete mAction;
+	delete mButtonImg;
+	delete mButtonLabel;
+	delete mAction;
 }
 
 int GUIButton::Render(void)
@@ -221,12 +218,8 @@
 		mRenderH = h;
 	}
 
-	mIconW = 0;	 mIconH = 0;
-	if (mButtonIcon && mButtonIcon->GetResource())
-	{
-		mIconW = gr_get_width(mButtonIcon->GetResource());
-		mIconH = gr_get_height(mButtonIcon->GetResource());
-	}
+	mIconW = mButtonIcon->GetWidth();
+	mIconH = mButtonIcon->GetHeight();
 
 	mTextH = 0;
 	mTextW = 0;