mshtml: Added IHTMLOptionElement::get_value implementation.

This commit is contained in:
Jacek Caban 2007-10-13 04:00:26 +02:00 committed by Alexandre Julliard
parent b14ba8aac6
commit b1fca21f5e
2 changed files with 51 additions and 2 deletions

View File

@ -39,6 +39,8 @@ typedef struct {
HTMLElement element;
const IHTMLOptionElementVtbl *lpHTMLOptionElementVtbl;
nsIDOMHTMLOptionElement *nsoption;
} HTMLOptionElement;
#define HTMLOPTION(x) ((IHTMLOptionElement*) &(x)->lpHTMLOptionElementVtbl)
@ -126,8 +128,24 @@ static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BST
static HRESULT WINAPI HTMLOptionElement_get_value(IHTMLOptionElement *iface, BSTR *p)
{
HTMLOptionElement *This = HTMLOPTION_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsAString value_str;
const PRUnichar *value;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsAString_Init(&value_str, NULL);
nsres = nsIDOMHTMLOptionElement_GetValue(This->nsoption, &value_str);
if(NS_SUCCEEDED(nsres)) {
nsAString_GetData(&value_str, &value, NULL);
*p = SysAllocString(value);
}else {
ERR("GetValue failed: %08x\n", nsres);
*p = NULL;
}
nsAString_Finish(&value_str);
return S_OK;
}
static HRESULT WINAPI HTMLOptionElement_put_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL v)
@ -232,6 +250,10 @@ static HRESULT HTMLOptionElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
static void HTMLOptionElement_destructor(HTMLDOMNode *iface)
{
HTMLOptionElement *This = HTMLOPTION_NODE_THIS(iface);
if(This->nsoption)
nsIDOMHTMLOptionElement_Release(This->nsoption);
HTMLElement_destructor(&This->element.node);
}
@ -245,10 +267,15 @@ static const NodeImplVtbl HTMLOptionElementImplVtbl = {
HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement *nselem)
{
HTMLOptionElement *ret = mshtml_alloc(sizeof(HTMLOptionElement));
nsresult nsres;
ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl;
ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLOptionElement interface: %08x\n", nsres);
return &ret->element;
}

View File

@ -1076,6 +1076,28 @@ interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
nsresult Click();
}
[
object,
uuid(a6cf9092-15b3-11d2-932e-00805f8add32)
/* FROZEN */
]
interface nsIDOMHTMLOptionElement : nsIDOMHTMLElement
{
nsresult GetForm(nsIDOMHTMLFormElement **aForm);
nsresult GetDefaultSelected(PRBool *aDefaultSelected);
nsresult SetDefaultSelected(PRBool aDefaultSelected);
nsresult GetText(nsAString *aText);
nsresult GetIndex(PRInt32 *aIndex);
nsresult GetDisabled(PRBool *aDisabled);
nsresult SetDisabled(PRBool aDisabled);
nsresult GetLabel(nsAString *aLabel);
nsresult SetLabel(const nsAString *aLabel);
nsresult GetSelected(PRBool *aSelected);
nsresult SetSelected(PRBool aSelected);
nsresult GetValue(nsAString *aValue);
nsresult SetValue(const nsAString *aValue);
}
[
object,
uuid(a6cf9090-15b3-11d2-932e-00805f8add32)