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 nsIListControlFrame_h___ michael@0: #define nsIListControlFrame_h___ michael@0: michael@0: #include "nsQueryFrame.h" michael@0: michael@0: class nsAString; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class HTMLOptionElement; michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: /** michael@0: * nsIListControlFrame is the interface for frame-based listboxes. michael@0: */ michael@0: class nsIListControlFrame : public nsQueryFrame michael@0: { michael@0: public: michael@0: NS_DECL_QUERYFRAME_TARGET(nsIListControlFrame) michael@0: michael@0: /** michael@0: * Sets the ComboBoxFrame michael@0: * michael@0: */ michael@0: virtual void SetComboboxFrame(nsIFrame* aComboboxFrame) = 0; michael@0: michael@0: /** michael@0: * Get the display string for an item michael@0: */ michael@0: virtual void GetOptionText(uint32_t aIndex, nsAString& aStr) = 0; michael@0: michael@0: /** michael@0: * Get the Selected Item's index michael@0: * michael@0: */ michael@0: virtual int32_t GetSelectedIndex() = 0; michael@0: michael@0: /** michael@0: * Return current option. The current option is the option displaying michael@0: * the focus ring when the listbox is focused. michael@0: */ michael@0: virtual mozilla::dom::HTMLOptionElement* GetCurrentOption() = 0; michael@0: michael@0: /** michael@0: * Initiates mouse capture for the listbox michael@0: * michael@0: */ michael@0: virtual void CaptureMouseEvents(bool aGrabMouseEvents) = 0; michael@0: michael@0: /** michael@0: * Returns the height of a single row in the list. This is the michael@0: * maximum of the heights of all the options/optgroups. michael@0: */ michael@0: virtual nscoord GetHeightOfARow() = 0; michael@0: michael@0: /** michael@0: * Returns the number of options in the listbox michael@0: */ michael@0: michael@0: virtual uint32_t GetNumberOfOptions() = 0; michael@0: michael@0: /** michael@0: * Called by combobox when it's about to drop down michael@0: */ michael@0: virtual void AboutToDropDown() = 0; michael@0: michael@0: /** michael@0: * Called by combobox when it's about to roll up michael@0: */ michael@0: virtual void AboutToRollup() = 0; michael@0: michael@0: /** michael@0: * Fire on change (used by combobox) michael@0: */ michael@0: virtual void FireOnChange() = 0; michael@0: michael@0: /** michael@0: * Tell the selected list to roll up and ensure that the proper index is michael@0: * selected, possibly firing onChange if the index has changed michael@0: * michael@0: * @param aIndex the index to actually select michael@0: */ michael@0: virtual void ComboboxFinish(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: #endif michael@0: