Bumping gaia.json for 8 gaia revision(s) a=gaia-bump
[gecko.git] / dom / html / nsRadioVisitor.h
blob5c53870b9608e69eefcb7ab218ceb53962c1cea4
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"
12 class nsIFormControl;
14 /**
15 * nsRadioVisitor is the base class implementing nsIRadioVisitor and inherited
16 * by all radio visitors.
18 class nsRadioVisitor : public nsIRadioVisitor
20 protected:
21 virtual ~nsRadioVisitor() { }
23 public:
24 nsRadioVisitor() { }
26 NS_DECL_ISUPPORTS
28 virtual bool Visit(nsIFormControl* aRadio) MOZ_OVERRIDE = 0;
31 /**
32 * The following declarations are radio visitors inheriting from nsRadioVisitor.
35 /**
36 * nsRadioSetCheckedChangedVisitor is calling SetCheckedChanged with the given
37 * parameter to all radio elements in the group.
39 class nsRadioSetCheckedChangedVisitor : public nsRadioVisitor
41 public:
42 explicit nsRadioSetCheckedChangedVisitor(bool aCheckedChanged)
43 : mCheckedChanged(aCheckedChanged)
44 { }
46 virtual bool Visit(nsIFormControl* aRadio) MOZ_OVERRIDE;
48 protected:
49 bool mCheckedChanged;
52 /**
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
59 public:
60 nsRadioGetCheckedChangedVisitor(bool* aCheckedChanged,
61 nsIFormControl* aExcludeElement)
62 : mCheckedChanged(aCheckedChanged)
63 , mExcludeElement(aExcludeElement)
64 { }
66 virtual bool Visit(nsIFormControl* aRadio) MOZ_OVERRIDE;
68 protected:
69 bool* mCheckedChanged;
70 nsIFormControl* mExcludeElement;
73 /**
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
80 public:
81 nsRadioSetValueMissingState(nsIFormControl* aExcludeElement,
82 bool aValidity, bool aNotify)
83 : mExcludeElement(aExcludeElement)
84 , mValidity(aValidity)
85 , mNotify(aNotify)
86 { }
88 virtual bool Visit(nsIFormControl* aRadio) MOZ_OVERRIDE;
90 protected:
91 nsIFormControl* mExcludeElement;
92 bool mValidity;
93 bool mNotify;
96 #endif // _nsRadioVisitor_h__