1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef _nsRadioVisitor_h__
7 #define _nsRadioVisitor_h__
9 #include "mozilla/Attributes.h"
10 #include "nsIRadioVisitor.h"
15 * nsRadioVisitor is the base class implementing nsIRadioVisitor and inherited
16 * by all radio visitors.
18 class nsRadioVisitor
: public nsIRadioVisitor
21 virtual ~nsRadioVisitor() { }
28 virtual bool Visit(nsIFormControl
* aRadio
) MOZ_OVERRIDE
= 0;
32 * The following declarations are radio visitors inheriting from nsRadioVisitor.
36 * nsRadioSetCheckedChangedVisitor is calling SetCheckedChanged with the given
37 * parameter to all radio elements in the group.
39 class nsRadioSetCheckedChangedVisitor
: public nsRadioVisitor
42 explicit nsRadioSetCheckedChangedVisitor(bool aCheckedChanged
)
43 : mCheckedChanged(aCheckedChanged
)
46 virtual bool Visit(nsIFormControl
* aRadio
) MOZ_OVERRIDE
;
53 * nsRadioGetCheckedChangedVisitor is getting the current checked changed value.
54 * Getting it from one radio element is the group is enough given that all
55 * elements should have the same value.
57 class nsRadioGetCheckedChangedVisitor
: public nsRadioVisitor
60 nsRadioGetCheckedChangedVisitor(bool* aCheckedChanged
,
61 nsIFormControl
* aExcludeElement
)
62 : mCheckedChanged(aCheckedChanged
)
63 , mExcludeElement(aExcludeElement
)
66 virtual bool Visit(nsIFormControl
* aRadio
) MOZ_OVERRIDE
;
69 bool* mCheckedChanged
;
70 nsIFormControl
* mExcludeElement
;
74 * nsRadioSetValueMissingState is calling SetValueMissingState with the given
75 * parameter to all radio elements in the group.
76 * It is also calling ContentStatesChanged if needed.
78 class nsRadioSetValueMissingState
: public nsRadioVisitor
81 nsRadioSetValueMissingState(nsIFormControl
* aExcludeElement
,
82 bool aValidity
, bool aNotify
)
83 : mExcludeElement(aExcludeElement
)
84 , mValidity(aValidity
)
88 virtual bool Visit(nsIFormControl
* aRadio
) MOZ_OVERRIDE
;
91 nsIFormControl
* mExcludeElement
;
96 #endif // _nsRadioVisitor_h__