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 HTMLDialogElement_h
8 : #define HTMLDialogElement_h
9 :
10 : #include "mozilla/AsyncEventDispatcher.h"
11 : #include "mozilla/Attributes.h"
12 : #include "nsGenericHTMLElement.h"
13 : #include "nsGkAtoms.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 : class HTMLDialogElement final : public nsGenericHTMLElement
19 : {
20 : public:
21 0 : explicit HTMLDialogElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : nsGenericHTMLElement(aNodeInfo)
22 : {
23 0 : }
24 :
25 : NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLDialogElement, dialog)
26 :
27 : virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
28 : bool aPreallocateChildren) const override;
29 :
30 : static bool IsDialogEnabled();
31 :
32 0 : bool Open() const { return GetBoolAttr(nsGkAtoms::open); }
33 0 : void SetOpen(bool aOpen, ErrorResult& aError)
34 : {
35 0 : SetHTMLBoolAttr(nsGkAtoms::open, aOpen, aError);
36 0 : }
37 :
38 0 : void GetReturnValue(nsAString& aReturnValue)
39 : {
40 0 : aReturnValue = mReturnValue;
41 0 : }
42 0 : void SetReturnValue(const nsAString& aReturnValue)
43 : {
44 0 : mReturnValue = aReturnValue;
45 0 : }
46 :
47 : void Close(const mozilla::dom::Optional<nsAString>& aReturnValue);
48 : void Show();
49 : void ShowModal(ErrorResult& aError);
50 :
51 : nsString mReturnValue;
52 :
53 : protected:
54 : virtual ~HTMLDialogElement();
55 : JSObject* WrapNode(JSContext* aCx,
56 : JS::Handle<JSObject*> aGivenProto) override;
57 : };
58 :
59 : } // namespace dom
60 : } // namespace mozilla
61 :
62 : #endif
|