1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsIComboboxControlFrame_h___
39 #define nsIComboboxControlFrame_h___
41 #include "nsQueryFrame.h"
46 class nsCSSFrameConstructor
;
49 * nsIComboboxControlFrame is the common interface for frames of form controls. It
50 * provides a uniform way of creating widgets, resizing, and painting.
51 * @see nsLeafFrame and its base classes for more info
53 class nsIComboboxControlFrame
: public nsQueryFrame
56 NS_DECL_QUERYFRAME_TARGET(nsIComboboxControlFrame
)
59 * Indicates whether the list is dropped down
61 virtual PRBool
IsDroppedDown() = 0;
64 * Shows or hides the drop down
66 virtual void ShowDropDown(PRBool aDoDropDown
) = 0;
69 * Gets the Drop Down List
71 virtual nsIFrame
* GetDropDown() = 0;
74 * Sets the Drop Down List
76 virtual void SetDropDown(nsIFrame
* aDropDownFrame
) = 0;
79 * Tells the combobox to roll up
81 virtual void RollupFromList() = 0;
84 * Redisplay the selected text (will do nothing if text has not changed).
85 * This method might destroy this frame or any others that happen to be
86 * around. It might even run script.
88 NS_IMETHOD
RedisplaySelectedText() = 0;
91 * Method for the listbox to set and get the recent index
93 virtual PRInt32
UpdateRecentIndex(PRInt32 aIndex
) = 0;
98 virtual void AbsolutelyPositionDropDown() = 0;
101 * Notification that the content has been reset
103 virtual void OnContentReset() = 0;
106 * This returns the index of the item that is currently being displayed
107 * in the display area. It may differ from what the currently Selected index
108 * is in in the dropdown.
110 * Detailed explanation:
111 * When the dropdown is dropped down via a mouse click and the user moves the mouse
112 * up and down without clicking, the currently selected item is being tracking inside
113 * the dropdown, but the combobox is not being updated. When the user selects items
114 * with the arrow keys, the combobox is being updated. So when the user clicks outside
115 * the dropdown and it needs to roll up it has to decide whether to keep the current
116 * selection or not. This method is used to get the current index in the combobox to
117 * compare it to the current index in the dropdown to see if the combox has been updated
118 * and that way it knows whether to "cancel" the current selection residing in the
119 * dropdown. Or whether to leave the selection alone.
121 virtual PRInt32
GetIndexOfDisplayArea() = 0;