[XForms] Expose switch-state to script. Bug 332127, r=aaronr+doronr

This commit is contained in:
allan%beaufour.dk 2006-04-06 08:12:46 +00:00
Родитель 79060aff34
Коммит 3e4469d997
2 изменённых файлов: 25 добавлений и 5 удалений

Просмотреть файл

@ -43,16 +43,21 @@ interface nsIDOMElement;
/**
* Interface implemented by the switch element.
*/
[uuid(edeb1e48-5d5c-4091-8021-5975310caa66)]
[scriptable, uuid(42af102c-4c96-4534-9ea7-20a23fddbf60)]
interface nsIXFormsSwitchElement : nsISupports
{
/**
* Used by case elements to select or deselect themselves.
* Select or deselect a given case element.
*
* @param aCase The case element
* @param aValue The value of the selected attribute.
* @param caseEl The case element
* @param value Select (true) or deselect (false)
*/
void setSelected(in nsIDOMElement aCase, in boolean aValue);
void setSelected(in nsIDOMElement caseEl, in boolean value);
/**
* Retrieve the currently selected case element.
*/
readonly attribute nsIDOMElement selected;
};

Просмотреть файл

@ -232,6 +232,17 @@ nsXFormsSwitchElement::FindFirstSelectedCase(nsIDOMElement* aDeselected)
return result;
}
// nsIXFormsSwitchElement
NS_IMETHODIMP
nsXFormsSwitchElement::GetSelected(nsIDOMElement **aCase)
{
NS_ENSURE_ARG_POINTER(aCase);
NS_IF_ADDREF(*aCase = mSelected);
return NS_OK;
}
NS_IMETHODIMP
nsXFormsSwitchElement::SetSelected(nsIDOMElement *aCase, PRBool aValue)
{
@ -292,6 +303,8 @@ nsXFormsSwitchElement::SetSelected(nsIDOMElement *aCase, PRBool aValue)
return NS_OK;
}
// nsXFormsSwitchElement
void
nsXFormsSwitchElement::SetFocus(nsIDOMElement* aDeselected,
nsIDOMElement* aSelected)
@ -380,6 +393,8 @@ nsXFormsSwitchElement::CaseChanged(nsIDOMNode* aCase, PRBool aRemoved)
}
}
// nsIXFormsControl
NS_IMETHODIMP
nsXFormsSwitchElement::IsEventTarget(PRBool *aOK)
{