Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
4.2 KiB

  1. //
  2. // candlst.h
  3. //
  4. #ifndef CANDLST_H
  5. #define CANDLST_H
  6. #include "private.h"
  7. #include "mscandui.h"
  8. #include "ptrary.h"
  9. #define IEXTRACANDIDATE (UINT)(-2)
  10. #define CIC_KOR_CANDSTR_MAX 512
  11. class CCandidateStringEx;
  12. class CCandidateListEx;
  13. typedef HRESULT (*CANDLISTCALLBACKEX)(ITfContext *pic, ITfRange *pRange, CCandidateListEx *pCandLst, CCandidateStringEx *pCand, TfCandidateResult imcr);
  14. //
  15. // CCandidateStringEx
  16. //
  17. class CCandidateStringEx : public ITfCandidateString,
  18. public ITfCandidateStringInlineComment,
  19. public ITfCandidateStringColor
  20. {
  21. public:
  22. CCandidateStringEx(int nIndex, LPCWSTR psz, LANGID langid, void *pv, IUnknown *punk);
  23. ~CCandidateStringEx();
  24. //
  25. // IUnknown methods
  26. //
  27. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  28. STDMETHODIMP_(ULONG) AddRef(void);
  29. STDMETHODIMP_(ULONG) Release(void);
  30. //
  31. // ITfCandidateString
  32. //
  33. STDMETHODIMP GetString(BSTR *pbstr);
  34. STDMETHODIMP GetIndex(ULONG *pnIndex);
  35. //
  36. // ITfCandidateStringInlineComment
  37. //
  38. STDMETHODIMP GetInlineCommentString(BSTR *pbstr);
  39. //
  40. // ITfCandidateStringColor
  41. //
  42. STDMETHODIMP GetColor(CANDUICOLOR *pcol);
  43. #if 0
  44. //
  45. // ITfCandidateStringPopupComment
  46. //
  47. STDMETHODIMP GetPopupCommentString( BSTR *pbstr );
  48. STDMETHODIMP GetPopupCommentGroupID( DWORD *pdwGroupID );
  49. //
  50. // ITfCandidateStringFixture
  51. //
  52. STDMETHODIMP GetPrefixString( BSTR *pbstr );
  53. STDMETHODIMP GetSuffixString( BSTR *pbstr );
  54. //
  55. // ITfCandidateStringIcon
  56. //
  57. STDMETHODIMP GetIcon( HICON *phIcon );
  58. #endif
  59. //
  60. // internal
  61. //
  62. HRESULT SetReadingString(LPCWSTR psz);
  63. HRESULT SetInlineComment(LPCWSTR psz);
  64. #if 0
  65. HRESULT SetPopupComment(LPCWSTR psz, DWORD dwGroupID);
  66. HRESULT SetPrefixString(LPCWSTR psz);
  67. HRESULT SetSuffixString(LPCWSTR psz);
  68. #endif
  69. void *m_pv;
  70. IUnknown *m_punk;
  71. LPWSTR m_psz;
  72. LPWSTR m_pszRead;
  73. LANGID m_langid;
  74. WORD m_bHanjaCat;
  75. protected:
  76. int m_cRef;
  77. int m_nIndex;
  78. LPWSTR m_pszInlineComment;
  79. #if 0
  80. LPWSTR m_pszPopupComment;
  81. DWORD m_dwPopupCommentGroupID;
  82. LPWSTR m_pszPrefix;
  83. LPWSTR m_pszSuffix;
  84. #endif
  85. };
  86. //
  87. // CCandidateListEx
  88. //
  89. class CCandidateListEx : public ITfCandidateList,
  90. public ITfCandidateListExtraCandidate
  91. {
  92. public:
  93. CCandidateListEx(CANDLISTCALLBACKEX pfnCallback, ITfContext *pic, ITfRange *pRange);
  94. ~CCandidateListEx();
  95. //
  96. // IUnknown methods
  97. //
  98. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  99. STDMETHODIMP_(ULONG) AddRef(void);
  100. STDMETHODIMP_(ULONG) Release(void);
  101. //
  102. // ITfCandidateList
  103. //
  104. STDMETHODIMP EnumCandidates(IEnumTfCandidates **ppEnum);
  105. STDMETHODIMP GetCandidate(ULONG nIndex, ITfCandidateString **ppCand);
  106. STDMETHODIMP GetCandidateNum(ULONG *pnCnt);
  107. STDMETHODIMP SetResult(ULONG nIndex, TfCandidateResult imcr);
  108. //
  109. // ITfCandidateListExtraCandidate
  110. //
  111. STDMETHODIMP GetExtraCandidate(ITfCandidateString **ppCand);
  112. //
  113. // internal
  114. //
  115. HRESULT AddString(LPCWSTR psz, LANGID langid, void *pv, IUnknown *punk, CCandidateStringEx **ppCandStr);
  116. HRESULT SetInitialSelection(ULONG iSelection);
  117. HRESULT GetInitialSelection(ULONG *piSelection);
  118. HRESULT AddExtraString( LPCWSTR psz, LANGID langid, void *pv, IUnknown *punk, CCandidateStringEx **ppCandStr );
  119. CPtrArray<CCandidateStringEx> m_rgCandStr;
  120. protected:
  121. int m_cRef;
  122. ITfContext *m_pic;
  123. ITfRange *m_pRange;
  124. ITfFnReconversion *m_pReconv;
  125. CANDLISTCALLBACKEX m_pfnCallback;
  126. int m_iInitialSelection;
  127. CCandidateStringEx *m_pExtraCand;
  128. };
  129. //
  130. // CEnumCandidatesEx
  131. //
  132. class CEnumCandidatesEx : public IEnumTfCandidates
  133. {
  134. public:
  135. CEnumCandidatesEx(CCandidateListEx *pList);
  136. ~CEnumCandidatesEx();
  137. //
  138. // IUnknown methods
  139. //
  140. STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
  141. STDMETHODIMP_(ULONG) AddRef(void);
  142. STDMETHODIMP_(ULONG) Release(void);
  143. //
  144. // ITfEnumCandidates
  145. //
  146. STDMETHODIMP Clone(IEnumTfCandidates **ppEnum);
  147. STDMETHODIMP Next(ULONG ulCount, ITfCandidateString **ppCand, ULONG *pcFetched);
  148. STDMETHODIMP Reset();
  149. STDMETHODIMP Skip(ULONG ulCount);
  150. private:
  151. int m_cRef;
  152. CCandidateListEx *m_pList;
  153. int m_nCur;
  154. };
  155. #endif // CCANDLIST_H