1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsIRadioGroupContainer_h___
7 #define nsIRadioGroupContainer_h___
9 #include "nsISupports.h"
11 class nsIRadioVisitor
;
14 namespace mozilla::dom
{
15 class HTMLInputElement
;
16 } // namespace mozilla::dom
18 #define NS_IRADIOGROUPCONTAINER_IID \
20 0x800320a0, 0x733f, 0x11e4, { \
21 0x82, 0xf8, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 \
26 * A container that has multiple radio groups in it, defined by name.
28 class nsIRadioGroupContainer
: public nsISupports
{
30 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRADIOGROUPCONTAINER_IID
)
33 * Walk through the radio group, visiting each note with avisitor->Visit()
34 * @param aName the group name
35 * @param aVisitor the visitor to visit with
37 NS_IMETHOD
WalkRadioGroup(const nsAString
& aName
,
38 nsIRadioVisitor
* aVisitor
) = 0;
41 * Set the current radio button in a group
42 * @param aName the group name
43 * @param aRadio the currently selected radio button
45 virtual void SetCurrentRadioButton(
46 const nsAString
& aName
, mozilla::dom::HTMLInputElement
* aRadio
) = 0;
49 * Get the current radio button in a group
50 * @param aName the group name
51 * @return the currently selected radio button
53 virtual mozilla::dom::HTMLInputElement
* GetCurrentRadioButton(
54 const nsAString
& aName
) = 0;
57 * Get the next/prev radio button in a group
58 * @param aName the group name
59 * @param aPrevious, true gets previous radio button, false gets next
60 * @param aFocusedRadio the currently focused radio button
61 * @param aRadio the currently selected radio button [OUT]
63 NS_IMETHOD
GetNextRadioButton(const nsAString
& aName
, const bool aPrevious
,
64 mozilla::dom::HTMLInputElement
* aFocusedRadio
,
65 mozilla::dom::HTMLInputElement
** aRadio
) = 0;
68 * Add radio button to radio group
70 * Note that forms do not do anything for this method since they already
71 * store radio groups on their own.
73 * @param aName radio group's name
74 * @param aRadio radio button's pointer
76 virtual void AddToRadioGroup(const nsAString
& aName
,
77 mozilla::dom::HTMLInputElement
* aRadio
) = 0;
80 * Remove radio button from radio group
82 * Note that forms do not do anything for this method since they already
83 * store radio groups on their own.
85 * @param aName radio group's name
86 * @param aRadio radio button's pointer
88 virtual void RemoveFromRadioGroup(const nsAString
& aName
,
89 mozilla::dom::HTMLInputElement
* aRadio
) = 0;
91 virtual uint32_t GetRequiredRadioCount(const nsAString
& aName
) const = 0;
92 virtual void RadioRequiredWillChange(const nsAString
& aName
,
93 bool aRequiredAdded
) = 0;
94 virtual bool GetValueMissingState(const nsAString
& aName
) const = 0;
95 virtual void SetValueMissingState(const nsAString
& aName
, bool aValue
) = 0;
98 NS_DEFINE_STATIC_IID_ACCESSOR(nsIRadioGroupContainer
,
99 NS_IRADIOGROUPCONTAINER_IID
)
101 #endif /* nsIRadioGroupContainer_h__ */