|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsIListControlFrame_h___ |
|
7 #define nsIListControlFrame_h___ |
|
8 |
|
9 #include "nsQueryFrame.h" |
|
10 |
|
11 class nsAString; |
|
12 |
|
13 namespace mozilla { |
|
14 namespace dom { |
|
15 class HTMLOptionElement; |
|
16 } // namespace dom |
|
17 } // namespace mozilla |
|
18 |
|
19 /** |
|
20 * nsIListControlFrame is the interface for frame-based listboxes. |
|
21 */ |
|
22 class nsIListControlFrame : public nsQueryFrame |
|
23 { |
|
24 public: |
|
25 NS_DECL_QUERYFRAME_TARGET(nsIListControlFrame) |
|
26 |
|
27 /** |
|
28 * Sets the ComboBoxFrame |
|
29 * |
|
30 */ |
|
31 virtual void SetComboboxFrame(nsIFrame* aComboboxFrame) = 0; |
|
32 |
|
33 /** |
|
34 * Get the display string for an item |
|
35 */ |
|
36 virtual void GetOptionText(uint32_t aIndex, nsAString& aStr) = 0; |
|
37 |
|
38 /** |
|
39 * Get the Selected Item's index |
|
40 * |
|
41 */ |
|
42 virtual int32_t GetSelectedIndex() = 0; |
|
43 |
|
44 /** |
|
45 * Return current option. The current option is the option displaying |
|
46 * the focus ring when the listbox is focused. |
|
47 */ |
|
48 virtual mozilla::dom::HTMLOptionElement* GetCurrentOption() = 0; |
|
49 |
|
50 /** |
|
51 * Initiates mouse capture for the listbox |
|
52 * |
|
53 */ |
|
54 virtual void CaptureMouseEvents(bool aGrabMouseEvents) = 0; |
|
55 |
|
56 /** |
|
57 * Returns the height of a single row in the list. This is the |
|
58 * maximum of the heights of all the options/optgroups. |
|
59 */ |
|
60 virtual nscoord GetHeightOfARow() = 0; |
|
61 |
|
62 /** |
|
63 * Returns the number of options in the listbox |
|
64 */ |
|
65 |
|
66 virtual uint32_t GetNumberOfOptions() = 0; |
|
67 |
|
68 /** |
|
69 * Called by combobox when it's about to drop down |
|
70 */ |
|
71 virtual void AboutToDropDown() = 0; |
|
72 |
|
73 /** |
|
74 * Called by combobox when it's about to roll up |
|
75 */ |
|
76 virtual void AboutToRollup() = 0; |
|
77 |
|
78 /** |
|
79 * Fire on change (used by combobox) |
|
80 */ |
|
81 virtual void FireOnChange() = 0; |
|
82 |
|
83 /** |
|
84 * Tell the selected list to roll up and ensure that the proper index is |
|
85 * selected, possibly firing onChange if the index has changed |
|
86 * |
|
87 * @param aIndex the index to actually select |
|
88 */ |
|
89 virtual void ComboboxFinish(int32_t aIndex) = 0; |
|
90 |
|
91 /** |
|
92 * Notification that the content has been reset |
|
93 */ |
|
94 virtual void OnContentReset() = 0; |
|
95 }; |
|
96 |
|
97 #endif |
|
98 |