Skip to content

Commit

Permalink
Method to check if any IME dispatcher is active. (cocos2d#19451)
Browse files Browse the repository at this point in the history
Useful feature to know if any text field or custom IME dispatcher is active
  • Loading branch information
sbrednikhin authored and huangwei1024 committed Jun 20, 2019
1 parent 47f9daf commit 50116d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cocos/base/CCIMEDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ const std::string& IMEDispatcher::getContentText()
return STD_STRING_EMPTY;
}

bool IMEDispatcher::isAnyDelegateAttachedWithIME() const
{
if (!_impl)
return false;
return _impl->_delegateWithIme != nullptr;
}

//////////////////////////////////////////////////////////////////////////
// dispatch keyboard message
//////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 5 additions & 0 deletions cocos/base/CCIMEDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class CC_DLL IMEDispatcher
* @lua NA
*/
const std::string& getContentText();

/**
*@brief Returns if any delegate is attached with IME.
*/
bool isAnyDelegateAttachedWithIME() const;

//////////////////////////////////////////////////////////////////////////
// dispatch keyboard notification
Expand Down

0 comments on commit 50116d9

Please sign in to comment.