forked from SomeSupport/eMule
-
Notifications
You must be signed in to change notification settings - Fork 97
/
CustomAutoComplete.h
66 lines (55 loc) · 1.63 KB
/
CustomAutoComplete.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//--------------------------------------------------------------------------------------------
// Author: Klaus H. Probst [[email protected]]
//
//--------------------------------------------------------------------------------------------
#pragma once
#include <initguid.h>
#include <shldisp.h>
#include <shlguid.h>
class CCustomAutoComplete :
public IEnumString
{
private:
CStringArray m_asList;
CComPtr<IAutoComplete> m_pac;
ULONG m_nCurrentElement;
ULONG m_nRefCount;
BOOL m_fBound;
int m_iMaxItemCount;
// Constructors/destructors
public:
CCustomAutoComplete();
CCustomAutoComplete(const CStringArray& p_sItemList);
~CCustomAutoComplete();
// Implementation
public:
BOOL Bind(HWND p_hWndEdit, DWORD p_dwOptions = 0, LPCTSTR p_lpszFormatString = NULL);
VOID Unbind();
BOOL IsBound() const { return m_fBound; }
BOOL SetList(const CStringArray& p_sItemList);
const CStringArray& GetList() const;
int GetItemCount();
BOOL AddItem(const CString& p_sItem, int iPos);
BOOL RemoveItem(const CString& p_sItem);
BOOL RemoveSelectedItem();
CString GetItem(int pos);
BOOL Clear();
BOOL Disable();
BOOL Enable(VOID);
BOOL LoadList(LPCTSTR pszFileName);
BOOL SaveList(LPCTSTR pszFileName);
public:
STDMETHOD_(ULONG,AddRef)();
STDMETHOD_(ULONG,Release)();
STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject);
public:
STDMETHOD(Next)(ULONG celt, LPOLESTR* rgelt, ULONG* pceltFetched);
STDMETHOD(Skip)(ULONG celt);
STDMETHOD(Reset)(void);
STDMETHOD(Clone)(IEnumString** ppenum);
// Internal implementation
private:
void InternalInit();
HRESULT EnDisable(BOOL p_fEnable);
int FindItem(const CString& rstr);
};