|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
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 nsPrintPreviewListener_h__ |
|
8 #define nsPrintPreviewListener_h__ |
|
9 |
|
10 // Interfaces needed to be included |
|
11 #include "nsIDOMEventListener.h" |
|
12 // Helper Classes |
|
13 #include "nsCOMPtr.h" |
|
14 #include "mozilla/Attributes.h" |
|
15 |
|
16 namespace mozilla { |
|
17 namespace dom { |
|
18 class EventTarget; |
|
19 } |
|
20 } |
|
21 |
|
22 // |
|
23 // class nsPrintPreviewListener |
|
24 // |
|
25 // The class that listens to the chrome events and tells the embedding |
|
26 // chrome to show context menus, as appropriate. Handles registering itself |
|
27 // with the DOM with AddChromeListeners() and removing itself with |
|
28 // RemoveChromeListeners(). |
|
29 // |
|
30 class nsPrintPreviewListener MOZ_FINAL : public nsIDOMEventListener |
|
31 |
|
32 { |
|
33 public: |
|
34 NS_DECL_ISUPPORTS |
|
35 NS_DECL_NSIDOMEVENTLISTENER |
|
36 |
|
37 nsPrintPreviewListener(mozilla::dom::EventTarget* aTarget); |
|
38 ~nsPrintPreviewListener(); |
|
39 |
|
40 // Add/remove the relevant listeners, based on what interfaces |
|
41 // the embedding chrome implements. |
|
42 nsresult AddListeners(); |
|
43 nsresult RemoveListeners(); |
|
44 |
|
45 private: |
|
46 |
|
47 nsCOMPtr<mozilla::dom::EventTarget> mEventTarget; |
|
48 |
|
49 }; // class nsPrintPreviewListener |
|
50 |
|
51 |
|
52 |
|
53 #endif /* nsPrintPreviewListener_h__ */ |