1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 : #ifndef nsIRadioGroupContainer_h___
38 : #define nsIRadioGroupContainer_h___
39 :
40 : #include "nsISupports.h"
41 :
42 : class nsIDOMHTMLInputElement;
43 : class nsString;
44 : class nsIRadioVisitor;
45 : class nsIFormControl;
46 :
47 : #define NS_IRADIOGROUPCONTAINER_IID \
48 : { 0x22924a01, 0x4360, 0x401b, \
49 : { 0xb1, 0xd1, 0x56, 0x8d, 0xf5, 0xa3, 0xda, 0x71 } }
50 :
51 : /**
52 : * A container that has multiple radio groups in it, defined by name.
53 : */
54 : class nsIRadioGroupContainer : public nsISupports
55 1273 : {
56 : public:
57 :
58 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRADIOGROUPCONTAINER_IID)
59 :
60 : /**
61 : * Walk through the radio group, visiting each note with avisitor->Visit()
62 : * @param aName the group name
63 : * @param aVisitor the visitor to visit with
64 : * @param aFlushContent whether to ensure the content model is up to date
65 : * before walking.
66 : */
67 : NS_IMETHOD WalkRadioGroup(const nsAString& aName,
68 : nsIRadioVisitor* aVisitor,
69 : bool aFlushContent) = 0;
70 :
71 : /**
72 : * Set the current radio button in a group
73 : * @param aName the group name
74 : * @param aRadio the currently selected radio button
75 : */
76 : NS_IMETHOD SetCurrentRadioButton(const nsAString& aName,
77 : nsIDOMHTMLInputElement* aRadio) = 0;
78 :
79 : /**
80 : * Get the current radio button in a group
81 : * @param aName the group name
82 : * @param aRadio the currently selected radio button [OUT]
83 : */
84 : NS_IMETHOD GetCurrentRadioButton(const nsAString& aName,
85 : nsIDOMHTMLInputElement** aRadio) = 0;
86 :
87 : /**
88 : * Get the next/prev radio button in a group
89 : * @param aName the group name
90 : * @param aPrevious, true gets previous radio button, false gets next
91 : * @param aFocusedRadio the currently focused radio button
92 : * @param aRadio the currently selected radio button [OUT]
93 : */
94 : NS_IMETHOD GetNextRadioButton(const nsAString& aName,
95 : const bool aPrevious,
96 : nsIDOMHTMLInputElement* aFocusedRadio,
97 : nsIDOMHTMLInputElement** aRadio) = 0;
98 :
99 : /**
100 : * Add radio button to radio group
101 : *
102 : * Note that forms do not do anything for this method since they already
103 : * store radio groups on their own.
104 : *
105 : * @param aName radio group's name
106 : * @param aRadio radio button's pointer
107 : */
108 : NS_IMETHOD AddToRadioGroup(const nsAString& aName,
109 : nsIFormControl* aRadio) = 0;
110 :
111 : /**
112 : * Remove radio button from radio group
113 : *
114 : * Note that forms do not do anything for this method since they already
115 : * store radio groups on their own.
116 : *
117 : * @param aName radio group's name
118 : * @param aRadio radio button's pointer
119 : */
120 : NS_IMETHOD RemoveFromRadioGroup(const nsAString& aName,
121 : nsIFormControl* aRadio) = 0;
122 :
123 : /**
124 : * Get the radio group position and the number of radio buttons in the group.
125 : * that the radio button is in. If the radio button not grouped with any other
126 : * radio buttons this method will treat it as being in a group of one.
127 : * @param aRadio radio button's pointer
128 : * @param aPositionIndex out indicates 0-indexed position in the radio group,
129 : * or just 0 if a group cannot be found
130 : * @param aItemsInGroup the number of radio buttons in the group
131 : */
132 : NS_IMETHOD GetPositionInGroup(nsIDOMHTMLInputElement *aRadio,
133 : PRInt32 *aPositionIndex,
134 : PRInt32 *aItemsInGroup) = 0;
135 :
136 : virtual PRUint32 GetRequiredRadioCount(const nsAString& aName) const = 0;
137 : virtual void RadioRequiredChanged(const nsAString& aName,
138 : nsIFormControl* aRadio) = 0;
139 : virtual bool GetValueMissingState(const nsAString& aName) const = 0;
140 : virtual void SetValueMissingState(const nsAString& aName, bool aValue) = 0;
141 : };
142 :
143 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIRadioGroupContainer,
144 : NS_IRADIOGROUPCONTAINER_IID)
145 :
146 : #endif /* nsIRadioGroupContainer_h__ */
|