/src/mozilla-central/layout/forms/nsIComboboxControlFrame.h
Line | Count | Source (jump to first uncovered line) |
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 nsIComboboxControlFrame_h___ |
8 | | #define nsIComboboxControlFrame_h___ |
9 | | |
10 | | #include "nsQueryFrame.h" |
11 | | |
12 | | /** |
13 | | * nsIComboboxControlFrame is the interface for comboboxes. |
14 | | */ |
15 | | class nsIComboboxControlFrame : public nsQueryFrame |
16 | | { |
17 | | public: |
18 | | NS_DECL_QUERYFRAME_TARGET(nsIComboboxControlFrame) |
19 | | |
20 | | /** |
21 | | * Indicates whether the list is dropped down |
22 | | */ |
23 | | virtual bool IsDroppedDown() = 0; |
24 | | |
25 | | virtual bool IsOpenInParentProcess() = 0; |
26 | | virtual void SetOpenInParentProcess(bool aVal) = 0; |
27 | | |
28 | 0 | bool IsDroppedDownOrHasParentPopup() { return IsDroppedDown() || IsOpenInParentProcess(); } |
29 | | |
30 | | /** |
31 | | * Shows or hides the drop down |
32 | | */ |
33 | | virtual void ShowDropDown(bool aDoDropDown) = 0; |
34 | | |
35 | | /** |
36 | | * Gets the Drop Down List |
37 | | */ |
38 | | virtual nsIFrame* GetDropDown() = 0; |
39 | | |
40 | | /** |
41 | | * Sets the Drop Down List |
42 | | */ |
43 | | virtual void SetDropDown(nsIFrame* aDropDownFrame) = 0; |
44 | | |
45 | | /** |
46 | | * Tells the combobox to roll up |
47 | | */ |
48 | | virtual void RollupFromList() = 0; |
49 | | |
50 | | /** |
51 | | * Redisplay the selected text (will do nothing if text has not changed). |
52 | | * This method might destroy this frame or any others that happen to be |
53 | | * around. It might even run script. |
54 | | */ |
55 | | NS_IMETHOD RedisplaySelectedText() = 0; |
56 | | |
57 | | /** |
58 | | * Method for the listbox to set and get the recent index |
59 | | */ |
60 | | virtual int32_t UpdateRecentIndex(int32_t aIndex) = 0; |
61 | | |
62 | | /** |
63 | | * Notification that the content has been reset |
64 | | */ |
65 | | virtual void OnContentReset() = 0; |
66 | | |
67 | | /** |
68 | | * This returns the index of the item that is currently being displayed |
69 | | * in the display area. It may differ from what the currently Selected index |
70 | | * is in in the dropdown. |
71 | | * |
72 | | * Detailed explanation: |
73 | | * When the dropdown is dropped down via a mouse click and the user moves the mouse |
74 | | * up and down without clicking, the currently selected item is being tracking inside |
75 | | * the dropdown, but the combobox is not being updated. When the user selects items |
76 | | * with the arrow keys, the combobox is being updated. So when the user clicks outside |
77 | | * the dropdown and it needs to roll up it has to decide whether to keep the current |
78 | | * selection or not. This method is used to get the current index in the combobox to |
79 | | * compare it to the current index in the dropdown to see if the combox has been updated |
80 | | * and that way it knows whether to "cancel" the current selection residing in the |
81 | | * dropdown. Or whether to leave the selection alone. |
82 | | */ |
83 | | virtual int32_t GetIndexOfDisplayArea() = 0; |
84 | | }; |
85 | | |
86 | | #endif |
87 | | |