From 2b8cbd41fb84b380ea48135d4e641165d6e58124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=C2=ADn=20Lucas=20Golini?= Date: Sat, 16 Dec 2017 22:28:04 -0300 Subject: [PATCH] WidgetCallback fix. --HG-- branch : dev --- include/eepp/ui/uiwidgetcreator.hpp | 4 ++++ src/eepp/ui/uicontrol.cpp | 2 +- src/eepp/ui/uiwidgetcreator.cpp | 8 +++----- src/eepp/ui/uiwindow.cpp | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/eepp/ui/uiwidgetcreator.hpp b/include/eepp/ui/uiwidgetcreator.hpp index 4764a53be..628b18968 100644 --- a/include/eepp/ui/uiwidgetcreator.hpp +++ b/include/eepp/ui/uiwidgetcreator.hpp @@ -17,6 +17,10 @@ class EE_API UIWidgetCreator { static void removeCustomWidgetCallback( std::string widgetName ); static bool existsCustomWidgetCallback( std::string widgetName ); + protected: + typedef std::map WidgetCallbackMap; + + static WidgetCallbackMap widgetCallback; }; }} diff --git a/src/eepp/ui/uicontrol.cpp b/src/eepp/ui/uicontrol.cpp index 416ba3312..0c56005fc 100644 --- a/src/eepp/ui/uicontrol.cpp +++ b/src/eepp/ui/uicontrol.cpp @@ -1665,7 +1665,7 @@ void UIControl::setReverseDraw( bool reverseDraw ) { void UIControl::invalidateDraw() { if ( NULL != mParentWindowCtrl ) { mParentWindowCtrl->invalidate(); - } else if ( NULL == mParentCtrl && isWindow() ) { + } else if ( NULL == mParentCtrl && isWindow() ) { static_cast( this )->invalidate(); } } diff --git a/src/eepp/ui/uiwidgetcreator.cpp b/src/eepp/ui/uiwidgetcreator.cpp index 13d0350e6..456287f21 100644 --- a/src/eepp/ui/uiwidgetcreator.cpp +++ b/src/eepp/ui/uiwidgetcreator.cpp @@ -32,16 +32,14 @@ namespace EE { namespace UI { -typedef std::map widgetCallbackMap; - -static widgetCallbackMap widgetCallback; +UIWidgetCreator::WidgetCallbackMap UIWidgetCreator::widgetCallback = UIWidgetCreator::WidgetCallbackMap(); UIWidget * UIWidgetCreator::createFromName( std::string widgetName ) { String::toLowerInPlace( widgetName ); if ( widgetName == "widget" ) return UIWidget::New(); - else if ( widgetName == "horizontallinearlayout" || widgetName == "hll" ) return UILinearLayout::NewHorizontal(); - else if ( widgetName == "linearlayout" || widgetName == "verticallinearlayout" || widgetName == "vll" ) return UILinearLayout::NewVertical(); + else if ( widgetName == "horizontallinearlayout" || widgetName == "hll" || widgetName == "hbox" ) return UILinearLayout::NewHorizontal(); + else if ( widgetName == "linearlayout" || widgetName == "verticallinearlayout" || widgetName == "vll" || widgetName == "vbox" ) return UILinearLayout::NewVertical(); else if ( widgetName == "relativelayout" ) return UIRelativeLayout::New(); else if ( widgetName == "textview" ) return UITextView::New(); else if ( widgetName == "pushbutton" ) return UIPushButton::New(); diff --git a/src/eepp/ui/uiwindow.cpp b/src/eepp/ui/uiwindow.cpp index ca01aa787..c4268159a 100644 --- a/src/eepp/ui/uiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -1127,7 +1127,7 @@ void UIWindow::internalDraw() { matrixSet(); - if ( !ownsFrameBuffer() || !UIManager::instance()->usesInvalidation() || ( mControlFlags & UI_CTRL_FLAG_NEEDS_REDRAW ) ) { + if ( !ownsFrameBuffer() || !UIManager::instance()->usesInvalidation() || invalidated() ) { clipMe(); draw(); @@ -1170,7 +1170,7 @@ bool UIWindow::invalidated() { void UIWindow::matrixSet() { if ( ownsFrameBuffer() ) { if ( NULL != mFrameBuffer ) { - if ( !UIManager::instance()->usesInvalidation() || ( mControlFlags & UI_CTRL_FLAG_NEEDS_REDRAW ) ) { + if ( !UIManager::instance()->usesInvalidation() || invalidated() ) { mFrameBufferBound = true; mFrameBuffer->bind();