add OptionDisabled so the nsHTMLOptionElement can notify a select that an option

has just been disabled
This commit is contained in:
rods%netscape.com 2000-04-28 23:24:59 +00:00
Родитель 4a8f41d458
Коммит e61ef4520c
12 изменённых файлов: 113 добавлений и 13 удалений

Просмотреть файл

@ -1319,6 +1319,8 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
nsIScrollableFrame * scrollFrame;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
nsIFrame * incrementalChild;
aReflowState.reflowCommand->GetNext(incrementalChild);
nsRect rect;
plainLstFrame->GetRect(rect);
nsresult rvv = plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
@ -1979,6 +1981,20 @@ nsComboboxControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
return rv;
}
NS_IMETHODIMP
nsComboboxControlFrame::OptionDisabled(nsIContent * aContent)
{
nsISelectControlFrame* listFrame = nsnull;
nsIFrame* dropdownFrame = GetDropdownFrame();
nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame),
(void**)&listFrame);
if (NS_SUCCEEDED(rv) && listFrame) {
rv = listFrame->OptionDisabled(aContent);
NS_RELEASE(listFrame);
}
return rv;
}
NS_IMETHODIMP
nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
nsGUIEvent* aEvent,
@ -2403,9 +2419,9 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
#endif
nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer);
if (kGoodToGo) {
return NS_OK;
}
//if (kGoodToGo) {
// return NS_OK;
//}
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
if (mDisplayFrame) {

Просмотреть файл

@ -28,8 +28,8 @@
#endif
#ifdef DEBUG_rods
//#define DO_REFLOW_DEBUG
//#define DO_REFLOW_COUNTER
#define DO_REFLOW_DEBUG
#define DO_REFLOW_COUNTER
//#define DO_UNCONSTRAINED_CHECK
//#define DO_PIXELS
//#define DO_NEW_REFLOW
@ -170,6 +170,7 @@ public:
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
NS_IMETHOD OptionDisabled(nsIContent * aContent);
//nsIStatefulFrame
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);

Просмотреть файл

@ -66,6 +66,12 @@ public:
*/
NS_IMETHOD DoneAddingContent(PRBool aIsDone) = 0;
/**
* Notification that an option has been disabled
*/
NS_IMETHOD OptionDisabled(nsIContent * aContent) = 0;
};
#endif

Просмотреть файл

@ -2341,6 +2341,16 @@ nsListControlFrame::GetOptionsContainer(nsIPresContext* aPresContext, nsIFrame**
return FirstChild(aPresContext, nsnull, aFrame);
}
NS_IMETHODIMP
nsListControlFrame::OptionDisabled(nsIContent * aContent)
{
if (IsContentSelected(aContent)) {
PRInt32 inx = GetSelectedIndexFromContent(aContent);
SetOptionSelected(inx, PR_FALSE);
}
return NS_OK;
}
// Send out an onchange notification.
nsresult
nsListControlFrame::SelectionChanged(nsIContent* aContent)

Просмотреть файл

@ -150,6 +150,7 @@ public:
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
NS_IMETHOD OptionDisabled(nsIContent * aContent);
//nsIStatefulFrame
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);

Просмотреть файл

@ -66,6 +66,12 @@ public:
*/
NS_IMETHOD DoneAddingContent(PRBool aIsDone) = 0;
/**
* Notification that an option has been disabled
*/
NS_IMETHOD OptionDisabled(nsIContent * aContent) = 0;
};
#endif

Просмотреть файл

