Line data Source code
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/. */
6 :
7 : #ifndef CheckableInputTypes_h__
8 : #define CheckableInputTypes_h__
9 :
10 : #include "InputType.h"
11 :
12 : class CheckableInputTypeBase : public ::InputType
13 : {
14 : public:
15 0 : ~CheckableInputTypeBase() override {}
16 :
17 : protected:
18 0 : explicit CheckableInputTypeBase(mozilla::dom::HTMLInputElement* aInputElement)
19 0 : : InputType(aInputElement)
20 0 : {}
21 : };
22 :
23 : // input type=checkbox
24 0 : class CheckboxInputType : public CheckableInputTypeBase
25 : {
26 : public:
27 : static InputType*
28 0 : Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
29 : {
30 0 : return new (aMemory) CheckboxInputType(aInputElement);
31 : }
32 :
33 : bool IsValueMissing() const override;
34 :
35 : nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
36 :
37 : private:
38 0 : explicit CheckboxInputType(mozilla::dom::HTMLInputElement* aInputElement)
39 0 : : CheckableInputTypeBase(aInputElement)
40 0 : {}
41 : };
42 :
43 : // input type=radio
44 0 : class RadioInputType : public CheckableInputTypeBase
45 : {
46 : public:
47 : static InputType*
48 0 : Create(mozilla::dom::HTMLInputElement* aInputElement, void* aMemory)
49 : {
50 0 : return new (aMemory) RadioInputType(aInputElement);
51 : }
52 :
53 : nsresult GetValueMissingMessage(nsXPIDLString& aMessage) override;
54 :
55 : private:
56 0 : explicit RadioInputType(mozilla::dom::HTMLInputElement* aInputElement)
57 0 : : CheckableInputTypeBase(aInputElement)
58 0 : {}
59 : };
60 :
61 : #endif /* CheckableInputTypes_h__ */
|