/************************************************************************** * IAutoComplete2_fnSetOptions */ static HRESULT WINAPI IAutoComplete2_fnSetOptions( IAutoComplete2 * iface, DWORD dwFlag) { HRESULT hr = S_OK; IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface; TRACE("(%p) -> (0x%x)\n", This, dwFlag); This->options = dwFlag; if ((This->options & ACO_AUTOSUGGEST) && This->hwndEdit && !This->hwndListBox) create_listbox(This); return hr; }
/****************************************************************************** * IAutoComplete2_fnInit */ static HRESULT WINAPI IAutoComplete2_fnInit( IAutoComplete2 * iface, HWND hwndEdit, IUnknown *punkACL, LPCOLESTR pwzsRegKeyPath, LPCOLESTR pwszQuickComplete) { IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface; TRACE("(%p)->(%p, %p, %s, %s)\n", This, hwndEdit, punkACL, debugstr_w(pwzsRegKeyPath), debugstr_w(pwszQuickComplete)); if (This->options & ACO_SEARCH) FIXME(" ACO_SEARCH not supported\n"); if (This->options & ACO_FILTERPREFIXES) FIXME(" ACO_FILTERPREFIXES not supported\n"); if (This->options & ACO_USETAB) FIXME(" ACO_USETAB not supported\n"); if (This->options & ACO_RTLREADING) FIXME(" ACO_RTLREADING not supported\n"); if (!hwndEdit || !punkACL) return E_INVALIDARG; if (This->initialized) { WARN("Autocompletion object is already initialized\n"); /* This->hwndEdit is set to NULL when the edit window is destroyed. */ return This->hwndEdit ? E_FAIL : E_UNEXPECTED; } if (FAILED (IUnknown_QueryInterface (punkACL, &IID_IEnumString, (LPVOID*)&This->enumstr))) { WARN("No IEnumString interface\n"); return E_NOINTERFACE; } This->initialized = TRUE; This->hwndEdit = hwndEdit; This->wpOrigEditProc = (WNDPROC) SetWindowLongPtrW( hwndEdit, GWLP_WNDPROC, (LONG_PTR) ACEditSubclassProc); /* Keep at least one reference to the object until the edit window is destroyed. */ IAutoComplete2_AddRef((IAutoComplete2 *)This); SetPropW( hwndEdit, autocomplete_propertyW, This ); if (This->options & ACO_AUTOSUGGEST) create_listbox(This); if (pwzsRegKeyPath) { WCHAR *key; WCHAR result[MAX_PATH]; WCHAR *value; HKEY hKey = 0; LONG res; LONG len; /* pwszRegKeyPath contains the key as well as the value, so we split */ key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwzsRegKeyPath)+1)*sizeof(WCHAR)); strcpyW(key, pwzsRegKeyPath); value = strrchrW(key, '\\'); *value = 0; value++; /* Now value contains the value and buffer the key */ res = RegOpenKeyExW(HKEY_CURRENT_USER, key, 0, KEY_READ, &hKey); if (res != ERROR_SUCCESS) { /* if the key is not found, MSDN states we must seek in HKEY_LOCAL_MACHINE */ res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hKey); } if (res == ERROR_SUCCESS) { res = RegQueryValueW(hKey, value, result, &len); if (res == ERROR_SUCCESS) { This->quickComplete = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR)); strcpyW(This->quickComplete, result); } RegCloseKey(hKey); } HeapFree(GetProcessHeap(), 0, key); } if ((pwszQuickComplete) && (!This->quickComplete)) { This->quickComplete = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwszQuickComplete)+1)*sizeof(WCHAR)); lstrcpyW(This->quickComplete, pwszQuickComplete); } return S_OK; }
int BC_FileBox::create_objects() { int x = 10, y = 10; BC_Resources *resources = BC_WindowBase::get_resources(); int directory_title_margin = MAX(20, resources->filebox_text_images[0]->get_h()); // Create recent dir list create_history(); // Directories aren't filtered in FileSystem so skip this if(!want_directory) { filter_list.append(new BC_ListBoxItem("*")); filter_list.append(new BC_ListBoxItem("[*.ifo][*.vob]")); filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]")); filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]")); filter_list.append(new BC_ListBoxItem("heroine*")); filter_list.append(new BC_ListBoxItem("*.xml")); fs->set_filter(get_resources()->filebox_filter); } fs->update(directory); create_icons(); create_tables(); add_subwindow(ok_button = new BC_FileBoxOK(this)); if(want_directory) add_subwindow(usethis_button = new BC_FileBoxUseThis(this)); add_subwindow(cancel_button = new BC_FileBoxCancel(this)); add_subwindow(new BC_Title(x, y, caption)); x = get_w() - resources->filebox_icons_images[0]->get_w() - 10; add_subwindow(icon_button = new BC_FileBoxIcons(x, y, this)); x -= resources->filebox_text_images[0]->get_w() + 5; add_subwindow(text_button = new BC_FileBoxText(x, y, this)); x -= resources->filebox_newfolder_images[0]->get_w() + 5; add_subwindow(folder_button = new BC_FileBoxNewfolder(x, y, this)); x -= resources->filebox_delete_images[0]->get_w() + 5; add_subwindow(delete_button = new BC_FileBoxDelete(x, y, this)); x -= resources->filebox_reload_images[0]->get_w() + 5; add_subwindow(reload_button = new BC_FileBoxReload(x, y, this)); x -= resources->filebox_updir_images[0]->get_w() + 5; add_subwindow(updir_button = new BC_FileBoxUpdir(x, y, this)); x = 10; y += directory_title_margin + 3; add_subwindow(recent_popup = new BC_FileBoxRecent(this, x, y)); add_subwindow(directory_title = new BC_FileBoxDirectoryText(x, y, this)); directory_title->reposition_window( x, y, get_w() - recent_popup->get_w() - 20, 1); recent_popup->reposition_window( x + directory_title->get_w(), y, directory_title->get_w(), 200); x = 10; y += directory_title->get_h() + 5; listbox = 0; create_listbox(x, y, get_display_mode()); y += listbox->get_h() + 10; add_subwindow(textbox = new BC_FileBoxTextBox(x, y, this)); y += textbox->get_h() + 10; if(!want_directory) { add_subwindow(filter_text = new BC_FileBoxFilterText(x, y, this)); add_subwindow(filter_popup = new BC_FileBoxFilterMenu(x + filter_text->get_w(), y, this));; } // listbox has to be active because refresh might be called from newfolder_thread listbox->activate(); newfolder_thread = new BC_NewFolderThread(this); show_window(); return 0; }