X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Finput%2Fwindows%2Finput-method-context-impl-win.cpp;h=5df001d8d4a51b3186e33cd49b70383a4d196e48;hb=refs%2Fchanges%2F09%2F208609%2F9;hp=16df1a5a41e9155f888c2b3bb476ec561146e3e2;hpb=6f87db7f10cf41060ba6417eb108897f8140eb2a;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/input/windows/input-method-context-impl-win.cpp b/dali/internal/input/windows/input-method-context-impl-win.cpp index 16df1a5..5df001d 100755 --- a/dali/internal/input/windows/input-method-context-impl-win.cpp +++ b/dali/internal/input/windows/input-method-context-impl-win.cpp @@ -41,27 +41,13 @@ namespace Internal namespace Adaptor { -InputMethodContextPtr InputMethodContextWin::New() +InputMethodContextPtr InputMethodContextWin::New( Dali::Actor actor ) { InputMethodContextPtr manager; - if ( Adaptor::IsAvailable() ) + if ( actor && Adaptor::IsAvailable() ) { - // Create instance and register singleton only if the adaptor is available - Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) ); - Any nativeWindow = adaptorImpl.GetNativeWindowHandle(); - - // The Win_Window_Handle needs to use the InputMethodContext. - // Only when the render surface is window, we can get the Win_Window_Handle. - WinWindowHandle winWindow( AnyCast(nativeWindow) ); - if ( winWindow ) - { - manager = new InputMethodContextWin( winWindow ); - } - else - { - DALI_LOG_ERROR("Failed to get native window handle\n"); - } + manager = new InputMethodContextWin( actor ); } return manager; @@ -71,13 +57,15 @@ void InputMethodContextWin::Finalize() { } -InputMethodContextWin::InputMethodContextWin( WinWindowHandle winWindow ) -: mWin32Window( winWindow ), +InputMethodContextWin::InputMethodContextWin( Dali::Actor actor ) +: mWin32Window( 0 ), mIMFCursorPosition( 0 ), mSurroundingText(), mRestoreAfterFocusLost( false ), mIdleCallbackConnected( false ) { + + actor.OnStageSignal().Connect( this, &InputMethodContextWin::OnStaged ); } InputMethodContextWin::~InputMethodContextWin() @@ -148,18 +136,18 @@ void InputMethodContextWin::SetRestoreAfterFocusLost( bool toggle ) * We are still predicting what the user is typing. The latest string is what the InputMethodContext module thinks * the user wants to type. */ -void InputMethodContextWin::PreEditChanged( void*, ImfContext* imfContext, void* event_info ) +void InputMethodContextWin::PreEditChanged( void*, ImfContext* imfContext, void* eventInfo ) { DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::PreEditChanged\n" ); } -void InputMethodContextWin::CommitReceived( void*, ImfContext* imfContext, void* event_info ) +void InputMethodContextWin::CommitReceived( void*, ImfContext* imfContext, void* eventInfo ) { DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::CommitReceived\n" ); if ( Dali::Adaptor::IsAvailable() ) { - const std::string keyString( static_cast( event_info ) ); + const std::string keyString( static_cast( eventInfo ) ); Dali::InputMethodContext handle( this ); Dali::InputMethodContext::EventData eventData( Dali::InputMethodContext::COMMIT, keyString, 0, 0 ); @@ -208,7 +196,7 @@ bool InputMethodContextWin::RetrieveSurrounding( void* data, ImfContext* imfCont * Called when an InputMethodContext delete surrounding event is received. * Here we tell the application that it should delete a certain range. */ -void InputMethodContextWin::DeleteSurrounding( void* data, ImfContext* imfContext, void* event_info ) +void InputMethodContextWin::DeleteSurrounding( void* data, ImfContext* imfContext, void* eventInfo ) { DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::DeleteSurrounding\n" ); } @@ -335,6 +323,11 @@ std::string InputMethodContextWin::GetInputPanelLocale() return locale; } +void InputMethodContextWin::SetContentMIMETypes( const std::string& mimeTypes ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetContentMIMETypes\n" ); +} + bool InputMethodContextWin::FilterEventKey( const Dali::KeyEvent& keyEvent ) { bool eventHandled( false ); @@ -355,6 +348,17 @@ bool InputMethodContextWin::FilterEventKey( const Dali::KeyEvent& keyEvent ) return eventHandled; } +void InputMethodContextWin::SetInputPanelLanguage( Dali::InputMethodContext::InputPanelLanguage language ) +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::SetInputPanelLanguage\n" ); +} + +Dali::InputMethodContext::InputPanelLanguage InputMethodContextWin::GetInputPanelLanguage() const +{ + DALI_LOG_INFO( gLogFilter, Debug::General, "InputMethodContextWin::GetInputPanelLanguage\n" ); + return Dali::InputMethodContext::InputPanelLanguage::AUTOMATIC; +} + bool InputMethodContextWin::ProcessEventKeyDown( const KeyEvent& keyEvent ) { bool eventHandled( false ); @@ -367,6 +371,20 @@ bool InputMethodContextWin::ProcessEventKeyUp( const KeyEvent& keyEvent ) return eventHandled; } +void InputMethodContextWin::OnStaged( Dali::Actor actor ) +{ + WinWindowHandle winWindow( AnyCast< WinWindowHandle >( Dali::Integration::SceneHolder::Get( actor ).GetNativeHandle() ) ); + + if( mWin32Window != winWindow ) + { + mWin32Window = winWindow; + + // Reset + Finalize(); + Initialize(); + } +} + } // Adaptor } // Internal