michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsIComboboxControlFrame_h___ michael@0: #define nsIComboboxControlFrame_h___ michael@0: michael@0: #include "nsQueryFrame.h" michael@0: michael@0: /** michael@0: * nsIComboboxControlFrame is the interface for comboboxes. michael@0: */ michael@0: class nsIComboboxControlFrame : public nsQueryFrame michael@0: { michael@0: public: michael@0: NS_DECL_QUERYFRAME_TARGET(nsIComboboxControlFrame) michael@0: michael@0: /** michael@0: * Indicates whether the list is dropped down michael@0: */ michael@0: virtual bool IsDroppedDown() = 0; michael@0: michael@0: /** michael@0: * Shows or hides the drop down michael@0: */ michael@0: virtual void ShowDropDown(bool aDoDropDown) = 0; michael@0: michael@0: /** michael@0: * Gets the Drop Down List michael@0: */ michael@0: virtual nsIFrame* GetDropDown() = 0; michael@0: michael@0: /** michael@0: * Sets the Drop Down List michael@0: */ michael@0: virtual void SetDropDown(nsIFrame* aDropDownFrame) = 0; michael@0: michael@0: /** michael@0: * Tells the combobox to roll up michael@0: */ michael@0: virtual void RollupFromList() = 0; michael@0: michael@0: /** michael@0: * Redisplay the selected text (will do nothing if text has not changed). michael@0: * This method might destroy this frame or any others that happen to be michael@0: * around. It might even run script. michael@0: */ michael@0: NS_IMETHOD RedisplaySelectedText() = 0; michael@0: michael@0: /** michael@0: * Method for the listbox to set and get the recent index michael@0: */ michael@0: virtual int32_t UpdateRecentIndex(int32_t aIndex) = 0; michael@0: michael@0: /** michael@0: * Notification that the content has been reset michael@0: */ michael@0: virtual void OnContentReset() = 0; michael@0: michael@0: /** michael@0: * This returns the index of the item that is currently being displayed michael@0: * in the display area. It may differ from what the currently Selected index michael@0: * is in in the dropdown. michael@0: * michael@0: * Detailed explanation: michael@0: * When the dropdown is dropped down via a mouse click and the user moves the mouse michael@0: * up and down without clicking, the currently selected item is being tracking inside michael@0: * the dropdown, but the combobox is not being updated. When the user selects items michael@0: * with the arrow keys, the combobox is being updated. So when the user clicks outside michael@0: * the dropdown and it needs to roll up it has to decide whether to keep the current michael@0: * selection or not. This method is used to get the current index in the combobox to michael@0: * compare it to the current index in the dropdown to see if the combox has been updated michael@0: * and that way it knows whether to "cancel" the current selection residing in the michael@0: * dropdown. Or whether to leave the selection alone. michael@0: */ michael@0: virtual int32_t GetIndexOfDisplayArea() = 0; michael@0: }; michael@0: michael@0: #endif michael@0: