|
1 /* -*- Mode: C++; tab-width: 2; 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 __nsIRollupListener_h__ |
|
8 #define __nsIRollupListener_h__ |
|
9 |
|
10 #include "nsTArray.h" |
|
11 |
|
12 class nsIContent; |
|
13 class nsIWidget; |
|
14 class nsIntPoint; |
|
15 |
|
16 class nsIRollupListener { |
|
17 public: |
|
18 |
|
19 /** |
|
20 * Notifies the object to rollup, optionally returning the node that |
|
21 * was just rolled up. |
|
22 * |
|
23 * aPoint is the mouse pointer position where the event that triggered the |
|
24 * rollup occurred, which may be nullptr. |
|
25 * |
|
26 * aCount is the number of popups in a chain to close. If this is |
|
27 * UINT32_MAX, then all popups are closed. |
|
28 * If aLastRolledUp is non-null, it will be set to the last rolled up popup, |
|
29 * if this is supported. aLastRolledUp is not addrefed. |
|
30 * |
|
31 * Returns true if the event that the caller is processing should be consumed. |
|
32 */ |
|
33 virtual bool Rollup(uint32_t aCount, const nsIntPoint* aPoint, nsIContent** aLastRolledUp) = 0; |
|
34 |
|
35 /** |
|
36 * Asks the RollupListener if it should rollup on mouse wheel events |
|
37 */ |
|
38 virtual bool ShouldRollupOnMouseWheelEvent() = 0; |
|
39 |
|
40 /** |
|
41 * Asks the RollupListener if it should consume mouse wheel events |
|
42 */ |
|
43 virtual bool ShouldConsumeOnMouseWheelEvent() = 0; |
|
44 |
|
45 /** |
|
46 * Asks the RollupListener if it should rollup on mouse activate, eg. X-Mouse |
|
47 */ |
|
48 virtual bool ShouldRollupOnMouseActivate() = 0; |
|
49 |
|
50 /* |
|
51 * Retrieve the widgets for open menus and store them in the array |
|
52 * aWidgetChain. The number of menus of the same type should be returned, |
|
53 * for example, if a context menu is open, return only the number of menus |
|
54 * that are part of the context menu chain. This allows closing up only |
|
55 * those menus in different situations. The returned value should be exactly |
|
56 * the same number of widgets added to aWidgetChain. |
|
57 */ |
|
58 virtual uint32_t GetSubmenuWidgetChain(nsTArray<nsIWidget*> *aWidgetChain) = 0; |
|
59 |
|
60 /** |
|
61 * Notify the RollupListener that the widget did a Move or Resize. |
|
62 */ |
|
63 virtual void NotifyGeometryChange() = 0; |
|
64 |
|
65 virtual nsIWidget* GetRollupWidget() = 0; |
|
66 }; |
|
67 |
|
68 #endif /* __nsIRollupListener_h__ */ |