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.

185 lines
3.3 KiB

  1. //
  2. // candfunc.h
  3. //
  4. #ifndef CANDFUNC_H
  5. #define CANDFUNC_H
  6. #include "private.h"
  7. #include "globals.h"
  8. #include "mscandui.h"
  9. #include "candmgr.h"
  10. class CCandidateUI;
  11. //
  12. //
  13. //
  14. typedef enum _CANDSORT
  15. {
  16. CANDSORT_NONE = 0,
  17. CANDSORT_ASCENDING = 1,
  18. CANDSORT_DESCENDING = 2,
  19. } CANDSORT;
  20. //
  21. // CCandFnAutoFilter
  22. // = candidate list filtering function =
  23. //
  24. class CCandFnAutoFilter : public CCandListEventSink
  25. {
  26. public:
  27. CCandFnAutoFilter( CCandidateUI *pCandUI );
  28. virtual ~CCandFnAutoFilter( void );
  29. //
  30. // CCandListEventSink
  31. //
  32. virtual void OnSetCandidateList( void );
  33. virtual void OnClearCandidateList( void );
  34. virtual void OnCandItemUpdate( void );
  35. virtual void OnSelectionChanged( void );
  36. HRESULT Enable( BOOL fEnable );
  37. HRESULT GetFilteringResult( CANDUIFILTERSTR strtype, BSTR *pbstr );
  38. BOOL IsEnabled( void );
  39. void SetFilterString( LPCWSTR psz );
  40. LPCWSTR GetFilterString( void );
  41. void ClearFilterString( void );
  42. int FilterCandidateList( void );
  43. BOOL FExistItemMatches( LPCWSTR psz );
  44. //
  45. // EventSink functions
  46. //
  47. void SetEventSink( ITfCandUIAutoFilterEventSink *pSink )
  48. {
  49. SafeReleaseClear( m_pSink );
  50. m_pSink = pSink;
  51. m_pSink->AddRef();
  52. }
  53. ITfCandUIAutoFilterEventSink *GetEventSink( void )
  54. {
  55. return m_pSink;
  56. }
  57. void ReleaseEventSink( void )
  58. {
  59. SafeReleaseClear( m_pSink );
  60. }
  61. //
  62. // interface object functions
  63. //
  64. HRESULT CreateInterfaceObject( REFIID riid, void **ppvObj );
  65. protected:
  66. CCandidateUI *m_pCandUI;
  67. BOOL m_fEnable;
  68. BSTR m_bstrFilter;
  69. ITfCandUIAutoFilterEventSink *m_pSink;
  70. };
  71. //
  72. // CCandListSort
  73. // = candidate list sort function =
  74. //
  75. class CCandFnSort : public CCandListEventSink
  76. {
  77. public:
  78. CCandFnSort( CCandidateUI *pCandUI );
  79. virtual ~CCandFnSort( void );
  80. //
  81. // CCandListEventSink
  82. //
  83. virtual void OnSetCandidateList( void );
  84. virtual void OnClearCandidateList( void );
  85. virtual void OnCandItemUpdate( void );
  86. virtual void OnSelectionChanged( void );
  87. HRESULT SortCandidateList( CANDSORT type );
  88. HRESULT GetSortType( CANDSORT *ptype );
  89. //
  90. // EventSink functions
  91. //
  92. void SetEventSink( ITfCandUISortEventSink *pSink )
  93. {
  94. SafeReleaseClear( m_pSink );
  95. m_pSink = pSink;
  96. m_pSink->AddRef();
  97. }
  98. ITfCandUISortEventSink *GetEventSink( void )
  99. {
  100. return m_pSink;
  101. }
  102. void ReleaseEventSink( void )
  103. {
  104. SafeReleaseClear( m_pSink );
  105. }
  106. //
  107. // interface object functions
  108. //
  109. HRESULT CreateInterfaceObject( REFIID riid, void **ppvObj );
  110. protected:
  111. CCandidateUI *m_pCandUI;
  112. CANDSORT m_SortType;
  113. ITfCandUISortEventSink *m_pSink;
  114. void SortProc( int iItemFirst, int iItemLast );
  115. };
  116. //
  117. // CCandUIFunctionMgr
  118. // = candidate UI function manager =
  119. //
  120. class CCandUIFunctionMgr
  121. {
  122. public:
  123. CCandUIFunctionMgr( void );
  124. virtual ~CCandUIFunctionMgr( void );
  125. HRESULT Initialize( CCandidateUI *pCandUI );
  126. HRESULT Uninitialize( void );
  127. __inline CCandFnAutoFilter *GetCandFnAutoFilter( void )
  128. {
  129. return m_pFnAutoFilter;
  130. }
  131. __inline CCandFnSort *GetCandFnSort( void )
  132. {
  133. return m_pFnSort;
  134. }
  135. //
  136. //
  137. //
  138. HRESULT GetObject( REFIID riid, void **ppvObj );
  139. protected:
  140. CCandidateUI *m_pCandUI;
  141. CCandFnAutoFilter *m_pFnAutoFilter;
  142. CCandFnSort *m_pFnSort;
  143. };
  144. #endif // CANDFUNC_H