foobar2000 SDK  2015-08-03
Functions
AutoComplete.h File Reference

Go to the source code of this file.

Functions

pfc::com_ptr_t< IUnknown > CreateACList (pfc::const_iterator< pfc::string8 > valueEnum)
 
pfc::com_ptr_t< IUnknown > CreateACList (pfc::const_iterator< const char * > valueEnum)
 
pfc::com_ptr_t< IUnknown > CreateACList (pfc::const_iterator< pfc::string > valueEnum)
 
pfc::com_ptr_t< IUnknown > CreateACList ()
 
void CreateACList_AddItem (IUnknown *theList, const char *item)
 
HRESULT InitializeDropdownAC (HWND comboBox, cfg_dropdown_history_mt &var, const char *initVal)
 
HRESULT InitializeEditAC (HWND edit, const char *values, DWORD opts=ACO_AUTOAPPEND|ACO_AUTOSUGGEST)
 
HRESULT InitializeEditAC (HWND edit, pfc::const_iterator< pfc::string8 > valueEnum, DWORD opts=ACO_AUTOAPPEND|ACO_AUTOSUGGEST)
 
HRESULT InitializeSimpleAC (HWND edit, IUnknown *vals, DWORD opts)
 

Function Documentation

pfc::com_ptr_t<IUnknown> CreateACList ( pfc::const_iterator< pfc::string8 valueEnum)

Definition at line 126 of file AutoComplete.cpp.

126  {
128  while(valueEnum.is_valid()) {
129  acl->AddStringU(*valueEnum); ++valueEnum;
130  }
131  return acl;
132 }
bool is_valid() const
Definition: iterators.h:24
Simple implementation of a COM reference counter. The initial reference count is zero, so it can be used with pfc::com_ptr_t<> with plain operator=/constructor rather than attach().
Definition: win-objects.h:250
pfc::com_ptr_t<IUnknown> CreateACList ( pfc::const_iterator< const char * >  valueEnum)

Definition at line 133 of file AutoComplete.cpp.

133  {
135  while(valueEnum.is_valid()) {
136  acl->AddStringU(*valueEnum); ++valueEnum;
137  }
138  return acl;
139 }
bool is_valid() const
Definition: iterators.h:24
Simple implementation of a COM reference counter. The initial reference count is zero, so it can be used with pfc::com_ptr_t<> with plain operator=/constructor rather than attach().
Definition: win-objects.h:250
pfc::com_ptr_t<IUnknown> CreateACList ( pfc::const_iterator< pfc::string valueEnum)

Definition at line 140 of file AutoComplete.cpp.

140  {
142  while(valueEnum.is_valid()) {
143  acl->AddStringU(valueEnum->ptr()); ++valueEnum;
144  }
145  return acl;
146 }
bool is_valid() const
Definition: iterators.h:24
const char * ptr() const
Definition: stringNew.h:124
Simple implementation of a COM reference counter. The initial reference count is zero, so it can be used with pfc::com_ptr_t<> with plain operator=/constructor rather than attach().
Definition: win-objects.h:250
pfc::com_ptr_t<IUnknown> CreateACList ( )

Definition at line 148 of file AutoComplete.cpp.

148  {
149  return new CEnumString::TImpl();
150 }
Simple implementation of a COM reference counter. The initial reference count is zero, so it can be used with pfc::com_ptr_t<> with plain operator=/constructor rather than attach().
Definition: win-objects.h:250
void CreateACList_AddItem ( IUnknown *  theList,
const char *  item 
)

Definition at line 152 of file AutoComplete.cpp.

152  {
153  static_cast<CEnumString*>(theList)->AddStringU( item );
154 }
HRESULT InitializeDropdownAC ( HWND  comboBox,
cfg_dropdown_history_mt var,
const char *  initVal 
)

Definition at line 171 of file AutoComplete.cpp.

171  {
172  var.on_init(comboBox, initVal);
173  COMBOBOXINFO ci = {}; ci.cbSize = sizeof(ci);
174  if (!GetComboBoxInfo(comboBox, &ci)) {
175  PFC_ASSERT(!"Should not get here - GetComboBoxInfo fail!");
176  return E_FAIL;
177  }
179  return InitializeSimpleAC(ci.hwndItem, acl.get_ptr(), ACO_AUTOAPPEND|ACO_AUTOSUGGEST);
180 }
T * get_ptr() const
Definition: com_ptr_t.h:49
Simple implementation of a COM reference counter. The initial reference count is zero, so it can be used with pfc::com_ptr_t<> with plain operator=/constructor rather than attach().
Definition: win-objects.h:250
HRESULT InitializeSimpleAC(HWND edit, IUnknown *vals, DWORD opts)
void on_init(HWND ctrl, const char *initVal)
HRESULT InitializeEditAC ( HWND  edit,
const char *  values,
DWORD  opts = ACO_AUTOAPPEND|ACO_AUTOSUGGEST 
)

Definition at line 160 of file AutoComplete.cpp.

160  {
162  for(const char * walk = values;;) {
163  const char * next = strchr(walk, cfg_dropdown_history_mt::separator);
164  if (next == NULL) {acl->AddStringU(walk, ~0); break;}
165  acl->AddStringU(walk, next - walk);
166  walk = next + 1;
167  }
168  return InitializeSimpleAC(edit, acl.get_ptr(), opts);
169 }
T * get_ptr() const
Definition: com_ptr_t.h:49
Simple implementation of a COM reference counter. The initial reference count is zero, so it can be used with pfc::com_ptr_t<> with plain operator=/constructor rather than attach().
Definition: win-objects.h:250
HRESULT InitializeSimpleAC(HWND edit, IUnknown *vals, DWORD opts)
HRESULT InitializeEditAC ( HWND  edit,
pfc::const_iterator< pfc::string8 valueEnum,
DWORD  opts = ACO_AUTOAPPEND|ACO_AUTOSUGGEST 
)

Definition at line 156 of file AutoComplete.cpp.

156  {
157  pfc::com_ptr_t<IUnknown> acl = CreateACList(valueEnum);
158  return InitializeSimpleAC(edit, acl.get_ptr(), opts);
159 }
T * get_ptr() const
Definition: com_ptr_t.h:49
pfc::com_ptr_t< IUnknown > CreateACList(pfc::const_iterator< pfc::string8 > valueEnum)
HRESULT InitializeSimpleAC(HWND edit, IUnknown *vals, DWORD opts)
HRESULT InitializeSimpleAC ( HWND  edit,
IUnknown *  vals,
DWORD  opts 
)

Definition at line 102 of file AutoComplete.cpp.

102  {
104  HRESULT hr;
105  hr = CoCreateInstance(CLSID_AutoComplete, NULL, CLSCTX_ALL, IID_IAutoComplete, (void**)ac.receive_ptr());
106  if (FAILED(hr)) {
107  PFC_ASSERT(!"Should not get here - CoCreateInstance/IAutoComplete fail!"); return hr;
108  }
109  hr = ac->Init(edit, vals, NULL, NULL);
110  if (FAILED(hr)) {
111  PFC_ASSERT(!"Should not get here - ac->Init fail!"); return hr;
112  }
113 
115  hr = ac->QueryInterface( ac2.receive_ptr() );
116  if (FAILED(hr)) {
117  PFC_ASSERT(!"Should not get here - ac->QueryInterface fail!"); return hr;
118  }
119  hr = ac2->SetOptions(opts);
120  if (FAILED(hr)) {
121  PFC_ASSERT(!"Should not get here - ac2->SetOptions fail!"); return hr;
122  }
123  return S_OK;
124 }
T ** receive_ptr()
Definition: com_ptr_t.h:73