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/. */
7 #ifndef mozilla_dom_nsRadioGroupStruct_h
8 #define mozilla_dom_nsRadioGroupStruct_h
10 #include "nsCOMArray.h"
11 #include "nsIFormControl.h"
12 #include "nsIRadioGroupContainer.h"
13 #include "nsClassHashtable.h"
20 class nsIRadioVisitor
;
24 class HTMLInputElement
;
25 struct nsRadioGroupStruct
;
27 class RadioGroupManager
{
31 static void Traverse(RadioGroupManager
* tmp
,
32 nsCycleCollectionTraversalCallback
& cb
);
33 static void Unlink(RadioGroupManager
* tmp
);
35 // nsIRadioGroupContainer
36 NS_IMETHOD
WalkRadioGroup(const nsAString
& aName
, nsIRadioVisitor
* aVisitor
);
37 void SetCurrentRadioButton(const nsAString
& aName
, HTMLInputElement
* aRadio
);
38 HTMLInputElement
* GetCurrentRadioButton(const nsAString
& aName
);
39 nsresult
GetNextRadioButton(const nsAString
& aName
, const bool aPrevious
,
40 HTMLInputElement
* aFocusedRadio
,
41 HTMLInputElement
** aRadioOut
);
42 void AddToRadioGroup(const nsAString
& aName
, HTMLInputElement
* aRadio
,
43 nsIContent
* aAncestor
);
44 void RemoveFromRadioGroup(const nsAString
& aName
, HTMLInputElement
* aRadio
);
45 uint32_t GetRequiredRadioCount(const nsAString
& aName
) const;
46 void RadioRequiredWillChange(const nsAString
& aName
, bool aRequiredAdded
);
47 bool GetValueMissingState(const nsAString
& aName
) const;
48 void SetValueMissingState(const nsAString
& aName
, bool aValue
);
51 nsRadioGroupStruct
* GetRadioGroup(const nsAString
& aName
) const;
52 nsRadioGroupStruct
* GetOrCreateRadioGroup(const nsAString
& aName
);
55 nsClassHashtable
<nsStringHashKey
, nsRadioGroupStruct
> mRadioGroups
;
59 } // namespace mozilla
61 #endif // mozilla_dom_nsRadioGroupStruct_h