mirror of https://github.com/axmolengine/axmol.git
Implement setIMEKeyboardState function for Tizen.
This commit is contained in:
parent
e48553bc27
commit
ccd20af8f9
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
||||||
#include "CCGL.h"
|
#include "CCGL.h"
|
||||||
#include "CCDirector.h"
|
#include "CCDirector.h"
|
||||||
#include "CCOspApplication.h"
|
#include "CCOspApplication.h"
|
||||||
|
#include "CCOspForm.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
using namespace Tizen::App;
|
using namespace Tizen::App;
|
||||||
|
@ -88,6 +89,14 @@ void CCEGLView::swapBuffers()
|
||||||
|
|
||||||
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
||||||
{
|
{
|
||||||
|
if (bOpen)
|
||||||
|
{
|
||||||
|
((CCOspForm *)CCOspApplication::GetInstance()->getCCOspForm())->ShowKeypad();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((CCOspForm *)CCOspApplication::GetInstance()->getCCOspForm())->CloseKeypad();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CCEGLView* CCEGLView::sharedOpenGLView()
|
CCEGLView* CCEGLView::sharedOpenGLView()
|
||||||
|
|
|
@ -26,6 +26,7 @@ THE SOFTWARE.
|
||||||
#include "CCOspForm.h"
|
#include "CCOspForm.h"
|
||||||
#include "CCDirector.h"
|
#include "CCDirector.h"
|
||||||
#include "CCEGLView.h"
|
#include "CCEGLView.h"
|
||||||
|
#include "text_input_node/CCIMEDispatcher.h"
|
||||||
#include <FBase.h>
|
#include <FBase.h>
|
||||||
#include <FText.h>
|
#include <FText.h>
|
||||||
|
|
||||||
|
@ -123,7 +124,36 @@ void CCOspForm::OnTextValueChanged(const Tizen::Ui::Control& source)
|
||||||
if (buffer)
|
if (buffer)
|
||||||
pText = (const char *)buffer->GetPointer();
|
pText = (const char *)buffer->GetPointer();
|
||||||
|
|
||||||
m_pfEditTextCallback(pText, m_pCtx);
|
if (m_pfEditTextCallback)
|
||||||
|
{
|
||||||
|
m_pfEditTextCallback(pText, m_pCtx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char* pContentText = CCIMEDispatcher::sharedDispatcher()->getContentText();
|
||||||
|
|
||||||
|
for (unsigned int i = strlen(pContentText); i > 0; i--)
|
||||||
|
{
|
||||||
|
CCIMEDispatcher::sharedDispatcher()->dispatchDeleteBackward();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text("");
|
||||||
|
if (pText != null)
|
||||||
|
{
|
||||||
|
text = pText;
|
||||||
|
if (text.compare("") == 0)
|
||||||
|
{
|
||||||
|
text = "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text.at(text.length() - 1) != '\n')
|
||||||
|
{
|
||||||
|
text += '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCIMEDispatcher::sharedDispatcher()->dispatchInsertText(text.c_str(), text.length());
|
||||||
|
}
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
delete buffer;
|
delete buffer;
|
||||||
|
@ -131,7 +161,19 @@ void CCOspForm::OnTextValueChanged(const Tizen::Ui::Control& source)
|
||||||
|
|
||||||
void CCOspForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
|
void CCOspForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
|
||||||
{
|
{
|
||||||
m_pfEditTextCallback("", m_pCtx);
|
if (m_pfEditTextCallback)
|
||||||
|
{
|
||||||
|
m_pfEditTextCallback("", m_pCtx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char* pContentText = CCIMEDispatcher::sharedDispatcher()->getContentText();
|
||||||
|
|
||||||
|
for (unsigned int i = strlen(pContentText); i > 0; i--)
|
||||||
|
{
|
||||||
|
CCIMEDispatcher::sharedDispatcher()->dispatchDeleteBackward();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -163,6 +205,20 @@ CCOspForm::ShowKeypad(const char* pMessage, KeypadStyle keypadStyle, KeypadInput
|
||||||
__pKeypad->Show();
|
__pKeypad->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCOspForm::ShowKeypad()
|
||||||
|
{
|
||||||
|
ShowKeypad(
|
||||||
|
CCIMEDispatcher::sharedDispatcher()->getContentText(),
|
||||||
|
KEYPAD_STYLE_NORMAL,
|
||||||
|
KEYPAD_MODE_ALPHA,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
100,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CCOspForm::CloseKeypad()
|
CCOspForm::CloseKeypad()
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
|
virtual void OnTextValueChangeCanceled(const Tizen::Ui::Control& source);
|
||||||
|
|
||||||
void ShowKeypad(const char* pMessage, Tizen::Ui::Controls::KeypadStyle keypadStyle, Tizen::Ui::Controls::KeypadInputModeCategory keypadCategory, bool bSingleLineEnabled, bool bTextPrediction, int nMaxLength, EditTextCallback pfEditTextCallback, void* pCtx);
|
void ShowKeypad(const char* pMessage, Tizen::Ui::Controls::KeypadStyle keypadStyle, Tizen::Ui::Controls::KeypadInputModeCategory keypadCategory, bool bSingleLineEnabled, bool bTextPrediction, int nMaxLength, EditTextCallback pfEditTextCallback, void* pCtx);
|
||||||
|
void ShowKeypad();
|
||||||
void CloseKeypad();
|
void CloseKeypad();
|
||||||
|
|
||||||
Tizen::Ui::Controls::Keypad*__pKeypad;
|
Tizen::Ui::Controls::Keypad*__pKeypad;
|
||||||
|
|
Loading…
Reference in New Issue