Windows2003-3790/windows/feime/kor/ime2k/tip/focus.cpp
2020-09-30 16:53:55 +02:00

79 lines
2.4 KiB
C++

/****************************************************************************
FOCUS.CPP : CKorIMX's Candidate UI member functions implementation
History:
08-FEB-2000 CSLim Created
****************************************************************************/
#include "private.h"
#include "korimx.h"
#include "immxutil.h"
#include "globals.h"
/*---------------------------------------------------------------------------
CKorIMX::OnSetThreadFocus (Called from Activate)
This methods is called when the user switches focus between threads.
TIP should restore its ui (status windows, etc.) in this case.
---------------------------------------------------------------------------*/
STDAPI CKorIMX::OnSetThreadFocus()
{
TraceMsg(TF_GENERAL, "ActivateUI: (%x) fActivate = %x, wnd thread = %x",
GetCurrentThreadId(), TRUE, GetWindowThreadProcessId(GetOwnerWnd(), NULL));
if (m_pCandUI != NULL)
{
ITfCandUICandWindow *pCandWindow;
if (SUCCEEDED(m_pCandUI->GetUIObject(IID_ITfCandUICandWindow, (IUnknown**)&pCandWindow)))
{
pCandWindow->Show(fTrue);
pCandWindow->Release();
}
}
if (m_pToolBar)
m_pToolBar->SetUIFocus(fTrue);
if (IsSoftKbdEnabled())
SoftKbdOnThreadFocusChange(fTrue);
return S_OK;
}
/*---------------------------------------------------------------------------
CKorIMX::OnKillThreadFocus (Called from Deactivate)
This methods is called when the user switches focus between threads.
TIP should hide its ui (status windows, etc.) in this case.
---------------------------------------------------------------------------*/
STDAPI CKorIMX::OnKillThreadFocus()
{
TraceMsg(TF_GENERAL, "DeactivateUI: (%x) wnd thread = %x",
GetCurrentThreadId(), GetWindowThreadProcessId(GetOwnerWnd(), NULL));
if (m_pCandUI != NULL)
{
ITfCandUICandWindow *pCandWindow;
if (SUCCEEDED(m_pCandUI->GetUIObject(IID_ITfCandUICandWindow, (IUnknown**)&pCandWindow)))
{
pCandWindow->Show(fFalse);
pCandWindow->Release();
}
}
#if 0
m_pStatusWnd->Show(FALSE);
#endif
if (m_pToolBar)
m_pToolBar->SetUIFocus(fFalse);
if (IsSoftKbdEnabled())
SoftKbdOnThreadFocusChange(fFalse);
return S_OK;
}