static HRESULT WINAPI HTMLOptionElement_QueryInterface(IHTMLOptionElement *iface, REFIID riid, void **ppv) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); }
static HRESULT WINAPI HTMLOptionElement_GetTypeInfo(IHTMLOptionElement *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); }
static HRESULT WINAPI HTMLOptionElement_Invoke(IHTMLOptionElement *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); }
static HRESULT WINAPI HTMLOptionElement_GetIDsOfNames(IHTMLOptionElement *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames, cNames, lcid, rgDispId); }
static HRESULT WINAPI HTMLOptionElement_get_text(IHTMLOptionElement *iface, BSTR *p) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); nsAString text_str; nsresult nsres; TRACE("(%p)->(%p)\n", This, p); nsAString_Init(&text_str, NULL); nsres = nsIDOMHTMLOptionElement_GetText(This->nsoption, &text_str); return return_nsstr(nsres, &text_str, p); }
static HRESULT WINAPI HTMLOptionElement_put_selected(IHTMLOptionElement *iface, VARIANT_BOOL v) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); nsresult nsres; TRACE("(%p)->(%x)\n", This, v); nsres = nsIDOMHTMLOptionElement_SetSelected(This->nsoption, v != VARIANT_FALSE); if(NS_FAILED(nsres)) { ERR("SetSelected failed: %08x\n", nsres); return E_FAIL; } return S_OK; }
static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); nsIDOMText *text_node; nsAString text_str; nsIDOMNode *tmp; nsresult nsres; TRACE("(%p)->(%s)\n", This, debugstr_w(v)); if(!This->element.node.doc->nsdoc) { WARN("NULL nsdoc\n"); return E_UNEXPECTED; } while(1) { nsIDOMNode *child; nsres = nsIDOMHTMLOptionElement_GetFirstChild(This->nsoption, &child); if(NS_FAILED(nsres) || !child) break; nsres = nsIDOMHTMLOptionElement_RemoveChild(This->nsoption, child, &tmp); nsIDOMNode_Release(child); if(NS_SUCCEEDED(nsres)) { nsIDOMNode_Release(tmp); }else { ERR("RemoveChild failed: %08x\n", nsres); break; } } nsAString_InitDepend(&text_str, v); nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node); nsAString_Finish(&text_str); if(NS_FAILED(nsres)) { ERR("CreateTextNode failed: %08x\n", nsres); return E_FAIL; } nsres = nsIDOMHTMLOptionElement_AppendChild(This->nsoption, (nsIDOMNode*)text_node, &tmp); if(NS_SUCCEEDED(nsres)) nsIDOMNode_Release(tmp); else ERR("AppendChild failed: %08x\n", nsres); return S_OK; }
static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BSTR v) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); nsAString value_str; nsresult nsres; TRACE("(%p)->(%s)\n", This, debugstr_w(v)); nsAString_InitDepend(&value_str, v); nsres = nsIDOMHTMLOptionElement_SetValue(This->nsoption, &value_str); nsAString_Finish(&value_str); if(NS_FAILED(nsres)) ERR("SetValue failed: %08x\n", nsres); return S_OK; }
static HRESULT WINAPI HTMLOptionElement_get_selected(IHTMLOptionElement *iface, VARIANT_BOOL *p) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); cpp_bool selected; nsresult nsres; TRACE("(%p)->(%p)\n", This, p); nsres = nsIDOMHTMLOptionElement_GetSelected(This->nsoption, &selected); if(NS_FAILED(nsres)) { ERR("GetSelected failed: %08x\n", nsres); return E_FAIL; } *p = selected ? VARIANT_TRUE : VARIANT_FALSE; return S_OK; }
static HRESULT WINAPI HTMLOptionElement_get_text(IHTMLOptionElement *iface, BSTR *p) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); nsAString text_str; const PRUnichar *text; nsresult nsres; TRACE("(%p)->(%p)\n", This, p); nsAString_Init(&text_str, NULL); nsres = nsIDOMHTMLOptionElement_GetText(This->nsoption, &text_str); if(NS_SUCCEEDED(nsres)) { nsAString_GetData(&text_str, &text); *p = SysAllocString(text); }else { ERR("GetText failed: %08x\n", nsres); *p = NULL; } nsAString_Finish(&text_str); return S_OK; }
static HRESULT WINAPI HTMLOptionElement_GetTypeInfoCount(IHTMLOptionElement *iface, UINT *pctinfo) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo); }
static ULONG WINAPI HTMLOptionElement_Release(IHTMLOptionElement *iface) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface); }
static HRESULT WINAPI HTMLOptionElement_get_form(IHTMLOptionElement *iface, IHTMLFormElement **p) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; }
static HRESULT WINAPI HTMLOptionElement_put_index(IHTMLOptionElement *iface, LONG v) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); FIXME("(%p)->(%d)\n", This, v); return E_NOTIMPL; }
static HRESULT WINAPI HTMLOptionElement_get_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL *p) { HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface); FIXME("(%p)->(%p)\n", This, p); return E_NOTIMPL; }