@@ -26,12 +26,27 @@ THE SOFTWARE.
26
26
#include " CCOspForm.h"
27
27
#include " CCDirector.h"
28
28
#include " CCEGLView.h"
29
+ #include < FBase.h>
30
+ #include < FText.h>
29
31
30
32
USING_NS_CC;
33
+ using namespace Tizen ::Base;
34
+ using namespace Tizen ::Text;
31
35
using namespace Tizen ::Ui;
32
36
using namespace Tizen ::Ui::Controls;
33
37
using namespace Tizen ::Graphics;
34
38
39
+ CCOspForm::CCOspForm ()
40
+ : __pKeypad(null)
41
+ , m_pfEditTextCallback(null)
42
+ , m_pCtx(null)
43
+ {
44
+ }
45
+
46
+ CCOspForm::~CCOspForm ()
47
+ {
48
+ }
49
+
35
50
result
36
51
CCOspForm::OnInitializing (void )
37
52
{
@@ -41,6 +56,16 @@ CCOspForm::OnInitializing(void)
41
56
return E_SUCCESS;
42
57
}
43
58
59
+ result
60
+ CCOspForm::OnTerminating (void )
61
+ {
62
+ result r = E_SUCCESS;
63
+
64
+ __pKeypad->Destroy ();
65
+
66
+ return r;
67
+ }
68
+
44
69
void
45
70
CCOspForm:: OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
46
71
{
@@ -87,3 +112,51 @@ CCOspForm::OnTouchReleased(const Control& source, const Point& currentPosition,
87
112
float y = currentPosition.y ;
88
113
CCDirector::sharedDirector ()->getOpenGLView ()->handleTouchesEnd (1 , &id, &x, &y);
89
114
}
115
+
116
+ void CCOspForm::OnTextValueChanged (const Tizen::Ui::Control& source)
117
+ {
118
+ String text = __pKeypad->GetText ();
119
+ AsciiEncoding ascii;
120
+ m_pfEditTextCallback ((const char *)ascii.GetBytesN (text)->GetPointer (), m_pCtx);
121
+ }
122
+
123
+ void CCOspForm::OnTextValueChangeCanceled (const Tizen::Ui::Control& source)
124
+ {
125
+ m_pfEditTextCallback (" " , m_pCtx);
126
+ }
127
+
128
+ void
129
+ CCOspForm::ShowKeypad (KeypadStyle keypadStyle, KeypadInputModeCategory keypadCategory, bool bSingleLineEnabled, bool bTextPrediction, int nMaxLength, EditTextCallback pfEditTextCallback, void * pCtx)
130
+ {
131
+ m_pfEditTextCallback = pfEditTextCallback;
132
+ m_pCtx = pCtx;
133
+
134
+ if (__pKeypad)
135
+ {
136
+ __pKeypad->RemoveTextEventListener (*this );
137
+ __pKeypad->Destroy ();
138
+ __pKeypad = null;
139
+ }
140
+
141
+ if (nMaxLength > 100 )
142
+ nMaxLength = 100 ;
143
+ else if (nMaxLength == -1 )
144
+ nMaxLength = 100 ;
145
+
146
+ __pKeypad = new Keypad ();
147
+ __pKeypad->Construct (keypadStyle, keypadCategory, nMaxLength);
148
+ __pKeypad->AddTextEventListener (*this );
149
+
150
+ __pKeypad->SetTextPredictionEnabled (bTextPrediction);
151
+ __pKeypad->SetSingleLineEnabled (bSingleLineEnabled);
152
+ __pKeypad->SetShowState (true );
153
+ __pKeypad->Show ();
154
+ }
155
+
156
+ void
157
+ CCOspForm::CloseKeypad ()
158
+ {
159
+ __pKeypad->SetShowState (false );
160
+ Invalidate (true );
161
+ }
162
+
0 commit comments