Line data Source code
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___
8 :
9 : #include "nsISupports.h"
10 :
11 : class nsIRadioVisitor;
12 : class nsIFormControl;
13 :
14 : namespace mozilla {
15 : namespace dom {
16 : class HTMLInputElement;
17 : } // namespace dom
18 : } // namespace mozilla
19 :
20 : #define NS_IRADIOGROUPCONTAINER_IID \
21 : { 0x800320a0, 0x733f, 0x11e4, \
22 : { 0x82, 0xf8, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
23 :
24 : /**
25 : * A container that has multiple radio groups in it, defined by name.
26 : */
27 55 : class nsIRadioGroupContainer : public nsISupports
28 : {
29 : public:
30 :
31 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRADIOGROUPCONTAINER_IID)
32 :
33 : /**
34 : * Walk through the radio group, visiting each note with avisitor->Visit()
35 : * @param aName the group name
36 : * @param aVisitor the visitor to visit with
37 : * @param aFlushContent whether to ensure the content model is up to date
38 : * before walking.
39 : */
40 : NS_IMETHOD WalkRadioGroup(const nsAString& aName,
41 : nsIRadioVisitor* aVisitor,
42 : bool aFlushContent) = 0;
43 :
44 : /**
45 : * Set the current radio button in a group
46 : * @param aName the group name
47 : * @param aRadio the currently selected radio button
48 : */
49 : virtual void SetCurrentRadioButton(const nsAString& aName,
50 : mozilla::dom::HTMLInputElement* aRadio) = 0;
51 :
52 : /**
53 : * Get the current radio button in a group
54 : * @param aName the group name
55 : * @return the currently selected radio button
56 : */
57 : virtual mozilla::dom::HTMLInputElement* GetCurrentRadioButton(const nsAString& aName) = 0;
58 :
59 : /**
60 : * Get the next/prev radio button in a group
61 : * @param aName the group name
62 : * @param aPrevious, true gets previous radio button, false gets next
63 : * @param aFocusedRadio the currently focused radio button
64 : * @param aRadio the currently selected radio button [OUT]
65 : */
66 : NS_IMETHOD GetNextRadioButton(const nsAString& aName,
67 : const bool aPrevious,
68 : mozilla::dom::HTMLInputElement* aFocusedRadio,
69 : mozilla::dom::HTMLInputElement** aRadio) = 0;
70 :
71 : /**
72 : * Add radio button to radio group
73 : *
74 : * Note that forms do not do anything for this method since they already
75 : * store radio groups on their own.
76 : *
77 : * @param aName radio group's name
78 : * @param aRadio radio button's pointer
79 : */
80 : virtual void AddToRadioGroup(const nsAString& aName, nsIFormControl* aRadio) = 0;
81 :
82 : /**
83 : * Remove radio button from radio group
84 : *
85 : * Note that forms do not do anything for this method since they already
86 : * store radio groups on their own.
87 : *
88 : * @param aName radio group's name
89 : * @param aRadio radio button's pointer
90 : */
91 : virtual void RemoveFromRadioGroup(const nsAString& aName, nsIFormControl* aRadio) = 0;
92 :
93 : virtual uint32_t GetRequiredRadioCount(const nsAString& aName) const = 0;
94 : virtual void RadioRequiredWillChange(const nsAString& aName,
95 : bool aRequiredAdded) = 0;
96 : virtual bool GetValueMissingState(const nsAString& aName) const = 0;
97 : virtual void SetValueMissingState(const nsAString& aName, bool aValue) = 0;
98 : };
99 :
100 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIRadioGroupContainer,
101 : NS_IRADIOGROUPCONTAINER_IID)
102 :
103 : #endif /* nsIRadioGroupContainer_h__ */
|