forked from EasyIME/PIME
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic skeleton for UILess mode support.
- Loading branch information
Showing
4 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#include "CandidateListUIElement.h" | ||
#include <assert.h> | ||
|
||
namespace Ime { | ||
|
||
CandidateListUIElement::CandidateListUIElement(ITfContext* context): | ||
context_(context), | ||
refCount_(1) { | ||
} | ||
|
||
CandidateListUIElement::~CandidateListUIElement(void) { | ||
} | ||
|
||
// COM stuff | ||
|
||
// IUnknown | ||
STDMETHODIMP CandidateListUIElement::QueryInterface(REFIID riid, void **ppvObj) { | ||
if (ppvObj == NULL) | ||
return E_INVALIDARG; | ||
|
||
if(IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfCandidateListUIElement)) | ||
*ppvObj = (ITfCandidateListUIElement*)this; | ||
else | ||
*ppvObj = NULL; | ||
|
||
if(*ppvObj) { | ||
AddRef(); | ||
return S_OK; | ||
} | ||
return E_NOINTERFACE; | ||
} | ||
|
||
STDMETHODIMP_(ULONG) CandidateListUIElement::AddRef(void) { | ||
return ++refCount_; | ||
} | ||
|
||
STDMETHODIMP_(ULONG) CandidateListUIElement::Release(void) { | ||
assert(refCount_ > 0); | ||
--refCount_; | ||
if(0 == refCount_) | ||
delete this; | ||
return refCount_; | ||
} | ||
|
||
// ITfUIElement | ||
STDMETHODIMP CandidateListUIElement::GetDescription(BSTR *pbstrDescription) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::GetGUID(GUID *pguid) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::Show(BOOL bShow) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::IsShown(BOOL *pbShow) { | ||
return S_OK; | ||
} | ||
|
||
// ITfCandidateListUIElement | ||
STDMETHODIMP CandidateListUIElement::GetUpdatedFlags(DWORD *pdwFlags) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::GetDocumentMgr(ITfDocumentMgr **ppdim) { | ||
if(!context_) | ||
return E_FAIL; | ||
return context_->GetDocumentMgr(ppdim); | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::GetCount(UINT *puCount) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::GetSelection(UINT *puIndex) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::GetString(UINT uIndex, BSTR *pstr) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::GetPageIndex(UINT *pIndex, UINT uSize, UINT *puPageCnt) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::SetPageIndex(UINT *pIndex, UINT uPageCnt) { | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP CandidateListUIElement::GetCurrentPage(UINT *puPage) { | ||
return S_OK; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#pragma once | ||
#ifndef IME_CANDIDATE_LIST_UI_ELEMENT | ||
#define IME_CANDIDATE_LIST_UI_ELEMENT | ||
|
||
#include <msctf.h> | ||
#include "ComPtr.h" | ||
|
||
namespace Ime { | ||
|
||
class CandidateListUIElement: | ||
public ITfUIElement, | ||
public ITfCandidateListUIElement { | ||
public: | ||
CandidateListUIElement(ITfContext* context); | ||
virtual ~CandidateListUIElement(void); | ||
|
||
// COM related stuff | ||
|
||
// IUnknown | ||
STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj); | ||
STDMETHODIMP_(ULONG) AddRef(void); | ||
STDMETHODIMP_(ULONG) Release(void); | ||
|
||
// ITfUIElement | ||
STDMETHODIMP GetDescription(BSTR *pbstrDescription); | ||
STDMETHODIMP GetGUID(GUID *pguid); | ||
STDMETHODIMP Show(BOOL bShow); | ||
STDMETHODIMP IsShown(BOOL *pbShow); | ||
|
||
// ITfCandidateListUIElement | ||
STDMETHODIMP GetUpdatedFlags(DWORD *pdwFlags); | ||
STDMETHODIMP GetDocumentMgr(ITfDocumentMgr **ppdim); | ||
STDMETHODIMP GetCount(UINT *puCount); | ||
STDMETHODIMP GetSelection(UINT *puIndex); | ||
STDMETHODIMP GetString(UINT uIndex, BSTR *pstr); | ||
STDMETHODIMP GetPageIndex(UINT *pIndex, UINT uSize, UINT *puPageCnt); | ||
STDMETHODIMP SetPageIndex(UINT *pIndex, UINT uPageCnt); | ||
STDMETHODIMP GetCurrentPage(UINT *puPage); | ||
|
||
private: | ||
ComPtr<ITfContext> context_; | ||
int refCount_; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters