mshtml: Added IHTMLButtonElement::disabled implementation.
authorJacek Caban <jacek@codeweavers.com>
Wed, 27 Mar 2013 12:12:39 +0000 (13:12 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 27 Mar 2013 19:12:30 +0000 (20:12 +0100)
dlls/mshtml/htmlinput.c

index d6bd394..4d304b2 100644 (file)
@@ -1552,15 +1552,35 @@ static HRESULT WINAPI HTMLButtonElement_get_status(IHTMLButtonElement *iface, VA
 static HRESULT WINAPI HTMLButtonElement_put_disabled(IHTMLButtonElement *iface, VARIANT_BOOL v)
 {
     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
-    FIXME("(%p)->(%x)\n", This, v);
-    return E_NOTIMPL;
+    nsresult nsres;
+
+    TRACE("(%p)->(%x)\n", This, v);
+
+    nsres = nsIDOMHTMLButtonElement_SetDisabled(This->nsbutton, !!v);
+    if(NS_FAILED(nsres)) {
+        ERR("SetDisabled failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLButtonElement_get_disabled(IHTMLButtonElement *iface, VARIANT_BOOL *p)
 {
     HTMLButtonElement *This = impl_from_IHTMLButtonElement(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    cpp_bool disabled;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMHTMLButtonElement_GetDisabled(This->nsbutton, &disabled);
+    if(NS_FAILED(nsres)) {
+        ERR("GetDisabled failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    *p = disabled ? VARIANT_TRUE : VARIANT_FALSE;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLButtonElement_get_form(IHTMLButtonElement *iface, IHTMLFormElement **p)
@@ -1623,6 +1643,18 @@ static HRESULT HTMLButtonElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
     return S_OK;
 }
 
+static HRESULT HTMLButtonElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
+{
+    HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
+    return IHTMLButtonElement_put_disabled(&This->IHTMLButtonElement_iface, v);
+}
+
+static HRESULT HTMLButtonElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOOL *p)
+{
+    HTMLButtonElement *This = button_from_HTMLDOMNode(iface);
+    return IHTMLButtonElement_get_disabled(&This->IHTMLButtonElement_iface, p);
+}
+
 static const NodeImplVtbl HTMLButtonElementImplVtbl = {
     HTMLButtonElement_QI,
     HTMLElement_destructor,
@@ -1630,6 +1662,10 @@ static const NodeImplVtbl HTMLButtonElementImplVtbl = {
     HTMLElement_clone,
     HTMLElement_handle_event,
     HTMLElement_get_attr_col,
+    NULL,
+    NULL,
+    HTMLButtonElementImpl_put_disabled,
+    HTMLButtonElementImpl_get_disabled
 };
 
 static const tid_t HTMLButtonElement_iface_tids[] = {