Maelstrom: Added a macro to remove the stuff adding type safety to the classes, so it's easier to look at the classes and see what's...

https://github.com/libsdl-org/Maelstrom/commit/3984ad01acaab0f7a0f52b954d7846cb12ba0bcd

From 3984ad01acaab0f7a0f52b954d7846cb12ba0bcd Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 29 Oct 2011 21:05:07 -0400
Subject: [PATCH] Added a macro to remove the stuff adding type safety to the
 classes, so it's easier to look at the classes and see what's going on.

---
 MacDialog.h                   | 16 +---------------
 MacDialogButton.h             | 16 +---------------
 MacDialogCheckbox.h           | 16 +---------------
 MacDialogLabel.h              | 16 +---------------
 MacDialogRadioButton.h        | 16 +---------------
 UIElementIcon.h               | 16 +---------------
 UIElementKeyButton.cpp        |  4 ----
 UIElementKeyButton.h          | 17 +----------------
 UIElementSprite.h             | 16 +---------------
 UIElementTitle.h              | 16 +---------------
 screenlib/UIBaseElement.h     | 17 +++++++++++++++++
 screenlib/UIDialog.h          | 16 +---------------
 screenlib/UIDialogButton.h    | 16 +---------------
 screenlib/UIElement.h         | 20 +-------------------
 screenlib/UIElementButton.h   | 16 +---------------
 screenlib/UIElementCheckbox.h | 16 +---------------
 screenlib/UIElementLabel.h    | 16 +---------------
 screenlib/UIElementLine.h     | 16 +---------------
 screenlib/UIElementRadio.h    | 32 ++------------------------------
 screenlib/UIElementRect.h     | 16 +---------------
 screenlib/UIElementTexture.h  | 16 +---------------
 screenlib/UIPanel.cpp         |  2 ++
 screenlib/UIPanel.h           |  1 +
 23 files changed, 40 insertions(+), 309 deletions(-)

diff --git a/MacDialog.h b/MacDialog.h
index aab4ffbe..4ce3f600 100644
--- a/MacDialog.h
+++ b/MacDialog.h
@@ -6,13 +6,10 @@
 
 class MacDialog : public UIDialog
 {
+DECLARE_TYPESAFE_CLASS(UIDialog)
 public:
 	MacDialog(UIManager *ui, const char *name);
 
-	virtual bool IsA(UIElementType type) {
-		return UIDialog::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	virtual void Show();
@@ -30,17 +27,6 @@ class MacDialog : public UIDialog
 	Uint32 m_colors[NUM_COLORS];
 	bool m_expand;
 	int m_step;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _MacDialog_h
diff --git a/MacDialogButton.h b/MacDialogButton.h
index 5f235d67..b28464d3 100644
--- a/MacDialogButton.h
+++ b/MacDialogButton.h
@@ -6,13 +6,10 @@
 
 class MacDialogButton : public UIDialogButton
 {
+DECLARE_TYPESAFE_CLASS(UIDialogButton)
 public:
 	MacDialogButton(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIDialogButton::IsA(type) || type == GetType();
-	}
-
 	virtual void Draw();
 
 	virtual void OnMouseDown();
@@ -23,17 +20,6 @@ class MacDialogButton : public UIDialogButton
 
 protected:
 	void SetElementColor(Uint32 color);
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _MacDialogButton_h
diff --git a/MacDialogCheckbox.h b/MacDialogCheckbox.h
index 34e4a712..b2e96a27 100644
--- a/MacDialogCheckbox.h
+++ b/MacDialogCheckbox.h
@@ -6,30 +6,16 @@
 
 class MacDialogCheckbox : public UIElementCheckbox
 {
+DECLARE_TYPESAFE_CLASS(UIElementCheckbox)
 public:
 	MacDialogCheckbox(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementCheckbox::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	virtual void Draw();
 
 protected:
 	Uint32 m_color;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _MacDialogCheckbox_h
diff --git a/MacDialogLabel.h b/MacDialogLabel.h
index 9c737415..d279f915 100644
--- a/MacDialogLabel.h
+++ b/MacDialogLabel.h
@@ -5,23 +5,9 @@
 
 class MacDialogLabel : public UIElementLabel
 {
+DECLARE_TYPESAFE_CLASS(UIElementLabel)
 public:
 	MacDialogLabel(UIBaseElement *parent, const char *name = "");
-
-	virtual bool IsA(UIElementType type) {
-		return UIElementLabel::IsA(type) || type == GetType();
-	}
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _MacDialogLabel_h
diff --git a/MacDialogRadioButton.h b/MacDialogRadioButton.h
index 2076ba8a..1dd13b5d 100644
--- a/MacDialogRadioButton.h
+++ b/MacDialogRadioButton.h
@@ -6,30 +6,16 @@
 
 class MacDialogRadioButton : public UIElementRadioButton
 {
+DECLARE_TYPESAFE_CLASS(UIElementRadioButton)
 public:
 	MacDialogRadioButton(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementRadioButton::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	virtual void Draw();
 
 protected:
 	Uint32 m_color;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _MacDialogRadioButton_h
diff --git a/UIElementIcon.h b/UIElementIcon.h
index 44bc34c3..bbdee3ca 100644
--- a/UIElementIcon.h
+++ b/UIElementIcon.h
@@ -6,25 +6,11 @@
 
 class UIElementIcon : public UIElementTexture
 {
+DECLARE_TYPESAFE_CLASS(UIElementTexture)
 public:
 	UIElementIcon(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementTexture::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementIcon_h
diff --git a/UIElementKeyButton.cpp b/UIElementKeyButton.cpp
index 41fbb4ba..62fef86d 100644
--- a/UIElementKeyButton.cpp
+++ b/UIElementKeyButton.cpp
@@ -9,10 +9,6 @@ UIElementKeyButton::UIElementKeyButton(UIBaseElement *parent, const char *name)
 {
 }
 
-UIElementKeyButton::~UIElementKeyButton()
-{
-}
-
 bool
 UIElementKeyButton::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
 {
diff --git a/UIElementKeyButton.h b/UIElementKeyButton.h
index 2fb41018..bafb8970 100644
--- a/UIElementKeyButton.h
+++ b/UIElementKeyButton.h
@@ -6,26 +6,11 @@
 
 class UIElementKeyButton : public UIElementButton
 {
+DECLARE_TYPESAFE_CLASS(UIElementButton)
 public:
 	UIElementKeyButton(UIBaseElement *parent, const char *name = "");
-	virtual ~UIElementKeyButton();
-
-	virtual bool IsA(UIElementType type) {
-		return UIElementButton::IsA(type) || type == GetType();
-	}
 
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementKeyButton_h
diff --git a/UIElementSprite.h b/UIElementSprite.h
index f158c05d..55649043 100644
--- a/UIElementSprite.h
+++ b/UIElementSprite.h
@@ -6,25 +6,11 @@
 
 class UIElementSprite : public UIElementTexture
 {
+DECLARE_TYPESAFE_CLASS(UIElementTexture)
 public:
 	UIElementSprite(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementTexture::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementSprite_h
diff --git a/UIElementTitle.h b/UIElementTitle.h
index 7cb95e7f..cb611238 100644
--- a/UIElementTitle.h
+++ b/UIElementTitle.h
@@ -6,25 +6,11 @@
 
 class UIElementTitle : public UIElementTexture
 {
+DECLARE_TYPESAFE_CLASS(UIElementTexture)
 public:
 	UIElementTitle(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementTexture::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementTitle_h
diff --git a/screenlib/UIBaseElement.h b/screenlib/UIBaseElement.h
index 4ba769d7..c4c3cefd 100644
--- a/screenlib/UIBaseElement.h
+++ b/screenlib/UIBaseElement.h
@@ -109,4 +109,21 @@ class UIBaseElement : public UIArea
 	}
 };
 
+/////////////////////////////////////////////////////////////////////////
+#define DECLARE_TYPESAFE_CLASS(BASECLASS)				\
+protected:								\
+	static UIElementType s_elementType;				\
+									\
+public:									\
+	static UIElementType GetType() {				\
+		if (!s_elementType) {					\
+			s_elementType = GenerateType();			\
+		}							\
+		return s_elementType;					\
+	}								\
+	virtual bool IsA(UIElementType type) {				\
+		return BASECLASS::IsA(type) || type == GetType();	\
+	}
+/////////////////////////////////////////////////////////////////////////
+
 #endif // _UIBaseElement_h
diff --git a/screenlib/UIDialog.h b/screenlib/UIDialog.h
index 9e8d60eb..f61b9f0c 100644
--- a/screenlib/UIDialog.h
+++ b/screenlib/UIDialog.h
@@ -39,13 +39,10 @@ typedef void (*UIDialogDoneHandler)(UIDialog *dialog, int status);
 
 class UIDialog : public UIPanel
 {
+DECLARE_TYPESAFE_CLASS(UIPanel)
 public:
 	UIDialog(UIManager *ui, const char *name);
 
-	virtual bool IsA(UIElementType type) {
-		return UIPanel::IsA(type) || type == GetType();
-	}
-
 	/* Set a function that's called when the dialog is hidden */
 	void SetDialogHandlers(UIDialogInitHandler handleInit,
 				UIDialogDoneHandler handleDone) {
@@ -67,17 +64,6 @@ class UIDialog : public UIPanel
 	int m_status;
 	UIDialogInitHandler m_handleInit;
 	UIDialogDoneHandler m_handleDone;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 //
diff --git a/screenlib/UIDialogButton.h b/screenlib/UIDialogButton.h
index d6f82831..75f12a48 100644
--- a/screenlib/UIDialogButton.h
+++ b/screenlib/UIDialogButton.h
@@ -28,13 +28,10 @@
 
 class UIDialogButton : public UIElementButton
 {
+DECLARE_TYPESAFE_CLASS(UIElementButton)
 public:
 	UIDialogButton(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementButton::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	virtual void OnClick();
@@ -43,17 +40,6 @@ class UIDialogButton : public UIElementButton
 	int m_statusID;
 	bool m_default;
 	bool m_closeDialog;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIDialogButton_h
diff --git a/screenlib/UIElement.h b/screenlib/UIElement.h
index 8a6d2b49..b699b082 100644
--- a/screenlib/UIElement.h
+++ b/screenlib/UIElement.h
@@ -25,32 +25,14 @@
 
 #include "UIBaseElement.h"
 
-class UIPanel;
-class UIManager;
 
 class UIElement : public UIBaseElement
 {
+DECLARE_TYPESAFE_CLASS(UIBaseElement)
 public:
 	UIElement(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIBaseElement::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
-Uint32 LoadColor(rapidxml::xml_node<> *node);
-
 #endif // _UIElement_h
diff --git a/screenlib/UIElementButton.h b/screenlib/UIElementButton.h
index f0c9db48..ed28dbb6 100644
--- a/screenlib/UIElementButton.h
+++ b/screenlib/UIElementButton.h
@@ -33,14 +33,11 @@ class UIButtonDelegate
 
 class UIElementButton : public UIElement
 {
+DECLARE_TYPESAFE_CLASS(UIElement)
 public:
 	UIElementButton(UIBaseElement *parent, const char *name = "");
 	virtual ~UIElementButton();
 
-	virtual bool IsA(UIElementType type) {
-		return UIElement::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	virtual bool HandleEvent(const SDL_Event &event);
@@ -68,17 +65,6 @@ class UIElementButton : public UIElement
 
 protected:
 	bool ShouldHandleKey(SDL_Keycode key);
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementButton_h
diff --git a/screenlib/UIElementCheckbox.h b/screenlib/UIElementCheckbox.h
index eaf994ee..88da9e21 100644
--- a/screenlib/UIElementCheckbox.h
+++ b/screenlib/UIElementCheckbox.h
@@ -6,13 +6,10 @@
 
 class UIElementCheckbox : public UIElementButton
 {
+DECLARE_TYPESAFE_CLASS(UIElementButton)
 public:
 	UIElementCheckbox(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementButton::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	void SetChecked(bool checked) {
@@ -30,17 +27,6 @@ class UIElementCheckbox : public UIElementButton
 
 protected:
 	bool m_checked;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementCheckbox_h
diff --git a/screenlib/UIElementLabel.h b/screenlib/UIElementLabel.h
index 8e7f1472..af150499 100644
--- a/screenlib/UIElementLabel.h
+++ b/screenlib/UIElementLabel.h
@@ -29,14 +29,11 @@
 
 class UIElementLabel : public UIElement
 {
+DECLARE_TYPESAFE_CLASS(UIElement)
 public:
 	UIElementLabel(UIBaseElement *parent, const char *name = "");
 	virtual ~UIElementLabel();
 
-	virtual bool IsA(UIElementType type) {
-		return UIElement::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	void SetText(const char *text);
@@ -52,17 +49,6 @@ class UIElementLabel : public UIElement
 	Uint32 m_color;
 	char *m_text;
 	SDL_Texture *m_texture;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementLabel_h
diff --git a/screenlib/UIElementLine.h b/screenlib/UIElementLine.h
index dd5ecb4d..00547058 100644
--- a/screenlib/UIElementLine.h
+++ b/screenlib/UIElementLine.h
@@ -28,13 +28,10 @@
 
 class UIElementLine : public UIElement
 {
+DECLARE_TYPESAFE_CLASS(UIElement)
 public:
 	UIElementLine(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElement::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	void SetColor(Uint32 color) {
@@ -45,17 +42,6 @@ class UIElementLine : public UIElement
 
 private:
 	Uint32 m_color;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementLine_h
diff --git a/screenlib/UIElementRadio.h b/screenlib/UIElementRadio.h
index 08eb29b0..38f0448d 100644
--- a/screenlib/UIElementRadio.h
+++ b/screenlib/UIElementRadio.h
@@ -38,13 +38,10 @@ class UIElementRadioButton;
 
 class UIElementRadioGroup : public UIElement
 {
+DECLARE_TYPESAFE_CLASS(UIElement)
 public:
 	UIElementRadioGroup(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElement::IsA(type) || type == GetType();
-	}
-
 	UIElementRadioButton *GetRadioButton(int id);
 
 	void RadioButtonChecked(UIElementRadioButton *button);
@@ -55,28 +52,14 @@ class UIElementRadioGroup : public UIElement
 
 protected:
 	int m_value;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 class UIElementRadioButton : public UIElementCheckbox
 {
+DECLARE_TYPESAFE_CLASS(UIElementCheckbox)
 public:
 	UIElementRadioButton(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElementCheckbox::IsA(type) || type == GetType();
-	}
-
 	int GetID() const {
 		return m_id;
 	}
@@ -87,17 +70,6 @@ class UIElementRadioButton : public UIElementCheckbox
 
 protected:
 	int m_id;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementRadio_h
diff --git a/screenlib/UIElementRect.h b/screenlib/UIElementRect.h
index 9cf54b02..a024431b 100644
--- a/screenlib/UIElementRect.h
+++ b/screenlib/UIElementRect.h
@@ -28,13 +28,10 @@
 
 class UIElementRect : public UIElement
 {
+DECLARE_TYPESAFE_CLASS(UIElement)
 public:
 	UIElementRect(UIBaseElement *parent, const char *name = "");
 
-	virtual bool IsA(UIElementType type) {
-		return UIElement::IsA(type) || type == GetType();
-	}
-
 	virtual bool Load(rapidxml::xml_node<> *node, const UITemplates *templates);
 
 	void SetColor(Uint32 color) {
@@ -46,17 +43,6 @@ class UIElementRect : public UIElement
 protected:
 	bool m_fill;
 	Uint32 m_color;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementRect_h
diff --git a/screenlib/UIElementTexture.h b/screenlib/UIElementTexture.h
index d89e0cdc..f1c0a9bb 100644
--- a/screenlib/UIElementTexture.h
+++ b/screenlib/UIElementTexture.h
@@ -28,31 +28,17 @@
 
 class UIElementTexture : public UIElement
 {
+DECLARE_TYPESAFE_CLASS(UIElement)
 public:
 	UIElementTexture(UIBaseElement *parent, const char *name = "");
 	virtual ~UIElementTexture();
 
-	virtual bool IsA(UIElementType type) {
-		return UIElement::IsA(type) || type == GetType();
-	}
-
 	void SetTexture(SDL_Texture *texture);
 
 	virtual void Draw();
 
 private:
 	SDL_Texture *m_texture;
-
-protected:
-	static UIElementType s_elementType;
-
-public:
-	static UIElementType GetType() {
-		if (!s_elementType) {
-			s_elementType = GenerateType();
-		}
-		return s_elementType;
-	}
 };
 
 #endif // _UIElementTexture_h
diff --git a/screenlib/UIPanel.cpp b/screenlib/UIPanel.cpp
index fca8e1df..5f914fa1 100644
--- a/screenlib/UIPanel.cpp
+++ b/screenlib/UIPanel.cpp
@@ -26,6 +26,8 @@
 #include "UIElement.h"
 #include "UITemplates.h"
 
+UIElementType UIPanel::s_elementType;
+
 
 UIPanel::UIPanel(UIManager *ui, const char *name) :
 	UIBaseElement(ui, name)
diff --git a/screenlib/UIPanel.h b/screenlib/UIPanel.h
index d4cbb7ed..b1c7dfcd 100644
--- a/screenlib/UIPanel.h
+++ b/screenlib/UIPanel.h
@@ -52,6 +52,7 @@ class UIPanelDelegate
 
 class UIPanel : public UIBaseElement
 {
+DECLARE_TYPESAFE_CLASS(UIBaseElement)
 public:
 	UIPanel(UIManager *ui, const char *name);
 	virtual ~UIPanel();