2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:30:37 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-01-18 15:14:00 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-01-18 15:14:00 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-01-18 15:14:00 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-28 20:14:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
2004-04-18 14:30:37 +00:00
|
|
|
* Dean Tessman <dean_tessman@hotmail.com>
|
2005-03-21 01:58:17 +00:00
|
|
|
* Mats Palmgren <mats.palmgren@bredband.net>
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:30:37 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-28 20:14:13 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 14:30:37 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-28 20:14:13 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 14:30:37 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-01-18 15:14:00 +00:00
|
|
|
|
|
|
|
#ifndef nsComboboxControlFrame_h___
|
|
|
|
#define nsComboboxControlFrame_h___
|
|
|
|
|
2000-03-07 15:54:31 +00:00
|
|
|
#ifdef DEBUG_evaughan
|
|
|
|
//#define DEBUG_rods
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_rods
|
2000-10-04 13:39:07 +00:00
|
|
|
//#define DO_REFLOW_DEBUG
|
|
|
|
//#define DO_REFLOW_COUNTER
|
2000-03-15 15:47:11 +00:00
|
|
|
//#define DO_UNCONSTRAINED_CHECK
|
2000-03-07 15:54:31 +00:00
|
|
|
//#define DO_PIXELS
|
|
|
|
//#define DO_NEW_REFLOW
|
|
|
|
#endif
|
2000-01-05 16:42:47 +00:00
|
|
|
|
2006-09-30 05:07:49 +00:00
|
|
|
//Mark used to indicate when onchange has been fired for current combobox item
|
|
|
|
#define NS_SKIP_NOTIFY_INDEX -2
|
|
|
|
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
#include "nsAreaFrame.h"
|
1999-01-18 15:14:00 +00:00
|
|
|
#include "nsIFormControlFrame.h"
|
2006-02-27 04:13:51 +00:00
|
|
|
#include "nsIComboboxControlFrame.h"
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
1999-08-26 14:54:07 +00:00
|
|
|
#include "nsISelectControlFrame.h"
|
1999-09-21 21:20:50 +00:00
|
|
|
#include "nsIRollupListener.h"
|
2005-01-27 22:52:53 +00:00
|
|
|
#include "nsPresState.h"
|
2000-03-07 15:54:31 +00:00
|
|
|
#include "nsCSSFrameConstructor.h"
|
2000-12-09 07:28:19 +00:00
|
|
|
#include "nsIScrollableViewProvider.h"
|
2001-11-02 07:40:01 +00:00
|
|
|
#include "nsIStatefulFrame.h"
|
2004-01-09 22:18:26 +00:00
|
|
|
#include "nsIDOMMouseListener.h"
|
2006-05-10 17:30:15 +00:00
|
|
|
#include "nsThreadUtils.h"
|
1999-01-18 15:14:00 +00:00
|
|
|
|
|
|
|
class nsIView;
|
|
|
|
class nsStyleContext;
|
|
|
|
class nsIListControlFrame;
|
2000-12-09 07:28:19 +00:00
|
|
|
class nsIScrollableView;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
class nsComboboxDisplayFrame;
|
1999-01-18 15:14:00 +00:00
|
|
|
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
/**
|
|
|
|
* Child list name indices
|
|
|
|
* @see #GetAdditionalChildListName()
|
|
|
|
*/
|
2007-07-26 04:03:29 +00:00
|
|
|
#define NS_COMBO_LIST_COUNT (NS_BLOCK_LIST_COUNT + 1)
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
|
|
|
|
class nsComboboxControlFrame : public nsAreaFrame,
|
1999-01-18 15:14:00 +00:00
|
|
|
public nsIFormControlFrame,
|
2006-02-27 04:13:51 +00:00
|
|
|
public nsIComboboxControlFrame,
|
1999-08-26 14:54:07 +00:00
|
|
|
public nsIAnonymousContentCreator,
|
1999-09-15 05:31:31 +00:00
|
|
|
public nsISelectControlFrame,
|
2000-12-09 07:28:19 +00:00
|
|
|
public nsIRollupListener,
|
2001-11-02 07:40:01 +00:00
|
|
|
public nsIScrollableViewProvider,
|
|
|
|
public nsIStatefulFrame
|
1999-01-18 15:14:00 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-03-26 21:30:36 +00:00
|
|
|
friend nsIFrame* NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
friend class nsComboboxDisplayFrame;
|
1999-12-05 20:43:18 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsComboboxControlFrame(nsStyleContext* aContext);
|
1999-01-18 15:14:00 +00:00
|
|
|
~nsComboboxControlFrame();
|
|
|
|
|
2007-02-18 17:34:09 +00:00
|
|
|
// nsISupports
|
1999-01-18 15:14:00 +00:00
|
|
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
2007-02-18 17:34:09 +00:00
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
|
|
|
|
virtual nsIFrame* CreateFrameFor(nsIContent* aContent);
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-17 23:52:32 +00:00
|
|
|
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
2001-05-17 23:52:32 +00:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
|
|
|
|
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aCX,
|
1999-01-18 15:14:00 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
1999-07-28 21:38:08 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus);
|
1999-07-28 21:38:08 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
|
|
|
void PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt);
|
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
// XXXbz this is only needed to prevent the quirk percent height stuff from
|
|
|
|
// leaking out of the combobox. We may be able to get rid of this as more
|
|
|
|
// things move to IsFrameOfType.
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
2007-02-24 18:33:33 +00:00
|
|
|
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
|
|
|
{
|
|
|
|
return nsAreaFrame::IsFrameOfType(aFlags &
|
|
|
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
|
|
|
}
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef NS_DEBUG
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
2006-04-10 00:16:29 +00:00
|
|
|
virtual void Destroy();
|
2004-01-09 14:20:53 +00:00
|
|
|
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
2006-04-10 00:16:29 +00:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList);
|
2004-01-09 14:20:53 +00:00
|
|
|
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
|
2004-07-18 12:02:53 +00:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame();
|
|
|
|
|
2005-12-12 23:53:06 +00:00
|
|
|
// nsIFormControlFrame
|
|
|
|
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
|
|
|
|
virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const;
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* Inform the control that it got (or lost) focus.
|
|
|
|
* If it lost focus, the dropdown menu will be rolled up if needed,
|
|
|
|
* and FireOnChange() will be called.
|
|
|
|
* @param aOn PR_TRUE if got focus, PR_FALSE if lost focus.
|
|
|
|
* @param aRepaint if PR_TRUE then force repaint (NOTE: we always force repaint currently)
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2005-12-12 23:53:06 +00:00
|
|
|
virtual void SetFocus(PRBool aOn, PRBool aRepaint);
|
1999-03-06 19:43:13 +00:00
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
//nsIComboboxControlFrame
|
2006-02-27 04:13:51 +00:00
|
|
|
virtual PRBool IsDroppedDown() { return mDroppedDown; }
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2006-02-27 04:13:51 +00:00
|
|
|
virtual void ShowDropDown(PRBool aDoDropDown);
|
|
|
|
virtual nsIFrame* GetDropDown();
|
|
|
|
virtual void SetDropDown(nsIFrame* aDropDownFrame);
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
2006-02-27 04:13:51 +00:00
|
|
|
virtual void RollupFromList();
|
|
|
|
virtual void AbsolutelyPositionDropDown();
|
|
|
|
virtual PRInt32 GetIndexOfDisplayArea();
|
|
|
|
NS_IMETHOD RedisplaySelectedText();
|
|
|
|
virtual PRInt32 UpdateRecentIndex(PRInt32 aIndex);
|
|
|
|
virtual void OnContentReset();
|
1999-08-26 14:54:07 +00:00
|
|
|
|
|
|
|
// nsISelectControlFrame
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD AddOption(nsPresContext* aPresContext, PRInt32 index);
|
|
|
|
NS_IMETHOD RemoveOption(nsPresContext* aPresContext, PRInt32 index);
|
1999-09-15 05:31:31 +00:00
|
|
|
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
|
2002-03-31 10:14:01 +00:00
|
|
|
NS_IMETHOD DoneAddingChildren(PRBool aIsDone);
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD OnOptionSelected(nsPresContext* aPresContext,
|
2001-11-02 07:40:01 +00:00
|
|
|
PRInt32 aIndex,
|
|
|
|
PRBool aSelected);
|
2005-02-04 22:56:13 +00:00
|
|
|
NS_IMETHOD OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex);
|
1999-09-15 05:31:31 +00:00
|
|
|
|
1999-09-21 21:20:50 +00:00
|
|
|
//nsIRollupListener
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* Hide the dropdown menu and stop capturing mouse events.
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
1999-09-21 21:20:50 +00:00
|
|
|
NS_IMETHOD Rollup();
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* A combobox should roll up if a mousewheel event happens outside of
|
|
|
|
* the popup area.
|
|
|
|
*/
|
2000-12-09 07:28:19 +00:00
|
|
|
NS_IMETHOD ShouldRollupOnMouseWheelEvent(PRBool *aShouldRollup)
|
|
|
|
{ *aShouldRollup = PR_TRUE; return NS_OK;}
|
1999-09-21 21:20:50 +00:00
|
|
|
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* A combobox should not roll up if activated by a mouse activate message
|
|
|
|
* (eg. X-mouse).
|
|
|
|
*/
|
2001-12-11 06:16:07 +00:00
|
|
|
NS_IMETHOD ShouldRollupOnMouseActivate(PRBool *aShouldRollup)
|
|
|
|
{ *aShouldRollup = PR_FALSE; return NS_OK;}
|
|
|
|
|
2000-12-09 07:28:19 +00:00
|
|
|
// nsIScrollableViewProvider
|
2004-09-06 02:44:43 +00:00
|
|
|
virtual nsIScrollableView* GetScrollableView();
|
2000-12-09 07:28:19 +00:00
|
|
|
|
2001-11-02 07:40:01 +00:00
|
|
|
//nsIStatefulFrame
|
2005-12-06 23:56:17 +00:00
|
|
|
NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState);
|
|
|
|
NS_IMETHOD RestoreState(nsPresState* aState);
|
2001-11-02 07:40:01 +00:00
|
|
|
|
2005-02-16 05:13:16 +00:00
|
|
|
static PRBool ToolkitHasNativePopup();
|
|
|
|
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
protected:
|
2002-01-25 23:35:44 +00:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
// Utilities
|
|
|
|
nsresult ReflowDropdown(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState);
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
|
1999-08-31 13:22:40 +00:00
|
|
|
protected:
|
2006-05-10 17:30:15 +00:00
|
|
|
class RedisplayTextEvent;
|
|
|
|
friend class RedisplayTextEvent;
|
|
|
|
|
|
|
|
class RedisplayTextEvent : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
RedisplayTextEvent(nsComboboxControlFrame *c) : mControlFrame(c) {}
|
|
|
|
void Revoke() { mControlFrame = nsnull; }
|
|
|
|
private:
|
|
|
|
nsComboboxControlFrame *mControlFrame;
|
|
|
|
};
|
|
|
|
|
2007-05-17 11:12:30 +00:00
|
|
|
/**
|
|
|
|
* Show or hide the dropdown list.
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
*/
|
fixed bugs #6303, #6753, #6756, #6759
Re-wrote nsComboboxFrame.
removed the obsolete nsHTMLAtoms: comboText,comoTextSelected,comTextSelectedFocus,dropDownVisible,
dropdownHidden, dropDownBtnOut, dropDownBtnPressed,
Added nsHTMLAtoms::combobox, nsLayoutAtoms::popupList
Renamed dropDownList to dropDownListPseudo
Added "arrow.gif" as to be used the background-image for the combobox button
ua.css - added rules for select to differentiate between comboboxes and listboxes.
Added style rules to more closely match the XPTOOLKIT XPWidgets look.
removed the following :-moz-combobox-text, -moz-combobox-textselected
nsIFormControlFrame.h - Added SetSuggestedSize method.
nsButtonControlFrame - Implemented SetSuggestedSize.
nsCSSFrameConstructor.cpp - Rewrote ConstructSelectFrame.
nsIWidget.h -Added GetAbsoluteBounds method.
nsWindow.cpp - Implemented GetAbsoluteBounds.
1999-07-14 22:00:24 +00:00
|
|
|
void ShowPopup(PRBool aShowPopup);
|
2007-05-17 11:12:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Show or hide the dropdown list.
|
|
|
|
* @param aShowList PR_TRUE to show, PR_FALSE to hide the dropdown.
|
|
|
|
* @note This method might destroy |this|.
|
|
|
|
* @return PR_FALSE if this frame is destroyed, PR_TRUE if still alive.
|
|
|
|
*/
|
|
|
|
PRBool ShowList(nsPresContext* aPresContext, PRBool aShowList);
|
2002-06-14 06:50:22 +00:00
|
|
|
void CheckFireOnChange();
|
2005-02-07 23:11:30 +00:00
|
|
|
void FireValueChangeEvent();
|
2002-01-25 23:35:44 +00:00
|
|
|
nsresult RedisplayText(PRInt32 aIndex);
|
2005-06-21 00:00:14 +00:00
|
|
|
void HandleRedisplayTextEvent();
|
|
|
|
void ActuallyDisplayText(PRBool aNotify);
|
1999-01-18 15:14:00 +00:00
|
|
|
|
2000-03-07 15:54:31 +00:00
|
|
|
nsFrameList mPopupFrames; // additional named child list
|
2006-07-19 04:36:36 +00:00
|
|
|
nsCOMPtr<nsIContent> mDisplayContent; // Anonymous content used to display the current selection
|
2007-02-18 17:34:09 +00:00
|
|
|
nsCOMPtr<nsIContent> mButtonContent; // Anonymous content for the button
|
2000-03-07 15:54:31 +00:00
|
|
|
nsIFrame* mDisplayFrame; // frame to display selection
|
|
|
|
nsIFrame* mButtonFrame; // button frame
|
|
|
|
nsIFrame* mDropdownFrame; // dropdown list frame
|
|
|
|
nsIFrame* mTextFrame; // display area frame
|
|
|
|
nsIListControlFrame * mListControlFrame; // ListControl Interface for the dropdown frame
|
1999-01-18 15:14:00 +00:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
// The width of our display area. Used by that frame's reflow to
|
|
|
|
// size to the full width except the drop-marker.
|
|
|
|
nscoord mDisplayWidth;
|
|
|
|
|
2002-02-08 18:35:48 +00:00
|
|
|
PRPackedBool mDroppedDown; // Current state of the dropdown list, PR_TRUE is dropped down
|
2005-02-19 23:54:36 +00:00
|
|
|
PRPackedBool mInRedisplayText;
|
2006-05-10 17:30:15 +00:00
|
|
|
|
|
|
|
nsRevocableEventPtr<RedisplayTextEvent> mRedisplayTextEvent;
|
2000-05-08 20:32:11 +00:00
|
|
|
|
2002-02-08 18:35:48 +00:00
|
|
|
PRInt32 mRecentSelectedIndex;
|
2002-01-25 23:35:44 +00:00
|
|
|
PRInt32 mDisplayedIndex;
|
2005-06-21 00:00:14 +00:00
|
|
|
nsString mDisplayedOptionText;
|
2002-01-25 23:35:44 +00:00
|
|
|
|
2001-06-30 00:25:09 +00:00
|
|
|
// make someone to listen to the button. If its programmatically pressed by someone like Accessibility
|
|
|
|
// then open or close the combo box.
|
|
|
|
nsCOMPtr<nsIDOMMouseListener> mButtonListener;
|
|
|
|
|
2000-10-04 13:39:07 +00:00
|
|
|
// static class data member for Bug 32920
|
|
|
|
// only one control can be focused at a time
|
|
|
|
static nsComboboxControlFrame * mFocused;
|
|
|
|
|
2000-03-07 15:54:31 +00:00
|
|
|
#ifdef DO_REFLOW_COUNTER
|
|
|
|
PRInt32 mReflowId;
|
|
|
|
#endif
|
1999-12-22 19:46:28 +00:00
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
private:
|
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|