@ -1319,6 +1319,8 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
plainLstFrame->FirstChild(aPresContext, nsnull, &frame);
nsIScrollableFrame * scrollFrame;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void**)&scrollFrame))) {
nsIFrame * incrementalChild;
aReflowState.reflowCommand->GetNext(incrementalChild);
nsRect rect;
plainLstFrame->GetRect(rect);
nsresult rvv = plainLstFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
@ -1979,6 +1981,20 @@ nsComboboxControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
return rv;
}
NS_IMETHODIMP
nsComboboxControlFrame::OptionDisabled(nsIContent * aContent)
{
nsISelectControlFrame* listFrame = nsnull;
nsIFrame* dropdownFrame = GetDropdownFrame();
nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame),
(void**)&listFrame);
if (NS_SUCCEEDED(rv) && listFrame) {
rv = listFrame->OptionDisabled(aContent);
NS_RELEASE(listFrame);
}
return rv;
}
NS_IMETHODIMP
nsComboboxControlFrame::HandleEvent(nsIPresContext* aPresContext,
nsGUIEvent* aEvent,
@ -2403,9 +2419,9 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
#endif
nsAreaFrame::Paint(aPresContext,aRenderingContext,aDirtyRect,aWhichLayer);
if (kGoodToGo) {
return NS_OK;
}
//if (kGoodToGo) {
// return NS_OK;
//}
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
if (mDisplayFrame) {

Просмотреть файл

@ -28,8 +28,8 @@
#endif
#ifdef DEBUG_rods
//#define DO_REFLOW_DEBUG
//#define DO_REFLOW_COUNTER
#define DO_REFLOW_DEBUG
#define DO_REFLOW_COUNTER
//#define DO_UNCONSTRAINED_CHECK
//#define DO_PIXELS
//#define DO_NEW_REFLOW
@ -170,6 +170,7 @@ public:
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
NS_IMETHOD OptionDisabled(nsIContent * aContent);
//nsIStatefulFrame
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);

Просмотреть файл

@ -356,6 +356,11 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
nsFrameState state;
GetFrameState(&state);
state |= NS_FRAME_HAS_DIRTY_CHILDREN;
SetFrameState(state);
DO_GLOBAL_REFLOW_COUNT("nsGfxListControlFrame", aReflowState.reason);
REFLOW_COUNTER_REQUEST();
@ -2561,6 +2566,16 @@ nsGfxListControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
return NS_OK;
}
NS_IMETHODIMP
nsGfxListControlFrame::OptionDisabled(nsIContent * aContent)
{
if (IsContentSelected(aContent)) {
PRInt32 inx = GetSelectedIndexFromContent(aContent);
SetOptionSelected(inx, PR_FALSE);
}
return NS_OK;
}
//----------------------------------------------------------------------
// End nsISelectControlFrame
//----------------------------------------------------------------------
@ -3154,7 +3169,23 @@ nsGfxListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
} else {
nsIFrame * parentFrame;
frame->GetParent(&parentFrame);
stateManager->GetEventTarget(&frame);
#if 0
nsCOMPtr<nsIScrollableFrame> scrollable(do_QueryInterface(parentFrame));
if (scrollable) {
if (!IsClickingInCombobox(aMouseEvent)) {
return NS_OK;
}
}
nsIFrame * parentsParentFrame;
frame->GetParent(&parentsParentFrame);
nsCOMPtr<nsIScrollableFrame> parentScrollable(do_QueryInterface(parentsParentFrame));
if (parentScrollable) {
if (!IsClickingInCombobox(aMouseEvent)) {
return NS_OK;
}
}
//stateManager->GetEventTarget(&frame);
#endif
listFrame = do_QueryInterface(frame);
if (listFrame) {
if (!IsClickingInCombobox(aMouseEvent)) {

Просмотреть файл

@ -27,8 +27,8 @@
#endif
#ifdef DEBUG_rods
#define DO_REFLOW_DEBUG
#define DO_REFLOW_COUNTER
//#define DO_REFLOW_DEBUG
//#define DO_REFLOW_COUNTER
//#define DO_UNCONSTRAINED_CHECK
//#define DO_PIXELS
#define DO_DRAGGING
@ -249,6 +249,7 @@ public:
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
NS_IMETHOD OptionDisabled(nsIContent * aContent);
//nsIStatefulFrame
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);

Просмотреть файл

@ -2341,6 +2341,16 @@ nsListControlFrame::GetOptionsContainer(nsIPresContext* aPresContext, nsIFrame**
return FirstChild(aPresContext, nsnull, aFrame);
}
NS_IMETHODIMP
nsListControlFrame::OptionDisabled(nsIContent * aContent)
{
if (IsContentSelected(aContent)) {
PRInt32 inx = GetSelectedIndexFromContent(aContent);
SetOptionSelected(inx, PR_FALSE);
}
return NS_OK;
}
// Send out an onchange notification.
nsresult
nsListControlFrame::SelectionChanged(nsIContent* aContent)

Просмотреть файл

@ -150,6 +150,7 @@ public:
NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue);
NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
NS_IMETHOD DoneAddingContent(PRBool aIsDone);
NS_IMETHOD OptionDisabled(nsIContent * aContent);
//nsIStatefulFrame
NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType);