1999-08-06 09:13:07 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-08-06 09:13:07 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-08-06 09:13:07 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-08-06 09:13:07 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-08-06 09:13:07 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsGfxButtonControlFrame.h"
|
|
|
|
#include "nsIButton.h"
|
1999-08-10 23:13:57 +04:00
|
|
|
#include "nsWidgetsCID.h"
|
1999-11-23 01:04:53 +03:00
|
|
|
#include "nsIFontMetrics.h"
|
2000-01-09 05:07:00 +03:00
|
|
|
#include "nsFormControlFrame.h"
|
1999-08-06 09:13:07 +04:00
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
1999-08-06 09:13:07 +04:00
|
|
|
static NS_DEFINE_IID(kIButtonIID, NS_IBUTTON_IID);
|
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
const nscoord kSuggestedNotSet = -1;
|
|
|
|
|
|
|
|
nsGfxButtonControlFrame::nsGfxButtonControlFrame()
|
|
|
|
{
|
|
|
|
mRenderer.SetNameSpace(kNameSpaceID_None);
|
|
|
|
mSuggestedWidth = kSuggestedNotSet;
|
|
|
|
mSuggestedHeight = kSuggestedNotSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsGfxButtonControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter)
|
|
|
|
{
|
|
|
|
PRInt32 type;
|
|
|
|
GetType(&type);
|
|
|
|
if ((NS_FORM_INPUT_HIDDEN == type) || (this == aSubmitter)) {
|
1999-08-13 02:06:09 +04:00
|
|
|
// Can not use the nsHTMLButtonControlFrame::IsSuccessful because
|
|
|
|
// it will fail it's test of (this==aSubmitter)
|
|
|
|
nsAutoString name;
|
|
|
|
return (NS_CONTENT_ATTR_HAS_VALUE == GetName(&name));
|
1999-08-10 23:13:57 +04:00
|
|
|
} else {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsGfxButtonControlFrame::GetMaxNumValues()
|
|
|
|
{
|
|
|
|
PRInt32 type;
|
|
|
|
GetType(&type);
|
|
|
|
if ((NS_FORM_INPUT_SUBMIT == type) || (NS_FORM_INPUT_HIDDEN == type)) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsGfxButtonControlFrame::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;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 type;
|
|
|
|
GetType(&type);
|
|
|
|
|
|
|
|
if (NS_FORM_INPUT_RESET == type) {
|
|
|
|
aNumValues = 0;
|
|
|
|
return PR_FALSE;
|
|
|
|
} else {
|
|
|
|
nsAutoString value;
|
|
|
|
GetValue(&value);
|
|
|
|
aValues[0] = value;
|
|
|
|
aNames[0] = name;
|
|
|
|
aNumValues = 1;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-06 09:13:07 +04:00
|
|
|
nsresult
|
1999-12-05 02:49:50 +03:00
|
|
|
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-05 02:49:50 +03:00
|
|
|
nsGfxButtonControlFrame* it = new (aPresShell) nsGfxButtonControlFrame;
|
1999-08-06 09:13:07 +04:00
|
|
|
if (!it) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
*aNewFrame = it;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-09-14 00:40:59 +04:00
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
|
1999-09-14 00:40:59 +04:00
|
|
|
PRBool
|
|
|
|
nsGfxButtonControlFrame::IsReset(PRInt32 type)
|
|
|
|
{
|
|
|
|
if (NS_FORM_INPUT_RESET == type) {
|
|
|
|
return PR_TRUE;
|
|
|
|
} else {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
|
|
|
|
1999-09-14 00:40:59 +04:00
|
|
|
PRBool
|
|
|
|
nsGfxButtonControlFrame::IsSubmit(PRInt32 type)
|
|
|
|
{
|
|
|
|
if (NS_FORM_INPUT_SUBMIT == type) {
|
|
|
|
return PR_TRUE;
|
|
|
|
} else {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
const nsIID&
|
|
|
|
nsGfxButtonControlFrame::GetIID()
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
1999-08-10 23:13:57 +04:00
|
|
|
static NS_DEFINE_IID(kButtonIID, NS_IBUTTON_IID);
|
|
|
|
return kButtonIID;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsIID&
|
|
|
|
nsGfxButtonControlFrame::GetCID()
|
|
|
|
{
|
|
|
|
static NS_DEFINE_IID(kButtonCID, NS_BUTTON_CID);
|
|
|
|
return kButtonCID;
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1999-08-06 09:13:07 +04:00
|
|
|
NS_IMETHODIMP
|
1999-08-10 23:13:57 +04:00
|
|
|
nsGfxButtonControlFrame::GetFrameName(nsString& aResult) const
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
1999-08-10 23:13:57 +04:00
|
|
|
return MakeFrameName("ButtonControl", aResult);
|
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-08-06 09:13:07 +04:00
|
|
|
|
1999-08-31 17:03:38 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxButtonControlFrame::AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aSuggestedReflowState)
|
|
|
|
{
|
|
|
|
if (kSuggestedNotSet == mSuggestedWidth) {
|
|
|
|
aDesiredSize.width += aSuggestedReflowState.mComputedBorderPadding.left + aSuggestedReflowState.mComputedBorderPadding.right;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kSuggestedNotSet == mSuggestedHeight) {
|
|
|
|
aDesiredSize.height += aSuggestedReflowState.mComputedBorderPadding.top + aSuggestedReflowState.mComputedBorderPadding.bottom;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-23 01:04:53 +03:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext,
|
1999-11-23 01:04:53 +03:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
|
|
|
nsIFrame* firstKid = mFrames.FirstChild();
|
|
|
|
|
|
|
|
nsCOMPtr<nsIFontMetrics> fontMet;
|
|
|
|
nsFormControlHelper::GetFrameFontFM(aPresContext, (nsIFormControlFrame *)this, getter_AddRefs(fontMet));
|
|
|
|
nsSize desiredSize;
|
|
|
|
if (fontMet) {
|
|
|
|
aReflowState.rendContext->SetFont(fontMet);
|
|
|
|
|
|
|
|
// Get the text from the "value" attribute
|
|
|
|
// for measuring the height, width of the text
|
|
|
|
// if there is no value attr or its length is 0
|
|
|
|
// then go to the generated content to get it
|
|
|
|
nsAutoString value;
|
|
|
|
GetValue(&value);
|
|
|
|
|
1999-11-24 23:59:49 +03:00
|
|
|
// if there was no value specified
|
1999-11-23 01:04:53 +03:00
|
|
|
// then go get the content of the generated content
|
|
|
|
// we can't make any assumption as to what the default would be
|
|
|
|
// because of the value is specified in the html.css and for
|
|
|
|
// for non-english platforms it might not be the string
|
|
|
|
// "Reset" or "Submit Query"
|
1999-11-24 23:59:49 +03:00
|
|
|
if (value.Length() == 0) {
|
1999-11-23 01:04:53 +03:00
|
|
|
value = " ";
|
|
|
|
// The child frame will br the generated content
|
|
|
|
nsIFrame* fKid;
|
|
|
|
firstKid->FirstChild(nsnull, &fKid);
|
|
|
|
if (fKid) {
|
|
|
|
const nsStyleContent* content;
|
|
|
|
fKid->GetStyleData(eStyleStruct_Content, (const nsStyleStruct *&)content);
|
|
|
|
PRUint32 count = content->ContentCount();
|
|
|
|
// XXX not sure if I need to get more than the first index?
|
|
|
|
if (count > 0) {
|
1999-11-23 17:16:59 +03:00
|
|
|
nsStyleContentType contentType = eStyleContentType_String;
|
|
|
|
content->GetContentAt(0, contentType, value);
|
1999-11-23 01:04:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-12-05 23:48:37 +03:00
|
|
|
const nsStyleText* textStyle;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct *&)textStyle);
|
|
|
|
if (!textStyle->WhiteSpaceIsSignificant()) {
|
|
|
|
value.CompressWhitespace();
|
|
|
|
if (value.Length() == 0) {
|
|
|
|
value = " ";
|
|
|
|
}
|
|
|
|
}
|
1999-11-23 01:04:53 +03:00
|
|
|
|
|
|
|
nsInputDimensionSpec btnSpec(NULL, PR_FALSE, nsnull,
|
|
|
|
&value,0,
|
|
|
|
PR_FALSE, NULL, 1);
|
|
|
|
nsFormControlHelper::CalcNavQuirkSizing(aPresContext, aReflowState.rendContext,
|
|
|
|
fontMet, (nsIFormControlFrame*)this,
|
|
|
|
btnSpec, desiredSize);
|
|
|
|
|
|
|
|
// This calculates the reflow size
|
|
|
|
// get the css size and let the frame use or override it
|
|
|
|
nsSize styleSize;
|
|
|
|
nsFormControlFrame::GetStyleSize(aPresContext, aReflowState, styleSize);
|
|
|
|
|
|
|
|
if (CSS_NOTSET != styleSize.width) { // css provides width
|
|
|
|
NS_ASSERTION(styleSize.width >= 0, "form control's computed width is < 0");
|
|
|
|
if (NS_INTRINSICSIZE != styleSize.width) {
|
|
|
|
desiredSize.width = styleSize.width;
|
|
|
|
desiredSize.width += aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CSS_NOTSET != styleSize.height) { // css provides height
|
|
|
|
NS_ASSERTION(styleSize.height > 0, "form control's computed height is <= 0");
|
|
|
|
if (NS_INTRINSICSIZE != styleSize.height) {
|
|
|
|
desiredSize.height = styleSize.height;
|
|
|
|
desiredSize.height += aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aDesiredSize.width = desiredSize.width;
|
|
|
|
aDesiredSize.height = desiredSize.height;
|
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
|
|
|
} else {
|
|
|
|
// XXX ASSERT HERE
|
|
|
|
desiredSize.width = 0;
|
|
|
|
desiredSize.height = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get border and padding
|
|
|
|
/*const nsStyleSpacing* spacing;
|
|
|
|
GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct *&)spacing);
|
|
|
|
nsMargin borderPadding;
|
|
|
|
borderPadding.SizeTo(0, 0, 0, 0);
|
|
|
|
spacing->CalcBorderPaddingFor(this, borderPadding);
|
|
|
|
*/
|
|
|
|
// remove it from the the desired size
|
|
|
|
// because the content need to fit inside of it
|
|
|
|
desiredSize.width -= (aReflowState.mComputedBorderPadding.left + aReflowState.mComputedBorderPadding.right);
|
|
|
|
desiredSize.height -= (aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom);
|
|
|
|
|
|
|
|
// now reflow the first child (genertaed content)
|
|
|
|
nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, desiredSize);
|
|
|
|
reflowState.mComputedWidth = desiredSize.width;
|
|
|
|
reflowState.mComputedHeight = desiredSize.height;
|
|
|
|
// XXX Proper handling of incremental reflow...
|
|
|
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
|
|
|
nsIFrame* targetFrame;
|
|
|
|
|
|
|
|
// See if it's targeted at us
|
|
|
|
aReflowState.reflowCommand->GetTarget(targetFrame);
|
|
|
|
if (this == targetFrame) {
|
1999-11-24 09:03:41 +03:00
|
|
|
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
|
1999-11-23 01:04:53 +03:00
|
|
|
|
|
|
|
nsIReflowCommand::ReflowType reflowType;
|
|
|
|
aReflowState.reflowCommand->GetType(reflowType);
|
|
|
|
if (nsIReflowCommand::StyleChanged == reflowType) {
|
|
|
|
reflowState.reason = eReflowReason_StyleChange;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
reflowState.reason = eReflowReason_Resize;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nsIFrame* nextFrame;
|
|
|
|
|
|
|
|
// Remove the next frame from the reflow path
|
|
|
|
aReflowState.reflowCommand->GetNext(nextFrame);
|
|
|
|
}
|
|
|
|
}
|
1999-11-24 23:59:49 +03:00
|
|
|
|
1999-11-23 01:04:53 +03:00
|
|
|
nsHTMLReflowMetrics childReflowMetrics(aDesiredSize);
|
|
|
|
nsRect kidRect;
|
|
|
|
firstKid->GetRect(kidRect);
|
|
|
|
ReflowChild(firstKid, aPresContext, childReflowMetrics, reflowState, kidRect.x, kidRect.y, 0, aStatus);
|
|
|
|
|
|
|
|
// Now do the reverse calculation of the
|
|
|
|
// NavQuirks button to get the size of the text
|
|
|
|
nscoord textWidth = (2 * aDesiredSize.width) / 3;
|
|
|
|
nscoord textHeight = (2 * aDesiredSize.height) / 3;
|
|
|
|
|
|
|
|
// Center the child and add back in the border and badding
|
|
|
|
nsRect rect = nsRect(((desiredSize.width - textWidth)/2)+ aReflowState.mComputedBorderPadding.left,
|
|
|
|
((desiredSize.height - textHeight)/2) + aReflowState.mComputedBorderPadding.top,
|
|
|
|
desiredSize.width,
|
|
|
|
desiredSize.height);
|
1999-11-24 09:03:41 +03:00
|
|
|
firstKid->SetRect(aPresContext, rect);
|
1999-11-23 01:04:53 +03:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
1999-10-08 01:07:38 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
1999-09-14 00:40:59 +04:00
|
|
|
// The mFormFrame is set in the initial reflow within nsHTMLButtonControlFrame
|
1999-10-08 01:07:38 +04:00
|
|
|
nsresult rv = NS_OK;
|
1999-11-25 00:37:34 +03:00
|
|
|
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
|
|
|
|
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
|
|
|
|
}
|
1999-08-06 09:13:07 +04:00
|
|
|
|
2000-01-09 05:07:00 +03:00
|
|
|
#if 1
|
|
|
|
nsresult skiprv = nsFormControlFrame::SkipResizeReflow(mCacheSize, mCachedMaxElementSize, aPresContext,
|
|
|
|
aDesiredSize, aReflowState, aStatus);
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(skiprv)) {
|
|
|
|
return skiprv;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
if ((kSuggestedNotSet != mSuggestedWidth) ||
|
1999-08-31 17:03:38 +04:00
|
|
|
(kSuggestedNotSet != mSuggestedHeight)) {
|
1999-08-10 23:13:57 +04:00
|
|
|
nsHTMLReflowState suggestedReflowState(aReflowState);
|
1999-08-31 17:03:38 +04:00
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
// Honor the suggested width and/or height.
|
|
|
|
if (kSuggestedNotSet != mSuggestedWidth) {
|
|
|
|
suggestedReflowState.mComputedWidth = mSuggestedWidth;
|
|
|
|
}
|
1999-08-06 09:13:07 +04:00
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
if (kSuggestedNotSet != mSuggestedHeight) {
|
|
|
|
suggestedReflowState.mComputedHeight = mSuggestedHeight;
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
|
|
|
|
1999-10-08 01:07:38 +04:00
|
|
|
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, suggestedReflowState, aStatus);
|
1999-08-06 09:13:07 +04:00
|
|
|
|
1999-08-31 17:03:38 +04:00
|
|
|
} else { // Normal reflow.
|
1999-11-23 01:04:53 +03:00
|
|
|
|
|
|
|
nsCompatibility mode;
|
1999-11-24 09:03:41 +03:00
|
|
|
aPresContext->GetCompatibilityMode(&mode);
|
1999-11-23 01:04:53 +03:00
|
|
|
|
|
|
|
if (mode == eCompatibility_NavQuirks) {
|
|
|
|
// Do NavQuirks Sizing and layout
|
|
|
|
rv = DoNavQuirksReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
|
|
|
} else {
|
|
|
|
// Do Standard mode sizing and layout
|
|
|
|
rv = nsHTMLButtonControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
|
|
|
}
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
1999-10-08 01:07:38 +04:00
|
|
|
|
1999-11-24 23:59:49 +03:00
|
|
|
#ifdef DEBUG_rodsXXXX
|
1999-11-23 01:04:53 +03:00
|
|
|
COMPARE_QUIRK_SIZE("nsGfxButtonControlFrame", 84, 24) // with the text "Press Me" in it
|
|
|
|
#endif
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1999-10-08 01:07:38 +04:00
|
|
|
|
2000-01-09 05:07:00 +03:00
|
|
|
nsFormControlFrame::SetupCachedSizes(mCacheSize, mCachedMaxElementSize, aDesiredSize);
|
|
|
|
|
1999-10-08 01:07:38 +04:00
|
|
|
return rv;
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxButtonControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight)
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
1999-08-10 23:13:57 +04:00
|
|
|
mSuggestedWidth = aWidth;
|
|
|
|
mSuggestedHeight = aHeight;
|
|
|
|
return NS_OK;
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsGfxButtonControlFrame::HandleEvent(nsIPresContext* aPresContext,
|
1999-08-10 23:13:57 +04:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 09:03:41 +03:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
1999-08-10 23:13:57 +04:00
|
|
|
// Override the HandleEvent to prevent the nsFrame::HandleEvent
|
|
|
|
// from being called. The nsFrame::HandleEvent causes the button label
|
|
|
|
// to be selected (Drawn with an XOR rectangle over the label)
|
|
|
|
|
1999-08-06 09:13:07 +04:00
|
|
|
// if disabled do nothing
|
|
|
|
if (mRenderer.isDisabled()) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
// lets see if the button was clicked
|
|
|
|
switch (aEvent->message) {
|
|
|
|
case NS_MOUSE_LEFT_CLICK:
|
1999-11-24 09:03:41 +03:00
|
|
|
MouseClicked(aPresContext);
|
1999-08-10 23:13:57 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
1999-08-10 23:13:57 +04:00
|
|
|
|
|
|
|
|