mirror of https://github.com/axmolengine/axmol.git
issue #5057. add UIDeprecated.h and refactor FocusDirection to inner class of
Widget and also simplify the enum value
This commit is contained in:
parent
9f0e25d808
commit
0c2fd977ea
|
@ -2287,6 +2287,7 @@
|
||||||
2905FA1218CF08D100240AA3 /* UITextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITextField.h; sourceTree = "<group>"; };
|
2905FA1218CF08D100240AA3 /* UITextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UITextField.h; sourceTree = "<group>"; };
|
||||||
2905FA1318CF08D100240AA3 /* UIWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidget.cpp; sourceTree = "<group>"; };
|
2905FA1318CF08D100240AA3 /* UIWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidget.cpp; sourceTree = "<group>"; };
|
||||||
2905FA1418CF08D100240AA3 /* UIWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidget.h; sourceTree = "<group>"; };
|
2905FA1418CF08D100240AA3 /* UIWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidget.h; sourceTree = "<group>"; };
|
||||||
|
29080DEB191B82CE0066F8DF /* UIDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeprecated.h; sourceTree = "<group>"; };
|
||||||
296CAD201915EC8000C64FBF /* CCEventFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventFocus.cpp; path = ../base/CCEventFocus.cpp; sourceTree = "<group>"; };
|
296CAD201915EC8000C64FBF /* CCEventFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventFocus.cpp; path = ../base/CCEventFocus.cpp; sourceTree = "<group>"; };
|
||||||
296CAD211915EC8000C64FBF /* CCEventFocus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCEventFocus.h; path = ../base/CCEventFocus.h; sourceTree = "<group>"; };
|
296CAD211915EC8000C64FBF /* CCEventFocus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCEventFocus.h; path = ../base/CCEventFocus.h; sourceTree = "<group>"; };
|
||||||
296CAD261915EC9900C64FBF /* CCEventListenerFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventListenerFocus.cpp; path = ../base/CCEventListenerFocus.cpp; sourceTree = "<group>"; };
|
296CAD261915EC9900C64FBF /* CCEventListenerFocus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCEventListenerFocus.cpp; path = ../base/CCEventListenerFocus.cpp; sourceTree = "<group>"; };
|
||||||
|
@ -4021,6 +4022,7 @@
|
||||||
50E6D33118E174130051CA34 /* UIRelativeBox.h */,
|
50E6D33118E174130051CA34 /* UIRelativeBox.h */,
|
||||||
50E6D33218E174130051CA34 /* UIVBox.cpp */,
|
50E6D33218E174130051CA34 /* UIVBox.cpp */,
|
||||||
50E6D33318E174130051CA34 /* UIVBox.h */,
|
50E6D33318E174130051CA34 /* UIVBox.h */,
|
||||||
|
29080DEB191B82CE0066F8DF /* UIDeprecated.h */,
|
||||||
);
|
);
|
||||||
name = ui;
|
name = ui;
|
||||||
path = ../cocos/ui;
|
path = ../cocos/ui;
|
||||||
|
|
|
@ -45,6 +45,7 @@ THE SOFTWARE.
|
||||||
#include "ui/UIHBox.h"
|
#include "ui/UIHBox.h"
|
||||||
#include "ui/UIVBox.h"
|
#include "ui/UIVBox.h"
|
||||||
#include "ui/UIRelativeBox.h"
|
#include "ui/UIRelativeBox.h"
|
||||||
|
#include "ui/UIDeprecated.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// UIDeprecated.h
|
||||||
|
// cocos2d_libs
|
||||||
|
//
|
||||||
|
// Created by guanghui on 5/8/14.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef cocos2d_libs_UIDeprecated_h
|
||||||
|
#define cocos2d_libs_UIDeprecated_h
|
||||||
|
|
||||||
|
#include "base/CCPlatformMacros.h"
|
||||||
|
#include "UIWidget.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
|
#endif
|
|
@ -1675,7 +1675,7 @@ int Layout::findNearestChildWidgetIndex(FocusDirection direction, Widget* baseWi
|
||||||
|
|
||||||
float distance = FLT_MAX;
|
float distance = FLT_MAX;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
if (direction == FocusDirection::FocusDirection_Left || direction == FocusDirection::FocusDirection_Right)
|
if (direction == FocusDirection::LEFT || direction == FocusDirection::RIGHT)
|
||||||
{
|
{
|
||||||
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
||||||
while (index < count)
|
while (index < count)
|
||||||
|
@ -1709,7 +1709,7 @@ int Layout::findNearestChildWidgetIndex(FocusDirection direction, Widget* baseWi
|
||||||
index = 0;
|
index = 0;
|
||||||
found = 0;
|
found = 0;
|
||||||
distance = FLT_MAX;
|
distance = FLT_MAX;
|
||||||
if (direction == FocusDirection::FocusDirection_Down || direction == FocusDirection::FocusDirection_Up) {
|
if (direction == FocusDirection::DOWN || direction == FocusDirection::UP) {
|
||||||
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
||||||
while (index < count)
|
while (index < count)
|
||||||
{
|
{
|
||||||
|
@ -1743,7 +1743,7 @@ int Layout::findNearestChildWidgetIndex(FocusDirection direction, Widget* baseWi
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Layout::findFarestChildWidgetIndex(cocos2d::ui::FocusDirection direction, cocos2d::ui::Widget *baseWidget)
|
int Layout::findFarestChildWidgetIndex(FocusDirection direction, cocos2d::ui::Widget *baseWidget)
|
||||||
{
|
{
|
||||||
if (baseWidget == nullptr || baseWidget == this)
|
if (baseWidget == nullptr || baseWidget == this)
|
||||||
{
|
{
|
||||||
|
@ -1754,7 +1754,7 @@ int Layout::findFarestChildWidgetIndex(cocos2d::ui::FocusDirection direction, co
|
||||||
|
|
||||||
float distance = -FLT_MAX;
|
float distance = -FLT_MAX;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
if (direction == FocusDirection::FocusDirection_Left || direction == FocusDirection::FocusDirection_Right)
|
if (direction == FocusDirection::LEFT || direction == FocusDirection::RIGHT)
|
||||||
{
|
{
|
||||||
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
||||||
while (index < count)
|
while (index < count)
|
||||||
|
@ -1788,7 +1788,7 @@ int Layout::findFarestChildWidgetIndex(cocos2d::ui::FocusDirection direction, co
|
||||||
index = 0;
|
index = 0;
|
||||||
found = 0;
|
found = 0;
|
||||||
distance = -FLT_MAX;
|
distance = -FLT_MAX;
|
||||||
if (direction == FocusDirection::FocusDirection_Down || direction == FocusDirection::FocusDirection_Up) {
|
if (direction == FocusDirection::DOWN || direction == FocusDirection::UP) {
|
||||||
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
Vector2 widgetPosition = this->getWorldCenterPoint(baseWidget);
|
||||||
while (index < count)
|
while (index < count)
|
||||||
{
|
{
|
||||||
|
@ -1873,27 +1873,27 @@ void Layout::findProperSearchingFunctor(FocusDirection dir, Widget* baseWidget)
|
||||||
|
|
||||||
Vector2 layoutPosition = this->getWorldCenterPoint(this->findFirstNonLayoutWidget());
|
Vector2 layoutPosition = this->getWorldCenterPoint(this->findFirstNonLayoutWidget());
|
||||||
|
|
||||||
if (dir == FocusDirection::FocusDirection_Left) {
|
if (dir == FocusDirection::LEFT) {
|
||||||
if (previousWidgetPosition.x > layoutPosition.x) {
|
if (previousWidgetPosition.x > layoutPosition.x) {
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this);
|
||||||
}
|
}
|
||||||
}else if(dir == FocusDirection::FocusDirection_Right){
|
}else if(dir == FocusDirection::RIGHT){
|
||||||
if (previousWidgetPosition.x > layoutPosition.x) {
|
if (previousWidgetPosition.x > layoutPosition.x) {
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
||||||
}
|
}
|
||||||
}else if(dir == FocusDirection::FocusDirection_Down){
|
}else if(dir == FocusDirection::DOWN){
|
||||||
if (previousWidgetPosition.y > layoutPosition.y) {
|
if (previousWidgetPosition.y > layoutPosition.y) {
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
||||||
}else{
|
}else{
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findFarestChildWidgetIndex, this);
|
||||||
}
|
}
|
||||||
}else if(dir == FocusDirection::FocusDirection_Up){
|
}else if(dir == FocusDirection::UP){
|
||||||
if (previousWidgetPosition.y < layoutPosition.y) {
|
if (previousWidgetPosition.y < layoutPosition.y) {
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
||||||
}else{
|
}else{
|
||||||
|
@ -1906,7 +1906,7 @@ void Layout::findProperSearchingFunctor(FocusDirection dir, Widget* baseWidget)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget* Layout::passFocusToChild(cocos2d::ui::FocusDirection dir, cocos2d::ui::Widget *current)
|
Widget* Layout::passFocusToChild(FocusDirection dir, cocos2d::ui::Widget *current)
|
||||||
{
|
{
|
||||||
if (checkFocusEnabledChild())
|
if (checkFocusEnabledChild())
|
||||||
{
|
{
|
||||||
|
@ -2188,7 +2188,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)
|
||||||
ssize_t index = container.getIndex(widget);
|
ssize_t index = container.getIndex(widget);
|
||||||
if (parent->getLayoutType() == LAYOUT_LINEAR_HORIZONTAL)
|
if (parent->getLayoutType() == LAYOUT_LINEAR_HORIZONTAL)
|
||||||
{
|
{
|
||||||
if (direction == FocusDirection::FocusDirection_Left) {
|
if (direction == FocusDirection::LEFT) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
return true * isLastWidgetInContainer(parent, direction);
|
return true * isLastWidgetInContainer(parent, direction);
|
||||||
|
@ -2198,7 +2198,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == FocusDirection::FocusDirection_Right) {
|
if (direction == FocusDirection::RIGHT) {
|
||||||
if (index == container.size()-1)
|
if (index == container.size()-1)
|
||||||
{
|
{
|
||||||
return true * isLastWidgetInContainer(parent, direction);
|
return true * isLastWidgetInContainer(parent, direction);
|
||||||
|
@ -2208,19 +2208,19 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == FocusDirection::FocusDirection_Down)
|
if (direction == FocusDirection::DOWN)
|
||||||
{
|
{
|
||||||
return isLastWidgetInContainer(parent, direction);
|
return isLastWidgetInContainer(parent, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (direction == FocusDirection::FocusDirection_Up)
|
if (direction == FocusDirection::UP)
|
||||||
{
|
{
|
||||||
return isLastWidgetInContainer(parent, direction);
|
return isLastWidgetInContainer(parent, direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(parent->getLayoutType() == LAYOUT_LINEAR_VERTICAL)
|
else if(parent->getLayoutType() == LAYOUT_LINEAR_VERTICAL)
|
||||||
{
|
{
|
||||||
if (direction == FocusDirection::FocusDirection_Up)
|
if (direction == FocusDirection::UP)
|
||||||
{
|
{
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
|
@ -2232,7 +2232,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == FocusDirection::FocusDirection_Down)
|
if (direction == FocusDirection::DOWN)
|
||||||
{
|
{
|
||||||
if (index == container.size() - 1)
|
if (index == container.size() - 1)
|
||||||
{
|
{
|
||||||
|
@ -2243,12 +2243,12 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (direction == FocusDirection::FocusDirection_Left)
|
if (direction == FocusDirection::LEFT)
|
||||||
{
|
{
|
||||||
return isLastWidgetInContainer(parent, direction);
|
return isLastWidgetInContainer(parent, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (direction == FocusDirection::FocusDirection_Right)
|
if (direction == FocusDirection::RIGHT)
|
||||||
{
|
{
|
||||||
return isLastWidgetInContainer(parent, direction);
|
return isLastWidgetInContainer(parent, direction);
|
||||||
}
|
}
|
||||||
|
@ -2274,7 +2274,7 @@ bool Layout::isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection di
|
||||||
auto layoutType = parent->getLayoutType();
|
auto layoutType = parent->getLayoutType();
|
||||||
if (layoutType == LAYOUT_LINEAR_HORIZONTAL)
|
if (layoutType == LAYOUT_LINEAR_HORIZONTAL)
|
||||||
{
|
{
|
||||||
if (direction == FocusDirection::FocusDirection_Left || direction == FocusDirection::FocusDirection_Right)
|
if (direction == FocusDirection::LEFT || direction == FocusDirection::RIGHT)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2285,7 +2285,7 @@ bool Layout::isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection di
|
||||||
}
|
}
|
||||||
if (layoutType == LAYOUT_LINEAR_VERTICAL)
|
if (layoutType == LAYOUT_LINEAR_VERTICAL)
|
||||||
{
|
{
|
||||||
if (direction == FocusDirection::FocusDirection_Down || direction == FocusDirection::FocusDirection_Up)
|
if (direction == FocusDirection::DOWN || direction == FocusDirection::UP)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2338,16 +2338,16 @@ Widget* Layout::findNextFocusedWidget(FocusDirection direction, Widget* current)
|
||||||
{
|
{
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case FocusDirection::FocusDirection_Left:
|
case FocusDirection::LEFT:
|
||||||
{
|
{
|
||||||
return this->getPreviousFocusedWidget(direction, current);
|
return this->getPreviousFocusedWidget(direction, current);
|
||||||
}break;
|
}break;
|
||||||
case FocusDirection::FocusDirection_Right:
|
case FocusDirection::RIGHT:
|
||||||
{
|
{
|
||||||
return this->getNextFocusedWidget(direction, current);
|
return this->getNextFocusedWidget(direction, current);
|
||||||
}break;
|
}break;
|
||||||
case FocusDirection::FocusDirection_Down:
|
case FocusDirection::DOWN:
|
||||||
case FocusDirection::FocusDirection_Up:
|
case FocusDirection::UP:
|
||||||
{
|
{
|
||||||
if (isLastWidgetInContainer(this, direction))
|
if (isLastWidgetInContainer(this, direction))
|
||||||
{
|
{
|
||||||
|
@ -2375,8 +2375,8 @@ Widget* Layout::findNextFocusedWidget(FocusDirection direction, Widget* current)
|
||||||
{
|
{
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case FocusDirection::FocusDirection_Left:
|
case FocusDirection::LEFT:
|
||||||
case FocusDirection::FocusDirection_Right:
|
case FocusDirection::RIGHT:
|
||||||
{
|
{
|
||||||
if (isLastWidgetInContainer(this, direction))
|
if (isLastWidgetInContainer(this, direction))
|
||||||
{
|
{
|
||||||
|
@ -2393,12 +2393,12 @@ Widget* Layout::findNextFocusedWidget(FocusDirection direction, Widget* current)
|
||||||
return Widget::findNextFocusedWidget(direction, this);
|
return Widget::findNextFocusedWidget(direction, this);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case FocusDirection::FocusDirection_Down:
|
case FocusDirection::DOWN:
|
||||||
{
|
{
|
||||||
return getNextFocusedWidget(direction, current);
|
return getNextFocusedWidget(direction, current);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FocusDirection::FocusDirection_Up:
|
case FocusDirection::UP:
|
||||||
{
|
{
|
||||||
return getPreviousFocusedWidget(direction, current);
|
return getPreviousFocusedWidget(direction, current);
|
||||||
}
|
}
|
||||||
|
|
|
@ -984,12 +984,13 @@ bool Widget::isFocusEnabled()
|
||||||
return _focusEnabled;
|
return _focusEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* Widget::findNextFocusedWidget(cocos2d::ui::FocusDirection direction, Widget* current)
|
Widget* Widget::findNextFocusedWidget(FocusDirection direction, Widget* current)
|
||||||
{
|
{
|
||||||
if (nullptr == onNextFocusedWidget || nullptr == onNextFocusedWidget(direction) ) {
|
if (nullptr == onNextFocusedWidget || nullptr == onNextFocusedWidget(direction) ) {
|
||||||
if (this->isFocused() || !current->isFocusEnabled())
|
if (this->isFocused() || !current->isFocusEnabled())
|
||||||
{
|
{
|
||||||
Node* parent = this->getParent();
|
Node* parent = this->getParent();
|
||||||
|
|
||||||
Layout* layout = dynamic_cast<Layout*>(parent);
|
Layout* layout = dynamic_cast<Layout*>(parent);
|
||||||
if (nullptr == layout)
|
if (nullptr == layout)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,13 +73,7 @@ typedef enum
|
||||||
POSITION_PERCENT
|
POSITION_PERCENT
|
||||||
}PositionType;
|
}PositionType;
|
||||||
|
|
||||||
enum class FocusDirection
|
|
||||||
{
|
|
||||||
FocusDirection_Left,
|
|
||||||
FocusDirection_Right,
|
|
||||||
FocusDirection_Up,
|
|
||||||
FocusDirection_Down
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType);
|
typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType);
|
||||||
|
@ -91,6 +85,14 @@ typedef void (Ref::*SEL_TouchEvent)(Ref*,TouchEventType);
|
||||||
class Widget : public ProtectedNode
|
class Widget : public ProtectedNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum class FocusDirection
|
||||||
|
{
|
||||||
|
LEFT,
|
||||||
|
RIGHT,
|
||||||
|
UP,
|
||||||
|
DOWN
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -80,7 +80,7 @@ void UIFocusTestBase::onLeftKeyPressed()
|
||||||
if (!_firstFocusedWidget->isFocused()) {
|
if (!_firstFocusedWidget->isFocused()) {
|
||||||
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
||||||
}
|
}
|
||||||
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(FocusDirection::FocusDirection_Left, _firstFocusedWidget);
|
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(Widget::FocusDirection::LEFT, _firstFocusedWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ void UIFocusTestBase::onRightKeyPressed()
|
||||||
if (!_firstFocusedWidget->isFocused()) {
|
if (!_firstFocusedWidget->isFocused()) {
|
||||||
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
||||||
}
|
}
|
||||||
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(FocusDirection::FocusDirection_Right, _firstFocusedWidget);
|
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(Widget::FocusDirection::RIGHT, _firstFocusedWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ void UIFocusTestBase::onUpKeyPressed()
|
||||||
if (!_firstFocusedWidget->isFocused()) {
|
if (!_firstFocusedWidget->isFocused()) {
|
||||||
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
||||||
}
|
}
|
||||||
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(FocusDirection::FocusDirection_Up, _firstFocusedWidget);
|
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(Widget::FocusDirection::UP, _firstFocusedWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ void UIFocusTestBase::onDownKeyPressed()
|
||||||
if (!_firstFocusedWidget->isFocused()) {
|
if (!_firstFocusedWidget->isFocused()) {
|
||||||
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
_firstFocusedWidget = _firstFocusedWidget->getCurrentFocusedWidget(false);
|
||||||
}
|
}
|
||||||
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(FocusDirection::FocusDirection_Down, _firstFocusedWidget);
|
_firstFocusedWidget = _firstFocusedWidget->findNextFocusedWidget(Widget::FocusDirection::DOWN, _firstFocusedWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue