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"
18 class nsIRadioVisitor
;
22 class HTMLInputElement
;
23 struct nsRadioGroupStruct
;
25 class RadioGroupManager
{
29 static void Traverse(RadioGroupManager
* tmp
,
30 nsCycleCollectionTraversalCallback
& cb
);
31 static void Unlink(RadioGroupManager
* tmp
);
33 // nsIRadioGroupContainer
34 NS_IMETHOD
WalkRadioGroup(const nsAString
& aName
, nsIRadioVisitor
* aVisitor
);
35 void SetCurrentRadioButton(const nsAString
& aName
, HTMLInputElement
* aRadio
);
36 HTMLInputElement
* GetCurrentRadioButton(const nsAString
& aName
);
37 nsresult
GetNextRadioButton(const nsAString
& aName
, const bool aPrevious
,
38 HTMLInputElement
* aFocusedRadio
,
39 HTMLInputElement
** aRadioOut
);
40 void AddToRadioGroup(const nsAString
& aName
, HTMLInputElement
* aRadio
);
41 void RemoveFromRadioGroup(const nsAString
& aName
, HTMLInputElement
* aRadio
);
42 uint32_t GetRequiredRadioCount(const nsAString
& aName
) const;
43 void RadioRequiredWillChange(const nsAString
& aName
, bool aRequiredAdded
);
44 bool GetValueMissingState(const nsAString
& aName
) const;
45 void SetValueMissingState(const nsAString
& aName
, bool aValue
);
48 nsRadioGroupStruct
* GetRadioGroup(const nsAString
& aName
) const;
49 nsRadioGroupStruct
* GetOrCreateRadioGroup(const nsAString
& aName
);
52 nsClassHashtable
<nsStringHashKey
, nsRadioGroupStruct
> mRadioGroups
;
56 } // namespace mozilla
58 #endif // mozilla_dom_nsRadioGroupStruct_h