1999-01-18 15:14:00 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
1999-02-12 17:45:58 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1999-01-18 15:14:00 +00:00
|
|
|
#include "nsComboboxControlFrame.h"
|
|
|
|
#include "nsFormFrame.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 "nsFormControlFrame.h"
|
1999-01-18 15:14:00 +00:00
|
|
|
#include "nsIHTMLContent.h"
|
|
|
|
#include "nsHTMLIIDs.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsIFormControl.h"
|
|
|
|
#include "nsINameSpaceManager.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 "nsIDOMEventReceiver.h"
|
|
|
|
#include "nsLayoutAtoms.h"
|
1999-01-18 15:14:00 +00:00
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsListControlFrame.h"
|
|
|
|
#include "nsIListControlFrame.h"
|
1999-04-12 22:14:31 +00:00
|
|
|
#include "nsIDOMHTMLCollection.h"
|
|
|
|
#include "nsIDOMHTMLSelectElement.h"
|
|
|
|
#include "nsIDOMHTMLOptionElement.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 "nsIPresShell.h"
|
|
|
|
#include "nsISupportsArray.h"
|
|
|
|
#include "nsIDeviceContext.h"
|
|
|
|
#include "nsIView.h"
|
1999-07-28 21:38:08 +00:00
|
|
|
#include "nsIScrollableView.h"
|
1999-04-12 22:14:31 +00:00
|
|
|
|
1999-08-06 14:13:20 +00:00
|
|
|
#include "nsIEventStateManager.h"
|
|
|
|
|
1999-04-12 22:14:31 +00:00
|
|
|
static NS_DEFINE_IID(kIFormControlFrameIID, NS_IFORMCONTROLFRAME_IID);
|
|
|
|
static NS_DEFINE_IID(kIComboboxControlFrameIID, NS_ICOMBOBOXCONTROLFRAME_IID);
|
|
|
|
static NS_DEFINE_IID(kIListControlFrameIID, NS_ILISTCONTROLFRAME_IID);
|
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
|
|
|
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
|
|
|
static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID);
|
|
|
|
static NS_DEFINE_IID(kIAnonymousContentCreatorIID, NS_IANONYMOUS_CONTENT_CREATOR_IID);
|
1999-01-18 15:14:00 +00:00
|
|
|
|
1999-05-27 21:17:10 +00:00
|
|
|
// Drop down list event management.
|
|
|
|
// The combo box uses the following strategy for managing the
|
|
|
|
// drop-down list.
|
|
|
|
// If the combo box or it's arrow button is clicked on the drop-down list is displayed
|
|
|
|
// If mouse exit's the combo box with the drop-down list displayed the drop-down list
|
|
|
|
// is asked to capture events
|
|
|
|
// The drop-down list will capture all events including mouse down and up and will always
|
|
|
|
// return with ListWasSelected method call regardless of whether an item in the list was
|
|
|
|
// actually selected.
|
|
|
|
// The ListWasSelected code will turn off mouse-capture for the drop-down list.
|
|
|
|
// The drop-down list does not explicitly set capture when it is in the drop-down mode.
|
|
|
|
|
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
|
|
|
|
|
|
|
//XXX: This is temporary. It simulates psuedo states by using a attribute selector on
|
|
|
|
|
|
|
|
const char * kMozDropdownActive = "-moz-dropdown-active";
|
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
nsresult
|
1999-05-11 22:03:29 +00:00
|
|
|
NS_NewComboboxControlFrame(nsIFrame** aNewFrame)
|
1999-01-18 15:14:00 +00:00
|
|
|
{
|
1999-05-11 22:03:29 +00:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
|
|
|
nsComboboxControlFrame* it = new nsComboboxControlFrame;
|
|
|
|
if (!it) {
|
1999-01-18 15:14:00 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1999-05-11 22:03:29 +00:00
|
|
|
*aNewFrame = it;
|
1999-01-18 15:14:00 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsComboboxControlFrame::nsComboboxControlFrame()
|
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
|
|
|
: nsAreaFrame()
|
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
|
|
|
mPresContext = nsnull;
|
|
|
|
mFormFrame = nsnull;
|
1999-04-12 22:14:31 +00:00
|
|
|
mListControlFrame = nsnull;
|
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
|
|
|
mTextStr = "";
|
|
|
|
mDisplayContent = nsnull;
|
|
|
|
mButtonContent = nsnull;
|
|
|
|
mDroppedDown = PR_FALSE;
|
|
|
|
mDisplayFrame = nsnull;
|
|
|
|
mButtonFrame = nsnull;
|
|
|
|
mDropdownFrame = nsnull;
|
1999-08-06 14:13:20 +00:00
|
|
|
mIgnoreFocus = PR_FALSE;
|
1999-08-19 14:11:59 +00:00
|
|
|
mSelectedIndex = -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
|
|
|
|
|
|
|
//Shrink the area around it's contents
|
|
|
|
SetFlags(NS_BLOCK_SHRINK_WRAP);
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
nsComboboxControlFrame::~nsComboboxControlFrame()
|
|
|
|
{
|
1999-04-27 00:06:03 +00:00
|
|
|
mFormFrame = nsnull;
|
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
|
|
|
NS_IF_RELEASE(mPresContext);
|
|
|
|
NS_IF_RELEASE(mDisplayContent);
|
|
|
|
NS_IF_RELEASE(mButtonContent);
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
|
|
|
|
if (NULL == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-08-06 14:13:20 +00:00
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
if (aIID.Equals(kIComboboxControlFrameIID)) {
|
|
|
|
*aInstancePtr = (void*) ((nsIComboboxControlFrame*) this);
|
|
|
|
return NS_OK;
|
1999-08-06 14:13:20 +00:00
|
|
|
} else if (aIID.Equals(kIFormControlFrameIID)) {
|
1999-01-18 15:14:00 +00:00
|
|
|
*aInstancePtr = (void*) ((nsIFormControlFrame*) this);
|
|
|
|
return NS_OK;
|
1999-08-06 14:13:20 +00:00
|
|
|
} else if (aIID.Equals(kIDOMMouseListenerIID)) {
|
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
|
|
|
*aInstancePtr = (void*)(nsIDOMMouseListener*) this;
|
1999-08-26 14:54:07 +00:00
|
|
|
NS_ADDREF_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
|
|
|
return NS_OK;
|
1999-08-06 14:13:20 +00:00
|
|
|
} else if (aIID.Equals(nsCOMTypeInfo<nsIDOMFocusListener>::GetIID())) {
|
|
|
|
*aInstancePtr = (void*)(nsIDOMFocusListener*)this;
|
|
|
|
NS_ADDREF_THIS();
|
|
|
|
return NS_OK;
|
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
|
|
|
} else if (aIID.Equals(kIAnonymousContentCreatorIID)) {
|
|
|
|
*aInstancePtr = (void*)(nsIAnonymousContentCreator*) this;
|
|
|
|
return NS_OK;
|
1999-08-26 14:54:07 +00:00
|
|
|
} else if (aIID.Equals(nsCOMTypeInfo<nsISelectControlFrame>::GetIID())) {
|
|
|
|
*aInstancePtr = (void *)((nsISelectControlFrame*)this);
|
|
|
|
return NS_OK;
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
1999-04-12 22:14:31 +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
|
|
|
return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::Init(nsIPresContext& aPresContext,
|
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
// Need to hold on the pres context because it is used later in methods
|
|
|
|
// which don't have it passed in.
|
|
|
|
mPresContext = &aPresContext;
|
|
|
|
NS_ADDREF(mPresContext);
|
|
|
|
return nsAreaFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
PRBool
|
|
|
|
nsComboboxControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter)
|
|
|
|
{
|
|
|
|
nsAutoString name;
|
|
|
|
return (NS_CONTENT_ATTR_HAS_VALUE == GetName(&name));
|
|
|
|
}
|
|
|
|
|
1999-05-07 20:30:16 +00:00
|
|
|
|
|
|
|
// Initialize the text string in the combobox using either the current
|
|
|
|
// selection in the list box or the first item item in the list box.
|
|
|
|
|
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
|
|
|
|
nsComboboxControlFrame::InitTextStr(PRBool aUpdate)
|
1999-05-07 20:30:16 +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
|
|
|
nsIFormControlFrame* fcFrame = nsnull;
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
|
|
|
|
|
|
|
|
// Reset the list, so we can ask it for it's selected item.
|
|
|
|
fcFrame->Reset();
|
|
|
|
|
1999-05-07 20:30:16 +00:00
|
|
|
// Update the selected text string
|
|
|
|
mListControlFrame->GetSelectedItem(mTextStr);
|
|
|
|
|
|
|
|
if (mTextStr == "") {
|
|
|
|
// No selection so use the first item in the list box
|
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-05-07 20:30:16 +00:00
|
|
|
if ((NS_OK == result) && (nsnull != fcFrame)) {
|
1999-07-20 22:32:41 +00:00
|
|
|
// Find out if there are any options in the list to select
|
|
|
|
PRInt32 length = 0;
|
|
|
|
mListControlFrame->GetNumberOfOptions(&length);
|
|
|
|
if (length > 0) {
|
|
|
|
// Set listbox selection to first item in the list box
|
|
|
|
fcFrame->SetProperty(nsHTMLAtoms::selectedindex, "0");
|
1999-08-19 14:11:59 +00:00
|
|
|
mSelectedIndex = 0;
|
1999-07-20 22:32:41 +00:00
|
|
|
// Get the listbox selection as a string
|
|
|
|
mListControlFrame->GetSelectedItem(mTextStr);
|
|
|
|
}
|
1999-05-07 20:30:16 +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
|
|
|
|
|
|
|
// Update the display by setting the value attribute
|
|
|
|
mDisplayContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, mTextStr, aUpdate);
|
1999-08-19 14:11:59 +00:00
|
|
|
//nsIFrame* buttonFrame = GetDisplayFrame(aPresContext);
|
|
|
|
//nsFormControlHelper::ForceDrawFrame(buttonFrame);
|
1999-05-07 20:30:16 +00:00
|
|
|
}
|
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
//--------------------------------------------------------------
|
1999-04-12 22:14:31 +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
|
|
|
// Reset the combo box back to it original state.
|
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
void
|
|
|
|
nsComboboxControlFrame::Reset()
|
|
|
|
{
|
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
|
|
|
// Reset the dropdown list to its original state
|
1999-04-12 22:14:31 +00:00
|
|
|
nsIFormControlFrame* fcFrame = nsnull;
|
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
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
|
1999-04-12 22:14:31 +00:00
|
|
|
if ((NS_OK == result) && (nsnull != fcFrame)) {
|
|
|
|
fcFrame->Reset();
|
|
|
|
}
|
1999-05-07 20:30:16 +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
|
|
|
// Update the combobox using the text string returned from the dropdown list
|
|
|
|
InitTextStr(PR_TRUE);
|
1999-04-12 22:14:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsComboboxControlFrame::PostCreateWidget(nsIPresContext* aPresContext,
|
|
|
|
nscoord& aWidth,
|
|
|
|
nscoord& aHeight)
|
|
|
|
{
|
|
|
|
Reset();
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetType(PRInt32* aType) const
|
|
|
|
{
|
|
|
|
*aType = NS_FORM_SELECT;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetFormContent(nsIContent*& aContent) const
|
|
|
|
{
|
1999-02-10 00:42:56 +00:00
|
|
|
nsIContent* content;
|
1999-04-12 22:14:31 +00:00
|
|
|
nsresult rv;
|
1999-02-10 00:42:56 +00:00
|
|
|
rv = GetContent(&content);
|
|
|
|
aContent = content;
|
|
|
|
return rv;
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetFont(nsIPresContext* aPresContext,
|
|
|
|
nsFont& aFont)
|
|
|
|
{
|
|
|
|
nsFormControlHelper::GetFont(this, aPresContext, mStyleContext, aFont);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
nscoord
|
|
|
|
nsComboboxControlFrame::GetVerticalBorderWidth(float aPixToTwip) 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
|
|
|
return 0;
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
nscoord
|
|
|
|
nsComboboxControlFrame::GetHorizontalBorderWidth(float aPixToTwip) 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
|
|
|
return 0;
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
nscoord
|
|
|
|
nsComboboxControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
|
|
|
nscoord aInnerHeight) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
nscoord
|
|
|
|
nsComboboxControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
|
|
|
float aPixToTwip,
|
|
|
|
nscoord aInnerWidth,
|
|
|
|
nscoord aCharWidth) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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-01-18 15:14:00 +00:00
|
|
|
void
|
|
|
|
nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
|
|
|
|
{
|
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
|
|
|
//XXX: TODO Implement focus for combobox.
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
1999-08-21 00:09:24 +00:00
|
|
|
void
|
|
|
|
nsComboboxControlFrame::ScrollIntoView(nsIPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
if (aPresContext) {
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
|
|
|
presShell->ScrollFrameIntoView(this,
|
|
|
|
NS_PRESSHELL_SCROLL_ANYWHERE,NS_PRESSHELL_SCROLL_ANYWHERE);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void
|
|
|
|
nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
|
|
|
|
{
|
|
|
|
//XXX: This is temporary. It simulates a psuedo dropdown states by using a attribute selector
|
|
|
|
// This will not be need if the event state supports active states for use with the dropdown list
|
|
|
|
// Currently, the event state manager will reset the active state to the content which has focus
|
|
|
|
// which causes the active state to be removed from the event state manager immediately after it
|
|
|
|
// it the select is set to the active state.
|
1999-04-12 22:14:31 +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
|
|
|
nsCOMPtr<nsIAtom> activeAtom ( dont_QueryInterface(NS_NewAtom(kMozDropdownActive)));
|
|
|
|
if (PR_TRUE == aShowPopup) {
|
|
|
|
mContent->SetAttribute(kNameSpaceID_None, activeAtom, "", PR_TRUE);
|
|
|
|
} else {
|
|
|
|
mContent->UnsetAttribute(kNameSpaceID_None, activeAtom, PR_TRUE);
|
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
|
|
|
// Show the dropdown list
|
1999-04-12 22:14:31 +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
|
|
|
void
|
|
|
|
nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
|
|
|
|
{
|
|
|
|
if (PR_TRUE == aShowList) {
|
|
|
|
ShowPopup(PR_TRUE);
|
|
|
|
mDroppedDown = PR_TRUE;
|
|
|
|
// The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected
|
|
|
|
// which will stop the capture.
|
|
|
|
mListControlFrame->CaptureMouseEvents(PR_TRUE);
|
|
|
|
} else {
|
|
|
|
ShowPopup(PR_FALSE);
|
|
|
|
mDroppedDown = PR_FALSE;
|
1999-05-07 20:30:16 +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
|
|
|
}
|
1999-05-07 20:30:16 +00:00
|
|
|
|
1999-05-27 21:17:10 +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
|
|
|
//-------------------------------------------------------------
|
|
|
|
// this is in response to the MouseClick from the containing browse button
|
|
|
|
// XXX: TODO still need to get filters from accept attribute
|
|
|
|
void
|
|
|
|
nsComboboxControlFrame::MouseClicked(nsIPresContext* aPresContext)
|
|
|
|
{
|
1999-07-28 21:38:08 +00:00
|
|
|
//ToggleList(aPresContext);
|
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-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
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame,
|
|
|
|
nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nscoord aAvailableWidth,
|
|
|
|
nscoord aAvailableHeight)
|
|
|
|
{
|
|
|
|
// Constrain the child's width and height to aAvailableWidth and aAvailableHeight
|
|
|
|
nsSize availSize(aAvailableWidth, aAvailableHeight);
|
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aFrame,
|
|
|
|
availSize);
|
1999-07-20 03:41:03 +00:00
|
|
|
kidReflowState.mComputedWidth = aAvailableWidth;
|
|
|
|
kidReflowState.mComputedHeight = aAvailableHeight;
|
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
|
|
|
|
|
|
|
// Reflow child
|
|
|
|
nsresult rv = ReflowChild(aFrame, aPresContext, aDesiredSize, kidReflowState, aStatus);
|
1999-05-27 21:17:10 +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
|
|
|
// Set the child's width and height to it's desired size
|
|
|
|
nsRect rect;
|
|
|
|
aFrame->GetRect(rect);
|
|
|
|
rect.width = aDesiredSize.width;
|
|
|
|
rect.height = aDesiredSize.height;
|
|
|
|
aFrame->SetRect(rect);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Suggest a size for the child frame.
|
|
|
|
// Only frames which implement the nsIFormControlFrame interface and
|
|
|
|
// honor the SetSuggestedSize method will be placed and sized correctly.
|
|
|
|
|
|
|
|
void
|
|
|
|
nsComboboxControlFrame::SetChildFrameSize(nsIFrame* aFrame, nscoord aWidth, nscoord aHeight)
|
|
|
|
{
|
|
|
|
nsIFormControlFrame* fcFrame = nsnull;
|
|
|
|
nsresult result = aFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
|
|
|
|
if (NS_SUCCEEDED(result) && (nsnull != fcFrame)) {
|
|
|
|
fcFrame->SetSuggestedSize(aWidth, aHeight);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::GetPrimaryComboFrame(nsIPresContext& aPresContext, nsIContent* aContent, nsIFrame** aFrame)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
// Get the primary frame from the presentation shell.
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
rv = aPresContext.GetShell(getter_AddRefs(presShell));
|
|
|
|
if (NS_SUCCEEDED(rv) && presShell) {
|
|
|
|
presShell->GetPrimaryFrameFor(aContent, aFrame);
|
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
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIFrame*
|
|
|
|
nsComboboxControlFrame::GetButtonFrame(nsIPresContext& aPresContext)
|
|
|
|
{
|
|
|
|
if (mButtonFrame == nsnull) {
|
|
|
|
NS_ASSERTION(mButtonContent != nsnull, "nsComboboxControlFrame mButtonContent is null");
|
|
|
|
GetPrimaryComboFrame(aPresContext, mButtonContent, &mButtonFrame);
|
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
|
|
|
return mButtonFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIFrame*
|
|
|
|
nsComboboxControlFrame::GetDisplayFrame(nsIPresContext& aPresContext)
|
|
|
|
{
|
|
|
|
if (mDisplayFrame == nsnull) {
|
|
|
|
NS_ASSERTION(mDisplayContent != nsnull, "nsComboboxControlFrame mDisplayContent is null");
|
|
|
|
GetPrimaryComboFrame(aPresContext, mDisplayContent, &mDisplayFrame);
|
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
|
|
|
return mDisplayFrame;
|
|
|
|
}
|
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
|
|
|
nsIFrame*
|
|
|
|
nsComboboxControlFrame::GetDropdownFrame()
|
|
|
|
{
|
|
|
|
return mDropdownFrame;
|
|
|
|
}
|
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
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::GetScreenHeight(nsIPresContext& aPresContext,
|
|
|
|
nscoord& aHeight)
|
|
|
|
{
|
|
|
|
aHeight = 0;
|
|
|
|
nsIDeviceContext* context;
|
|
|
|
aPresContext.GetDeviceContext( &context );
|
|
|
|
if ( nsnull != context )
|
|
|
|
{
|
|
|
|
PRInt32 height;
|
|
|
|
PRInt32 width;
|
|
|
|
context->GetDeviceSurfaceDimensions(width, height);
|
|
|
|
float devUnits;
|
|
|
|
context->GetDevUnitsToAppUnits(devUnits);
|
|
|
|
aHeight = NSToIntRound(float( height) / devUnits );
|
|
|
|
NS_RELEASE( context );
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
|
|
|
|
1999-07-28 21:38:08 +00:00
|
|
|
int counter = 0;
|
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
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::PositionDropdown(nsIPresContext& aPresContext,
|
|
|
|
nscoord aHeight,
|
|
|
|
nsRect aAbsoluteTwipsRect,
|
|
|
|
nsRect aAbsolutePixelRect)
|
|
|
|
{
|
|
|
|
// Position the dropdown list. It is positioned below the display frame if there is enough
|
|
|
|
// room on the screen to display the entire list. Otherwise it is placed above the display
|
|
|
|
// frame.
|
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
|
|
|
// Note: As first glance, it appears that you could simply get the absolute bounding box for the
|
|
|
|
// dropdown list by first getting it's view, then getting the view's nsIWidget, then asking the nsIWidget
|
|
|
|
// for it's AbsoluteBounds. The problem with this approach, is that the dropdown lists y location can
|
|
|
|
// change based on whether the dropdown is placed below or above the display frame.
|
|
|
|
// The approach, taken here is to get use the absolute position of the display frame and use it's location
|
|
|
|
// to determine if the dropdown will go offscreen.
|
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
|
|
|
// Use the height calculated for the area frame so it includes both
|
|
|
|
// the display and button heights.
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nscoord dropdownYOffset = aHeight;
|
1999-07-28 21:38:08 +00:00
|
|
|
// XXX: Enable this code to debug popping up above the display frame, rather than below it
|
|
|
|
nsRect dropdownRect;
|
|
|
|
dropdownFrame->GetRect(dropdownRect);
|
|
|
|
|
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
|
|
|
nscoord screenHeightInPixels = 0;
|
|
|
|
if (NS_SUCCEEDED(GetScreenHeight(aPresContext, screenHeightInPixels))) {
|
1999-08-26 14:54:07 +00:00
|
|
|
// Get the height of the dropdown list in pixels.
|
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
|
|
|
float t2p;
|
|
|
|
aPresContext.GetTwipsToPixels(&t2p);
|
|
|
|
nscoord absoluteDropDownHeight = NSTwipsToIntPixels(dropdownRect.height, t2p);
|
|
|
|
|
|
|
|
// Check to see if the drop-down list will go offscreen
|
|
|
|
if (NS_SUCCEEDED(rv) && ((aAbsolutePixelRect.y + aAbsolutePixelRect.height + absoluteDropDownHeight) > screenHeightInPixels)) {
|
|
|
|
// move the dropdown list up
|
1999-07-28 21:38:08 +00:00
|
|
|
dropdownYOffset = - (dropdownRect.height);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dropdownRect.x = 0;
|
|
|
|
dropdownRect.y = dropdownYOffset;
|
1999-07-28 21:38:08 +00:00
|
|
|
nsRect currentRect;
|
|
|
|
dropdownFrame->GetRect(currentRect);
|
|
|
|
//if (currentRect != dropdownRect) {
|
|
|
|
dropdownFrame->SetRect(dropdownRect);
|
|
|
|
printf("%d Position Dropdown at: %d %d %d %d\n", counter++, dropdownRect.x, dropdownRect.y, dropdownRect.width, dropdownRect.height);
|
|
|
|
//}
|
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
|
|
|
return rv;
|
|
|
|
}
|
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
|
|
|
// Calculate a frame's position in screen coordinates
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::GetAbsoluteFramePosition(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame *aFrame,
|
|
|
|
nsRect& aAbsoluteTwipsRect,
|
|
|
|
nsRect& aAbsolutePixelRect)
|
|
|
|
{
|
|
|
|
//XXX: This code needs to take the view's offset into account when calculating
|
|
|
|
//the absolute coordinate of the frame.
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
aFrame->GetRect(aAbsoluteTwipsRect);
|
|
|
|
|
|
|
|
// Get conversions between twips and pixels
|
|
|
|
float t2p;
|
|
|
|
float p2t;
|
|
|
|
aPresContext.GetTwipsToPixels(&t2p);
|
|
|
|
aPresContext.GetPixelsToTwips(&p2t);
|
|
|
|
|
|
|
|
// Add in frame's offset from it it's containing view
|
|
|
|
nsIView *containingView = nsnull;
|
|
|
|
nsPoint offset;
|
|
|
|
rv = aFrame->GetOffsetFromView(offset, &containingView);
|
|
|
|
if (NS_SUCCEEDED(rv) && (nsnull != containingView)) {
|
|
|
|
aAbsoluteTwipsRect.x += offset.x;
|
|
|
|
aAbsoluteTwipsRect.y += offset.y;
|
1999-07-28 21:38:08 +00:00
|
|
|
|
|
|
|
nsPoint viewOffset;
|
|
|
|
containingView->GetPosition(&viewOffset.x, &viewOffset.y);
|
|
|
|
nsIView * parent;
|
|
|
|
containingView->GetParent(parent);
|
|
|
|
while (nsnull != parent) {
|
|
|
|
nsPoint po;
|
|
|
|
parent->GetPosition(&po.x, &po.y);
|
|
|
|
viewOffset.x += po.x;
|
|
|
|
viewOffset.y += po.y;
|
|
|
|
nsIScrollableView * scrollView;
|
|
|
|
if (NS_OK == containingView->QueryInterface(nsIScrollableView::GetIID(), (void **)&scrollView)) {
|
|
|
|
nscoord x;
|
|
|
|
nscoord y;
|
|
|
|
scrollView->GetScrollPosition(x, y);
|
|
|
|
viewOffset.x -= x;
|
|
|
|
viewOffset.y -= y;
|
|
|
|
}
|
|
|
|
nsIWidget * widget;
|
|
|
|
parent->GetWidget(widget);
|
|
|
|
if (nsnull != widget) {
|
|
|
|
// Add in the absolute offset of the widget.
|
|
|
|
nsRect absBounds;
|
|
|
|
nsRect lc;
|
|
|
|
widget->WidgetToScreen(lc, absBounds);
|
|
|
|
// Convert widget coordinates to twips
|
|
|
|
aAbsoluteTwipsRect.x += NSIntPixelsToTwips(absBounds.x, p2t);
|
|
|
|
aAbsoluteTwipsRect.y += NSIntPixelsToTwips(absBounds.y, p2t);
|
|
|
|
NS_RELEASE(widget);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
parent->GetParent(parent);
|
|
|
|
}
|
|
|
|
aAbsoluteTwipsRect.x += viewOffset.x;
|
|
|
|
aAbsoluteTwipsRect.y += viewOffset.y;
|
|
|
|
|
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
|
|
|
// Addin the containing view's offset form it's containing widget
|
1999-07-28 21:38:08 +00:00
|
|
|
/*nsIWidget* widget = nsnull;
|
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
|
|
|
nscoord widgetx = 0;
|
|
|
|
nscoord widgety = 0;
|
|
|
|
rv = containingView->GetOffsetFromWidget(&widgetx, &widgety, widget);
|
|
|
|
if (NS_SUCCEEDED(rv) && (nsnull != widget)) {
|
|
|
|
aAbsoluteTwipsRect.x += widgetx;
|
|
|
|
aAbsoluteTwipsRect.y += widgety;
|
|
|
|
|
|
|
|
// Add in the absolute offset of the widget.
|
|
|
|
nsRect absBounds;
|
1999-07-27 23:26:36 +00:00
|
|
|
//XXX: Remove this widget->GetAbsoluteBounds(absBounds);
|
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
|
|
|
|
|
|
|
// Convert widget coordinates to twips
|
|
|
|
aAbsoluteTwipsRect.x += NSIntPixelsToTwips(absBounds.x, p2t);
|
|
|
|
aAbsoluteTwipsRect.y += NSIntPixelsToTwips(absBounds.y, p2t);
|
|
|
|
NS_RELEASE(widget);
|
1999-07-28 21:38:08 +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
|
|
|
}
|
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
|
|
|
// convert to pixel coordinates
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
aAbsolutePixelRect.x = NSTwipsToIntPixels(aAbsoluteTwipsRect.x, t2p);
|
|
|
|
aAbsolutePixelRect.y = NSTwipsToIntPixels(aAbsoluteTwipsRect.y, t2p);
|
|
|
|
aAbsolutePixelRect.width = NSTwipsToIntPixels(aAbsoluteTwipsRect.width, t2p);
|
|
|
|
aAbsolutePixelRect.height = NSTwipsToIntPixels(aAbsoluteTwipsRect.height, t2p);
|
|
|
|
}
|
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
|
|
|
return rv;
|
|
|
|
}
|
1999-01-18 15:14:00 +00:00
|
|
|
|
1999-07-28 21:38:08 +00:00
|
|
|
static int myCounter = 0;
|
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
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::Reflow(nsIPresContext& aPresContext,
|
1999-07-28 21:38:08 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
printf("nsComboboxControlFrame::Reflow %d Reason: ", myCounter++);
|
|
|
|
switch (aReflowState.reason) {
|
|
|
|
case eReflowReason_Initial:printf("eReflowReason_Initial\n");break;
|
|
|
|
case eReflowReason_Incremental:printf("eReflowReason_Incremental\n");break;
|
|
|
|
case eReflowReason_Resize:printf("eReflowReason_Resize\n");break;
|
|
|
|
case eReflowReason_StyleChange:printf("eReflowReason_StyleChange\n");break;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsIFrame* buttonFrame = GetButtonFrame(aPresContext);
|
|
|
|
nsIFrame* displayFrame = GetDisplayFrame(aPresContext);
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
|
1999-08-10 19:25:22 +00:00
|
|
|
// Don't try to do any special sizing and positioning unless all of the frames
|
|
|
|
// have been created.
|
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
|
|
|
if ((nsnull == displayFrame) ||
|
|
|
|
(nsnull == buttonFrame) ||
|
|
|
|
(nsnull == dropdownFrame))
|
|
|
|
{
|
|
|
|
// Since combobox frames are missing just do a normal area frame reflow
|
|
|
|
return nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
|
|
|
}
|
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
|
|
|
// size of each part of the combo box
|
|
|
|
nsRect displayRect;
|
|
|
|
nsRect buttonRect;
|
|
|
|
nsRect dropdownRect;
|
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
|
|
|
|
|
|
|
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
|
|
|
nsFormFrame::AddFormControlFrame(aPresContext, *this);
|
|
|
|
}
|
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
|
|
|
// Get the current sizes of the combo box child frames
|
|
|
|
displayFrame->GetRect(displayRect);
|
|
|
|
buttonFrame->GetRect(buttonRect);
|
|
|
|
dropdownFrame->GetRect(dropdownRect);
|
|
|
|
|
|
|
|
nsHTMLReflowState firstPassState(aReflowState);
|
|
|
|
|
|
|
|
// Only reflow the display and button if they are the target of
|
|
|
|
// the incremental reflow, unless they change size. If they do
|
|
|
|
// then everything needs to be reflowed.
|
|
|
|
if (eReflowReason_Incremental == firstPassState.reason) {
|
|
|
|
nsIFrame* targetFrame;
|
|
|
|
firstPassState.reflowCommand->GetTarget(targetFrame);
|
|
|
|
if ((targetFrame == buttonFrame) || (targetFrame == displayFrame)) {
|
|
|
|
nsRect oldDisplayRect = displayRect;
|
|
|
|
nsRect oldButtonRect = buttonRect;
|
|
|
|
rv = nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
|
|
|
displayFrame->GetRect(displayRect);
|
|
|
|
buttonFrame->GetRect(buttonRect);
|
|
|
|
if ((oldDisplayRect == displayRect) && (oldButtonRect == buttonRect)) {
|
|
|
|
// Reposition the popup.
|
1999-08-26 14:54:07 +00:00
|
|
|
//nsRect absoluteTwips;
|
|
|
|
//nsRect absolutePixels;
|
1999-07-28 21:38:08 +00:00
|
|
|
//GetAbsoluteFramePosition(aPresContext, displayFrame, absoluteTwips, absolutePixels);
|
|
|
|
//PositionDropdown(aPresContext, displayRect.height, absoluteTwips, absolutePixels);
|
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
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nsIReflowCommand::ReflowType type;
|
|
|
|
aReflowState.reflowCommand->GetType(type);
|
|
|
|
firstPassState.reason = eReflowReason_StyleChange;
|
|
|
|
firstPassState.reflowCommand = nsnull;
|
|
|
|
}
|
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
|
|
|
//Set the desired size for the button and display frame
|
1999-07-20 03:41:03 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == firstPassState.mComputedWidth) {
|
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
|
|
|
// A width has not been specified for the select so size the display area to
|
|
|
|
// match the width of the longest item in the drop-down list. The dropdown
|
|
|
|
// list has already been reflowed and sized to shrink around its contents above.
|
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
|
|
|
// Reflow the dropdown shrink-wrapped.
|
|
|
|
nsHTMLReflowMetrics dropdownDesiredSize(aDesiredSize);
|
|
|
|
ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
|
|
|
nsSize size;
|
1999-08-06 14:13:20 +00:00
|
|
|
PRInt32 length = 0;
|
|
|
|
mListControlFrame->GetNumberOfOptions(&length);
|
|
|
|
/*if (0 == length) {
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
rv = mPresContext->GetShell(getter_AddRefs(presShell));
|
|
|
|
if (NS_SUCCEEDED(rv) && presShell) {
|
|
|
|
nsCOMPtr<nsIRenderingContext> renderContext;
|
|
|
|
rv = presShell->CreateRenderingContext(this, getter_AddRefs(renderContext));
|
|
|
|
if (NS_SUCCEEDED(rv) && renderContext) {
|
|
|
|
rv = presShell->CreateRenderingContext(this, getter_AddRefs(renderContext));
|
|
|
|
nsFormControlHelper::GetTextSize(*mPresContext, this, nsAutoString("XX"), size, renderContext);
|
|
|
|
dropdownRect.width = size.width + dropdownDesiredSize.width;
|
|
|
|
dropdownRect.height = size.height + dropdownDesiredSize.height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {*/
|
|
|
|
dropdownFrame->GetRect(dropdownRect);
|
|
|
|
// Get maximum size and height of a option in the dropdown
|
|
|
|
mListControlFrame->GetMaximumSize(size);
|
|
|
|
//}
|
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
|
|
|
// Set width of display to match width of the drop down
|
|
|
|
SetChildFrameSize(displayFrame, dropdownRect.width, size.height);
|
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
|
|
|
// Size the button to be the same height as the displayFrame
|
|
|
|
SetChildFrameSize(buttonFrame, size.height, size.height);
|
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
|
|
|
// Reflow display + button
|
|
|
|
nsAreaFrame::Reflow(aPresContext, aDesiredSize, firstPassState, aStatus);
|
|
|
|
displayFrame->GetRect(displayRect);
|
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
|
|
|
// Reflow the dropdown list to match the width of the display + button
|
|
|
|
ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, aDesiredSize.width, NS_UNCONSTRAINEDSIZE);
|
|
|
|
dropdownFrame->GetRect(dropdownRect);
|
1999-08-06 14:13:20 +00:00
|
|
|
|
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
|
|
|
} else {
|
|
|
|
// A width has been specified for the select.
|
|
|
|
// Make the display frame's width + button frame width = the width specified.
|
1999-04-12 22:14:31 +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
|
|
|
nsHTMLReflowMetrics dropdownDesiredSize(aDesiredSize);
|
|
|
|
ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
|
|
|
// Get unconstrained size of the dropdown list.
|
|
|
|
nsSize size;
|
|
|
|
mListControlFrame->GetMaximumSize(size);
|
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
|
|
|
// Size the button to be the same height as the displayFrame
|
|
|
|
SetChildFrameSize(buttonFrame, size.height, size.height);
|
1999-01-18 15:14:00 +00:00
|
|
|
|
1999-07-28 21:38:08 +00:00
|
|
|
// Compute display width
|
|
|
|
// Since the button's width is the same as its height
|
|
|
|
// we subtract size.height (the width)
|
|
|
|
nscoord displayWidth = firstPassState.mComputedWidth - size.height;
|
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
|
|
|
// Set the displayFrame to match the displayWidth computed above
|
|
|
|
SetChildFrameSize(displayFrame, displayWidth, size.height);
|
|
|
|
|
|
|
|
// Reflow again with the width of the display frame set.
|
|
|
|
nsAreaFrame::Reflow(aPresContext, aDesiredSize, firstPassState, aStatus);
|
|
|
|
|
|
|
|
// Reflow the dropdown list to match the width of the display + button
|
|
|
|
ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, aDesiredSize.width, NS_UNCONSTRAINEDSIZE);
|
|
|
|
|
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
|
|
|
|
|
|
|
nsRect absoluteTwips;
|
|
|
|
nsRect absolutePixels;
|
|
|
|
GetAbsoluteFramePosition(aPresContext, displayFrame, absoluteTwips, absolutePixels);
|
|
|
|
PositionDropdown(aPresContext, aDesiredSize.height, absoluteTwips, absolutePixels);
|
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
|
|
|
return rv;
|
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
|
|
|
}
|
1999-01-18 15:14:00 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetName(nsString* aResult)
|
|
|
|
{
|
|
|
|
nsresult result = NS_FORM_NOTOK;
|
|
|
|
if (mContent) {
|
|
|
|
nsIHTMLContent* formControl = nsnull;
|
|
|
|
result = mContent->QueryInterface(kIHTMLContentIID, (void**)&formControl);
|
|
|
|
if ((NS_OK == result) && formControl) {
|
|
|
|
nsHTMLValue value;
|
|
|
|
result = formControl->GetHTMLAttribute(nsHTMLAtoms::name, value);
|
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == result) {
|
|
|
|
if (eHTMLUnit_String == value.GetUnit()) {
|
|
|
|
value.GetStringValue(*aResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NS_RELEASE(formControl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsComboboxControlFrame::GetMaxNumValues()
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
1999-07-20 22:32:41 +00:00
|
|
|
/*XXX-REMOVE
|
1999-01-18 15:14:00 +00:00
|
|
|
PRBool
|
|
|
|
nsComboboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
|
|
|
|
nsString* aValues, nsString* aNames)
|
|
|
|
{
|
|
|
|
nsAutoString name;
|
|
|
|
nsresult result = GetName(&name);
|
|
|
|
if ((aMaxNumValues <= 0) || (NS_CONTENT_ATTR_HAS_VALUE != result)) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// use our name and the text widgets value
|
|
|
|
aNames[0] = name;
|
1999-04-12 22:14:31 +00:00
|
|
|
aValues[0] = mTextStr;
|
|
|
|
aNumValues = 1;
|
|
|
|
nsresult status = PR_TRUE;
|
1999-01-18 15:14:00 +00:00
|
|
|
return status;
|
|
|
|
}
|
1999-07-20 22:32:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsComboboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
|
|
|
|
nsString* aValues, nsString* aNames)
|
|
|
|
{
|
|
|
|
nsIFormControlFrame* fcFrame = nsnull;
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
|
|
|
|
if ((NS_SUCCEEDED(result)) && (nsnull != fcFrame)) {
|
|
|
|
return fcFrame->GetNamesValues(aMaxNumValues, aNumValues, aValues, aNames);
|
|
|
|
}
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
1999-08-10 19:25:22 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
|
|
|
|
{
|
|
|
|
if (nsFormFrame::GetDisabled(this)) {
|
|
|
|
*aFrame = this;
|
|
|
|
return NS_OK;
|
|
|
|
} else {
|
|
|
|
return nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-01-18 15:14:00 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetFrameName(nsString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName("ComboboxControl", aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
1999-03-25 06:43:38 +00:00
|
|
|
nsIStyleContext* aParentContext,
|
|
|
|
PRInt32 aParentChange,
|
|
|
|
nsStyleChangeList* aChangeList,
|
|
|
|
PRInt32* aLocalChange)
|
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
|
|
|
PRInt32 ourChange = aParentChange;
|
|
|
|
nsresult rv = nsAreaFrame::ReResolveStyleContext(aPresContext, aParentContext, aParentChange, aChangeList, aLocalChange);
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
1999-04-12 22:14:31 +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
|
|
|
if (aLocalChange) {
|
1999-03-25 06:43:38 +00:00
|
|
|
*aLocalChange = ourChange;
|
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-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
|
|
|
if (NS_COMFALSE != rv) {
|
|
|
|
PRInt32 childChange;
|
|
|
|
// Update child list
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
dropdownFrame->ReResolveStyleContext(aPresContext, mStyleContext, ourChange, aChangeList, &childChange);
|
|
|
|
}
|
1999-04-12 22:14:31 +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
|
|
|
return rv;
|
1999-01-18 15:14:00 +00:00
|
|
|
}
|
1999-04-12 22:14:31 +00:00
|
|
|
|
1999-08-06 14:13:20 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIDOMMouseListener
|
|
|
|
//----------------------------------------------------------------------
|
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
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
1999-01-18 15:14:00 +00:00
|
|
|
{
|
1999-08-26 14:54:07 +00:00
|
|
|
/*if (nsFormFrame::GetDisabled(this)) {
|
1999-08-06 14:13:20 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-07-28 21:38:08 +00:00
|
|
|
nsRect absoluteTwips;
|
|
|
|
nsRect absolutePixels;
|
|
|
|
nsIFrame * displayFrame = GetDisplayFrame(*mPresContext);
|
|
|
|
nsRect displayRect;
|
|
|
|
// Get the current sizes of the combo box child frames
|
|
|
|
displayFrame->GetRect(displayRect);
|
|
|
|
GetAbsoluteFramePosition(*mPresContext, displayFrame, absoluteTwips, absolutePixels);
|
|
|
|
PositionDropdown(*mPresContext, displayRect.height, absoluteTwips, absolutePixels);
|
|
|
|
|
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
|
|
|
ToggleList(mPresContext);
|
1999-08-26 14:54:07 +00:00
|
|
|
mIgnoreMouseUp = PR_TRUE;
|
|
|
|
*/
|
1999-01-18 15:14:00 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIComboboxControlFrame
|
|
|
|
//----------------------------------------------------------------------
|
1999-08-26 14:54:07 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
|
|
|
|
{
|
|
|
|
if (nsFormFrame::GetDisabled(this)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mDroppedDown && aDoDropDown) {
|
|
|
|
nsRect absoluteTwips;
|
|
|
|
nsRect absolutePixels;
|
|
|
|
nsIFrame * displayFrame = GetDisplayFrame(*mPresContext);
|
|
|
|
nsRect displayRect;
|
|
|
|
// Get the current sizes of the combo box child frames
|
|
|
|
displayFrame->GetRect(displayRect);
|
|
|
|
GetAbsoluteFramePosition(*mPresContext, displayFrame, absoluteTwips, absolutePixels);
|
|
|
|
PositionDropdown(*mPresContext, displayRect.height, absoluteTwips, absolutePixels);
|
|
|
|
|
|
|
|
ToggleList(mPresContext);
|
|
|
|
return NS_OK;
|
|
|
|
} else if (mDroppedDown && !aDoDropDown) {
|
|
|
|
ToggleList(mPresContext);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
1999-01-18 15:14:00 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
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
|
|
|
nsComboboxControlFrame::SetDropDown(nsIFrame* aDropDownFrame)
|
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
|
|
|
mDropdownFrame = aDropDownFrame;
|
|
|
|
|
|
|
|
if (NS_OK != mDropdownFrame->QueryInterface(kIListControlFrameIID, (void**)&mListControlFrame)) {
|
1999-01-18 15:14:00 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-23 14:05:37 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetDropDown(nsIFrame** aDropDownFrame)
|
|
|
|
{
|
|
|
|
if (nsnull == aDropDownFrame) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aDropDownFrame = mDropdownFrame;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-26 14:54:07 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
if (aPresContext == nsnull) {
|
|
|
|
aPresContext = mPresContext;
|
|
|
|
}
|
|
|
|
ShowList(aPresContext, PR_FALSE);
|
|
|
|
mListControlFrame->CaptureMouseEvents(PR_FALSE);
|
|
|
|
|
1999-08-27 03:58:13 +00:00
|
|
|
PRInt32 indx;
|
|
|
|
mListControlFrame->GetSelectedIndex(&indx);
|
1999-04-12 22:14:31 +00:00
|
|
|
|
1999-08-27 03:58:13 +00:00
|
|
|
UpdateSelection(PR_TRUE, PR_FALSE, indx);
|
1999-08-26 14:54:07 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
// Toggle dropdown list.
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::ToggleList(nsIPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
if (PR_TRUE == mDroppedDown) {
|
|
|
|
ShowList(aPresContext, PR_FALSE);
|
|
|
|
} else {
|
|
|
|
ShowList(aPresContext, PR_TRUE);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUpdate, PRInt32 aNewIndex)
|
|
|
|
{
|
|
|
|
if (nsnull != mListControlFrame) {
|
|
|
|
// Check to see if the selection changed
|
|
|
|
if (mSelectedIndex != aNewIndex || aForceUpdate) {
|
|
|
|
nsAutoString newTextStr;
|
|
|
|
mListControlFrame->GetSelectedItem(newTextStr);
|
|
|
|
//XXX:TODO look at the ordinal position of the selected content in the listbox to tell
|
|
|
|
// if the selection has changed, rather than looking at the text string.
|
|
|
|
// There may be more than one item in the dropdown list with the same label.
|
|
|
|
if (newTextStr != mTextStr) {
|
|
|
|
mTextStr = newTextStr;
|
|
|
|
SelectionChanged(aDoDispatchEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mSelectedIndex = aNewIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::SelectionChanged(PRBool aDoDispatchEvent)
|
1999-06-23 21:50:56 +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
|
|
|
if (nsnull != mDisplayContent) {
|
|
|
|
mDisplayContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, mTextStr, PR_TRUE);
|
1999-08-19 14:11:59 +00:00
|
|
|
nsIFrame* displayFrame = GetDisplayFrame(*mPresContext);
|
|
|
|
nsFormControlHelper::ForceDrawFrame(displayFrame);
|
1999-08-23 14:05:37 +00:00
|
|
|
|
|
|
|
// Send reflow command because the new text maybe larger
|
|
|
|
nsIReflowCommand* cmd;
|
|
|
|
nsresult rv;
|
|
|
|
rv = NS_NewHTMLReflowCommand(&cmd, displayFrame, nsIReflowCommand::ContentChanged);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
rv = mPresContext->GetShell(getter_AddRefs(shell));
|
|
|
|
if (NS_SUCCEEDED(rv) && shell) {
|
|
|
|
shell->AppendReflowCommand(cmd);
|
|
|
|
NS_RELEASE(cmd);
|
|
|
|
}
|
|
|
|
}
|
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-06-23 21:50:56 +00:00
|
|
|
|
1999-08-26 14:54:07 +00:00
|
|
|
if (aDoDispatchEvent) {
|
|
|
|
// Dispatch the NS_FORM_CHANGE event
|
|
|
|
nsEventStatus status = nsEventStatus_eIgnore;
|
|
|
|
nsGUIEvent event;
|
|
|
|
event.eventStructType = NS_GUI_EVENT;
|
|
|
|
event.widget = nsnull;
|
|
|
|
event.message = NS_FORM_CHANGE;
|
|
|
|
|
|
|
|
// Have the content handle the event.
|
|
|
|
mContent->HandleDOMEvent(*mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
|
|
|
|
// Now have the frame handle the event
|
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult result = dropdownFrame->QueryInterface(kIFrameIID, (void**)&frame);
|
|
|
|
if ((NS_SUCCEEDED(result)) && (nsnull != frame)) {
|
|
|
|
frame->HandleEvent(*mPresContext, &event, status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISelectControlFrame
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-08-27 03:58:13 +00:00
|
|
|
nsComboboxControlFrame::AddOption(PRInt32 aIndex)
|
1999-08-26 14:54:07 +00:00
|
|
|
{
|
|
|
|
nsISelectControlFrame* listFrame = nsnull;
|
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
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
1999-08-26 14:54:07 +00:00
|
|
|
nsresult rv = dropdownFrame->QueryInterface(nsCOMTypeInfo<nsISelectControlFrame>::GetIID(),
|
|
|
|
(void**)&listFrame);
|
|
|
|
if (NS_SUCCEEDED(rv) && nsnull != listFrame) {
|
1999-08-27 03:58:13 +00:00
|
|
|
return listFrame->AddOption(aIndex);
|
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-26 14:54:07 +00:00
|
|
|
return rv;
|
|
|
|
}
|
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-26 14:54:07 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-08-27 03:58:13 +00:00
|
|
|
nsComboboxControlFrame::RemoveOption(PRInt32 aIndex)
|
1999-08-26 14:54:07 +00:00
|
|
|
{
|
|
|
|
nsISelectControlFrame* listFrame = nsnull;
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult rv = dropdownFrame->QueryInterface(nsCOMTypeInfo<nsISelectControlFrame>::GetIID(),
|
|
|
|
(void**)&listFrame);
|
|
|
|
if (NS_SUCCEEDED(rv) && nsnull != listFrame) {
|
1999-08-27 03:58:13 +00:00
|
|
|
return listFrame->RemoveOption(aIndex);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::SetOptionSelected(PRInt32 aIndex, PRBool aValue)
|
|
|
|
{
|
|
|
|
nsISelectControlFrame* listFrame = nsnull;
|
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult rv = dropdownFrame->QueryInterface(nsCOMTypeInfo<nsISelectControlFrame>::GetIID(),
|
|
|
|
(void**)&listFrame);
|
|
|
|
if (NS_SUCCEEDED(rv) && nsnull != listFrame) {
|
|
|
|
return listFrame->SetOptionSelected(aIndex, aValue);
|
1999-08-26 14:54:07 +00:00
|
|
|
}
|
|
|
|
return rv;
|
1999-06-23 21:50:56 +00:00
|
|
|
}
|
|
|
|
|
1999-07-28 21:38:08 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::HandleEvent(nsIPresContext& aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aEventStatus)
|
|
|
|
{
|
|
|
|
if (nsEventStatus_eConsumeNoDefault == aEventStatus) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-08-10 19:25:22 +00:00
|
|
|
if (nsFormFrame::GetDisabled(this)) {
|
|
|
|
return NS_OK;
|
1999-07-28 21:38:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::RequiresWidget(PRBool& aRequiresWidget)
|
1999-01-25 22:16:27 +00:00
|
|
|
{
|
1999-04-12 22:14:31 +00:00
|
|
|
aRequiresWidget = PR_FALSE;
|
1999-01-25 22:16:27 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-04-12 22:14:31 +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
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue)
|
1999-01-25 22:16:27 +00:00
|
|
|
{
|
1999-04-12 22:14:31 +00:00
|
|
|
nsIFormControlFrame* fcFrame = nsnull;
|
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
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
|
1999-04-12 22:14:31 +00:00
|
|
|
if ((NS_SUCCEEDED(result)) && (nsnull != fcFrame)) {
|
|
|
|
return fcFrame->SetProperty(aName, aValue);
|
|
|
|
}
|
|
|
|
return result;
|
1999-01-25 22:16:27 +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
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
|
1999-03-06 19:43:13 +00:00
|
|
|
{
|
1999-04-12 22:14:31 +00:00
|
|
|
nsIFormControlFrame* fcFrame = nsnull;
|
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
|
|
|
nsIFrame* dropdownFrame = GetDropdownFrame();
|
|
|
|
nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
|
1999-04-12 22:14:31 +00:00
|
|
|
if ((NS_SUCCEEDED(result)) && (nsnull != fcFrame)) {
|
|
|
|
return fcFrame->GetProperty(aName, aValue);
|
|
|
|
}
|
|
|
|
return result;
|
1999-03-06 19:43:13 +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
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::CreateAnonymousContent(nsISupportsArray& aChildList)
|
|
|
|
{
|
|
|
|
// The frames used to display the combo box and the button used to popup the dropdown list
|
|
|
|
// are created through anonymous content. The dropdown list is not created through anonymous
|
|
|
|
// content because it's frame is initialized specifically for the drop-down case and it is placed
|
|
|
|
// a special list referenced through NS_COMBO_FRAME_POPUP_LIST_INDEX to keep separate from the
|
|
|
|
// layout of the display and button.
|
|
|
|
//
|
|
|
|
// Note: The value attribute of the display content is set when an item is selected in the dropdown list.
|
|
|
|
// If the content specified below does not honor the value attribute than nothing will be displayed.
|
|
|
|
// In addition, if the frame created by content below for does not implement the nsIFormControlFrame
|
|
|
|
// interface and honor the SetSuggestedSize method the placement and size of the display area will not
|
|
|
|
// match what is normally desired for a combobox.
|
|
|
|
|
|
|
|
|
|
|
|
// For now the content that is created corresponds to two input buttons. It would be better to create the
|
|
|
|
// tag as something other than input, but then there isn't any way to create a button frame since it
|
|
|
|
// isn't possible to set the display type in CSS2 to create a button frame.
|
|
|
|
|
|
|
|
// create content used for display
|
1999-08-06 14:13:20 +00:00
|
|
|
//nsIAtom* tag = NS_NewAtom("mozcombodisplay");
|
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
|
|
|
nsIAtom* tag = NS_NewAtom("input");
|
|
|
|
NS_NewHTMLInputElement(&mDisplayContent, tag);
|
|
|
|
NS_ADDREF(mDisplayContent);
|
|
|
|
mDisplayContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE);
|
1999-08-19 14:11:59 +00:00
|
|
|
//mDisplayContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::readonly, nsAutoString("true"), PR_FALSE);
|
|
|
|
|
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
|
|
|
//XXX: Do not use nsHTMLAtoms::id use nsHTMLAtoms::kClass instead. There will end up being multiple
|
|
|
|
//ids set to the same value which is illegal.
|
|
|
|
mDisplayContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, nsAutoString("-moz-display"), PR_FALSE);
|
1999-08-19 14:11:59 +00:00
|
|
|
mDisplayContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, nsAutoString("X"), PR_TRUE);
|
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
|
|
|
aChildList.AppendElement(mDisplayContent);
|
|
|
|
|
|
|
|
// create button which drops the list down
|
|
|
|
tag = NS_NewAtom("input");
|
|
|
|
NS_NewHTMLInputElement(&mButtonContent, tag);
|
|
|
|
NS_ADDREF(mButtonContent);
|
|
|
|
mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE);
|
|
|
|
aChildList.AppendElement(mButtonContent);
|
|
|
|
|
|
|
|
// get the reciever interface from the browser button's content node
|
|
|
|
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(mButtonContent));
|
|
|
|
|
|
|
|
// we shouldn't have to unregister this listener because when
|
|
|
|
// our frame goes away all these content node go away as well
|
|
|
|
// because our frame is the only one who references them.
|
1999-08-06 14:13:20 +00:00
|
|
|
reciever->AddEventListenerByIID((nsIDOMMouseListener *)this, kIDOMMouseListenerIID);
|
|
|
|
//reciever->AddEventListenerByIID((nsIDOMFocusListener *)this, nsCOMTypeInfo<nsIDOMFocusListener>::GetIID());
|
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
|
|
|
|
|
|
|
// get the reciever interface from the browser button's content node
|
|
|
|
nsCOMPtr<nsIDOMEventReceiver> displayReciever(do_QueryInterface(mDisplayContent));
|
|
|
|
|
|
|
|
// we shouldn't have to unregister this listener because when
|
|
|
|
// our frame goes away all these content node go away as well
|
|
|
|
// because our frame is the only one who references them.
|
1999-08-06 14:13:20 +00:00
|
|
|
displayReciever->AddEventListenerByIID((nsIDOMMouseListener *)this, kIDOMMouseListenerIID);
|
|
|
|
//displayReciever->AddEventListenerByIID((nsIDOMFocusListener *)this, nsCOMTypeInfo<nsIDOMFocusListener>::GetIID());
|
|
|
|
|
|
|
|
// get the reciever interface from the select's content
|
|
|
|
nsCOMPtr<nsIDOMEventReceiver> selectReciever(do_QueryInterface(mContent));
|
|
|
|
|
|
|
|
// we shouldn't have to unregister this listener because when
|
|
|
|
// our frame goes away all these content node go away as well
|
|
|
|
// because our frame is the only one who references them.
|
|
|
|
//selectReciever->AddEventListenerByIID((nsIDOMFocusListener *)this, nsCOMTypeInfo<nsIDOMFocusListener>::GetIID());
|
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
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-07-22 02:24:52 +00:00
|
|
|
nsComboboxControlFrame::Destroy(nsIPresContext& aPresContext)
|
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
|
|
|
{
|
|
|
|
// Cleanup frames in popup child list
|
1999-07-22 04:00:57 +00:00
|
|
|
mPopupFrames.DestroyFrames(aPresContext);
|
1999-07-22 02:24:52 +00:00
|
|
|
return nsAreaFrame::Destroy(aPresContext);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::FirstChild(nsIAtom* aListName,
|
|
|
|
nsIFrame** aFirstChild) const
|
|
|
|
{
|
|
|
|
if (nsLayoutAtoms::popupList == aListName) {
|
|
|
|
*aFirstChild = mPopupFrames.FirstChild();
|
|
|
|
} else {
|
|
|
|
nsAreaFrame::FirstChild(aListName, aFirstChild);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::SetInitialChildList(nsIPresContext& aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (nsLayoutAtoms::popupList == aListName) {
|
|
|
|
mPopupFrames.SetFrames(aChildList);
|
|
|
|
} else {
|
|
|
|
rv = nsAreaFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
|
|
|
InitTextStr(PR_FALSE);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComboboxControlFrame::GetAdditionalChildListName(PRInt32 aIndex,
|
|
|
|
nsIAtom** aListName) const
|
|
|
|
{
|
|
|
|
// Maintain a seperate child list for the dropdown list (i.e. popup listbox)
|
|
|
|
// This is necessary because we don't want the listbox to be included in the layout
|
|
|
|
// of the combox's children because it would take up space, when it is suppose to
|
|
|
|
// be floating above the display.
|
|
|
|
NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer");
|
|
|
|
if (aIndex <= NS_AREA_FRAME_ABSOLUTE_LIST_INDEX) {
|
|
|
|
return nsAreaFrame::GetAdditionalChildListName(aIndex, aListName);
|
|
|
|
}
|
|
|
|
|
|
|
|
*aListName = nsnull;
|
|
|
|
if (NS_COMBO_FRAME_POPUP_LIST_INDEX == aIndex) {
|
|
|
|
*aListName = nsLayoutAtoms::popupList;
|
|
|
|
NS_ADDREF(*aListName);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRIntn
|
|
|
|
nsComboboxControlFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
// Don't skip any sides during border rendering
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-08-06 14:13:20 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIDOMFocusListener
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::Focus(nsIDOMEvent* aEvent)
|
|
|
|
{
|
1999-08-06 14:42:00 +00:00
|
|
|
#if 0
|
1999-08-06 14:13:20 +00:00
|
|
|
printf("nsComboboxControlFrame::Focus ");
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMNode> node;
|
|
|
|
aEvent->GetTarget(getter_AddRefs(node));
|
|
|
|
nsCOMPtr<nsIDOMNode> curNode;
|
|
|
|
aEvent->GetCurrentNode(getter_AddRefs(curNode));
|
|
|
|
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
|
|
|
|
|
|
|
if (content == mContent) {
|
|
|
|
printf("Combobox\n");
|
|
|
|
} else if (content == mDisplayContent) {
|
|
|
|
printf("Display\n");
|
|
|
|
return NS_OK;
|
|
|
|
} else if (content == mButtonContent) {
|
|
|
|
printf("Button\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mIgnoreFocus) {
|
|
|
|
printf(" mIgnoreFocus is TRUE\n");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIEventStateManager *stateManager;
|
|
|
|
if (NS_OK == mPresContext->GetEventStateManager(&stateManager)) {
|
|
|
|
printf("Before ------------------------\n");
|
|
|
|
mIgnoreFocus = PR_TRUE;
|
|
|
|
//stateManager->SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
|
|
|
|
stateManager->SetContentState(mDisplayContent, NS_EVENT_STATE_FOCUS);
|
|
|
|
//stateManager->SetContentState(mDisplayContent, NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_FOCUS);
|
|
|
|
mIgnoreFocus = PR_FALSE;
|
|
|
|
printf("After ------------------------\n");
|
|
|
|
NS_RELEASE(stateManager);
|
|
|
|
}
|
1999-08-06 14:42:00 +00:00
|
|
|
#endif
|
1999-08-06 14:13:20 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComboboxControlFrame::Blur(nsIDOMEvent* aEvent)
|
|
|
|
{
|
1999-08-06 14:42:00 +00:00
|
|
|
#if 0
|
1999-08-06 14:13:20 +00:00
|
|
|
printf("nsComboboxControlFrame::Blur ");
|
|
|
|
nsCOMPtr<nsIDOMNode> node;
|
|
|
|
aEvent->GetTarget(getter_AddRefs(node));
|
|
|
|
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
|
|
|
|
|
|
|
if (content == mContent) {
|
|
|
|
printf("Combobox\n");
|
|
|
|
} else if (content == mDisplayContent) {
|
|
|
|
printf("Display\n");
|
|
|
|
} else if (content == mButtonContent) {
|
|
|
|
printf("Button\n");
|
|
|
|
}
|
1999-08-06 14:42:00 +00:00
|
|
|
#endif
|
1999-08-06 14:13:20 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|