mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-02 11:10:31 +03:00
Fix Event::OnFocusWithin and Event::OnFocusWithinLoss not being correctly emited.
This commit is contained in:
@@ -1346,7 +1346,7 @@ void UINode::pushState( const Uint32& State, bool emitEvent ) {
|
|||||||
if ( emitEvent ) {
|
if ( emitEvent ) {
|
||||||
onStateChange();
|
onStateChange();
|
||||||
|
|
||||||
if ( State & UIState::StateFocusWithin )
|
if ( mState & UIState::StateFlagFocusWithin )
|
||||||
sendCommonEvent( Event::OnFocusWithin );
|
sendCommonEvent( Event::OnFocusWithin );
|
||||||
} else {
|
} else {
|
||||||
invalidateDraw();
|
invalidateDraw();
|
||||||
@@ -1364,7 +1364,7 @@ void UINode::popState( const Uint32& State, bool emitEvent ) {
|
|||||||
if ( emitEvent ) {
|
if ( emitEvent ) {
|
||||||
onStateChange();
|
onStateChange();
|
||||||
|
|
||||||
if ( State & UIState::StateFocusWithin )
|
if ( mState & UIState::StateFlagFocusWithin )
|
||||||
sendCommonEvent( Event::OnFocusWithinLoss );
|
sendCommonEvent( Event::OnFocusWithinLoss );
|
||||||
} else {
|
} else {
|
||||||
invalidateDraw();
|
invalidateDraw();
|
||||||
|
|||||||
@@ -1314,9 +1314,6 @@ void UIWidget::pushState( const Uint32& State, bool emitEvent ) {
|
|||||||
|
|
||||||
if ( emitEvent ) {
|
if ( emitEvent ) {
|
||||||
onStateChange();
|
onStateChange();
|
||||||
|
|
||||||
if ( State & UIState::StateFocusWithin )
|
|
||||||
sendCommonEvent( Event::OnFocusWithin );
|
|
||||||
} else {
|
} else {
|
||||||
invalidateDraw();
|
invalidateDraw();
|
||||||
}
|
}
|
||||||
@@ -1339,9 +1336,6 @@ void UIWidget::popState( const Uint32& State, bool emitEvent ) {
|
|||||||
|
|
||||||
if ( emitEvent ) {
|
if ( emitEvent ) {
|
||||||
onStateChange();
|
onStateChange();
|
||||||
|
|
||||||
if ( State & UIState::StateFocusWithin )
|
|
||||||
sendCommonEvent( Event::OnFocusWithinLoss );
|
|
||||||
} else {
|
} else {
|
||||||
invalidateDraw();
|
invalidateDraw();
|
||||||
}
|
}
|
||||||
@@ -1350,11 +1344,14 @@ void UIWidget::popState( const Uint32& State, bool emitEvent ) {
|
|||||||
|
|
||||||
Uint32 UIWidget::onFocus( NodeFocusReason reason ) {
|
Uint32 UIWidget::onFocus( NodeFocusReason reason ) {
|
||||||
pushState( UIState::StateFocusWithin );
|
pushState( UIState::StateFocusWithin );
|
||||||
|
sendCommonEvent( Event::OnFocusWithin );
|
||||||
|
|
||||||
Node* parent = mParentNode;
|
Node* parent = mParentNode;
|
||||||
while ( parent ) {
|
while ( parent ) {
|
||||||
if ( parent->isUINode() )
|
if ( parent->isUINode() ) {
|
||||||
parent->asType<UINode>()->pushState( UIState::StateFocusWithin );
|
parent->asType<UINode>()->pushState( UIState::StateFocusWithin );
|
||||||
|
parent->asType<UINode>()->sendCommonEvent( Event::OnFocusWithin );
|
||||||
|
}
|
||||||
parent = parent->getParent();
|
parent = parent->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1363,11 +1360,14 @@ Uint32 UIWidget::onFocus( NodeFocusReason reason ) {
|
|||||||
|
|
||||||
Uint32 UIWidget::onFocusLoss() {
|
Uint32 UIWidget::onFocusLoss() {
|
||||||
popState( UIState::StateFocusWithin );
|
popState( UIState::StateFocusWithin );
|
||||||
|
sendCommonEvent( Event::OnFocusWithinLoss );
|
||||||
|
|
||||||
Node* parent = mParentNode;
|
Node* parent = mParentNode;
|
||||||
while ( parent ) {
|
while ( parent ) {
|
||||||
if ( parent->isUINode() )
|
if ( parent->isUINode() ) {
|
||||||
parent->asType<UINode>()->popState( UIState::StateFocusWithin );
|
parent->asType<UINode>()->popState( UIState::StateFocusWithin );
|
||||||
|
parent->asType<UINode>()->sendCommonEvent( Event::OnFocusWithinLoss );
|
||||||
|
}
|
||||||
parent = parent->getParent();
|
parent = parent->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user