Conditional -> GUIObject and make all gui objects children of GUIObject
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
Change-Id: Ic0a7d6354dabe5919b83942f2f1aa0715625e522
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index 626cbac..99e2ded 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -51,7 +51,7 @@
#define SCROLLING_FLOOR 10
#define SCROLLING_MULTIPLIER 6
-GUIListBox::GUIListBox(xml_node<>* node)
+GUIListBox::GUIListBox(xml_node<>* node) : GUIObject(node)
{
xml_attribute<>* attr;
xml_node<>* child;
@@ -352,6 +352,9 @@
int GUIListBox::Render(void)
{
+ if(!isConditionTrue())
+ return 0;
+
// First step, fill background
gr_color(mBackgroundColor.red, mBackgroundColor.green, mBackgroundColor.blue, 255);
gr_fill(mRenderX, mRenderY + mHeaderH, mRenderW, mRenderH - mHeaderH);
@@ -522,6 +525,9 @@
int GUIListBox::Update(void)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {
@@ -602,6 +608,9 @@
int GUIListBox::NotifyTouch(TOUCH_STATE state, int x, int y)
{
+ if(!isConditionTrue())
+ return -1;
+
static int lastY = 0, last2Y = 0, fastScroll = 0;
int selection = 0;
@@ -753,6 +762,9 @@
int GUIListBox::NotifyVarChange(std::string varName, std::string value)
{
+ if(!isConditionTrue())
+ return 0;
+
if (!mHeaderIsStatic) {
std::string newValue = gui_parse_text(mHeaderText);
if (mLastValue != newValue) {