diff --git a/cocos/ui/Android.mk b/cocos/ui/Android.mk index 868b2a9dd1..e486177a16 100644 --- a/cocos/ui/Android.mk +++ b/cocos/ui/Android.mk @@ -29,7 +29,8 @@ CCProtectedNode.cpp \ UIHBox.cpp \ UIVBox.cpp \ UIRelativeBox.cpp \ -UIVideoPlayerAndroid.cpp +UIVideoPlayerAndroid.cpp \ +UIFocusManager.cpp LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \ $(LOCAL_PATH)/../editor-support diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt index fd92084a94..73078a4b50 100644 --- a/cocos/ui/CMakeLists.txt +++ b/cocos/ui/CMakeLists.txt @@ -22,5 +22,6 @@ set(COCOS_UI_SRC ui/UITextField.cpp ui/UIVBox.cpp ui/UIWidget.cpp + ui/UIFocusManager.cpp ) diff --git a/cocos/ui/UIFocusManager.h b/cocos/ui/UIFocusManager.h index 487fe62e26..6953e69e0e 100644 --- a/cocos/ui/UIFocusManager.h +++ b/cocos/ui/UIFocusManager.h @@ -46,20 +46,24 @@ namespace ui { void enableAndroidDpad(bool flag); void setFirstFocsuedWidget(Widget* widget); - std::function onKeypadReleased = nullptr; + std::function onKeypadReleased; protected: void onKeypadKeyPressed(EventKeyboard::KeyCode, Event*); private: - FocusManager(){} + FocusManager():_keyboardListener(nullptr), + _firstFocusedWidget(nullptr), + _enableAndroidDpad(false), + onKeypadReleased(nullptr) + {} ~FocusManager(); static FocusManager* _instance; - EventListenerKeyboard* _keyboardListener = nullptr; - Widget* _firstFocusedWidget = nullptr; - bool _enableAndroidDpad = false; + EventListenerKeyboard* _keyboardListener ; + Widget* _firstFocusedWidget ; + bool _enableAndroidDpad ; }; } diff --git a/cocos/ui/proj.win32/libGUI.vcxproj b/cocos/ui/proj.win32/libGUI.vcxproj index ee4ba81fb8..8791070dc3 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj +++ b/cocos/ui/proj.win32/libGUI.vcxproj @@ -15,6 +15,7 @@ + @@ -41,6 +42,7 @@ + diff --git a/cocos/ui/proj.win32/libGUI.vcxproj.filters b/cocos/ui/proj.win32/libGUI.vcxproj.filters index 28a105b739..9ab9ce55bb 100644 --- a/cocos/ui/proj.win32/libGUI.vcxproj.filters +++ b/cocos/ui/proj.win32/libGUI.vcxproj.filters @@ -90,6 +90,9 @@ Layouts + + BaseClasses + @@ -161,5 +164,8 @@ Layouts + + BaseClasses + \ No newline at end of file