From 92543253ec925b353f86d70fb7703491a3136918 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Thu, 19 Aug 1999 14:05:36 +0000 Subject: [PATCH] Now, check to see if it is disabled or whether the control it cantains is disabled and then does the right thinik with the events git-svn-id: svn://10.0.0.236/trunk@43596 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/html/forms/src/nsLabelFrame.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index 01ec974d2e3..12051e5e848 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -65,6 +65,7 @@ static NS_DEFINE_IID(kViewCID, NS_VIEW_CID); static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID); static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IHTMLDOCUMENT_IID); static NS_DEFINE_IID(kIFormIID, NS_IFORM_IID); +static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); class nsLabelFrame : public nsHTMLContainerFrame { @@ -160,10 +161,32 @@ nsLabelFrame::HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus) { + // if we don't have a control to send the event to + // then what is the point? if (!mControlFrame) { return NS_OK; } + // check to see if the label is disabled and if not, + // then check to see if the control in the label is disabled + if (nsEventStatus_eConsumeNoDefault != aEventStatus) { + if ( nsFormFrame::GetDisabled(this) ) { + return NS_OK; + } else { + nsIFrame * frame; + if (NS_OK == mControlFrame->QueryInterface(kIFrameIID, (void**)&frame)) { + if ( nsFormFrame::GetDisabled(frame)) { + return NS_OK; + } + } else { + // if I can't get the nsIFrame something is really wrong + // so leave + return NS_OK; + } + } + } + + // send the mouse click events down into the control aEventStatus = nsEventStatus_eIgnore; switch (aEvent->message) { case NS_MOUSE_LEFT_BUTTON_DOWN: