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 "nsClassHashtable.h"
13 class nsIRadioVisitor
;
15 namespace mozilla::dom
{
17 class HTMLInputElement
;
18 struct nsRadioGroupStruct
;
20 class RadioGroupContainer final
{
22 RadioGroupContainer();
23 ~RadioGroupContainer();
25 static void Traverse(RadioGroupContainer
* tmp
,
26 nsCycleCollectionTraversalCallback
& cb
);
27 size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf
) const;
29 NS_IMETHOD
WalkRadioGroup(const nsAString
& aName
, nsIRadioVisitor
* aVisitor
);
30 void SetCurrentRadioButton(const nsAString
& aName
, HTMLInputElement
* aRadio
);
31 HTMLInputElement
* GetCurrentRadioButton(const nsAString
& aName
);
32 nsresult
GetNextRadioButton(const nsAString
& aName
, const bool aPrevious
,
33 HTMLInputElement
* aFocusedRadio
,
34 HTMLInputElement
** aRadioOut
);
35 HTMLInputElement
* GetFirstRadioButton(const nsAString
& aName
);
36 void AddToRadioGroup(const nsAString
& aName
, HTMLInputElement
* aRadio
,
37 nsIContent
* aAncestor
);
38 void RemoveFromRadioGroup(const nsAString
& aName
, HTMLInputElement
* aRadio
);
39 uint32_t GetRequiredRadioCount(const nsAString
& aName
) const;
40 void RadioRequiredWillChange(const nsAString
& aName
, bool aRequiredAdded
);
41 bool GetValueMissingState(const nsAString
& aName
) const;
42 void SetValueMissingState(const nsAString
& aName
, bool aValue
);
45 nsRadioGroupStruct
* GetRadioGroup(const nsAString
& aName
) const;
46 nsRadioGroupStruct
* GetOrCreateRadioGroup(const nsAString
& aName
);
49 nsClassHashtable
<nsStringHashKey
, nsRadioGroupStruct
> mRadioGroups
;
52 } // namespace mozilla::dom
54 #endif // mozilla_dom_nsRadioGroupStruct_h