2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-08-06 09:13:07 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-08-06 09:13:07 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04: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.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-08-06 09:13:07 +04:00
|
|
|
|
|
|
|
#include "nsGfxButtonControlFrame.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"
|
2004-10-14 23:05:31 +04:00
|
|
|
#include "nsIFormControl.h"
|
2000-12-30 22:22:22 +03:00
|
|
|
#include "nsINameSpaceManager.h"
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-04-01 05:01:33 +04:00
|
|
|
#include "nsIAccessibilityService.h"
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-04-01 05:01:33 +04:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIDOMNode.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2003-02-22 03:32:13 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2004-01-28 03:18:22 +03:00
|
|
|
#include "nsStyleSet.h"
|
2004-12-17 23:40:48 +03:00
|
|
|
#include "nsContentUtils.h"
|
2002-05-23 15:25:58 +04:00
|
|
|
// MouseEvent suppression in PP
|
|
|
|
#include "nsGUIEvent.h"
|
2006-07-19 08:36:36 +04:00
|
|
|
#include "nsContentCreatorFunctions.h"
|
2001-04-01 05:01:33 +04:00
|
|
|
|
2004-06-25 16:26:02 +04:00
|
|
|
#include "nsNodeInfoManager.h"
|
2006-02-13 22:42:08 +03:00
|
|
|
#include "nsIDOMHTMLInputElement.h"
|
2001-02-06 04:31:18 +03:00
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
const nscoord kSuggestedNotSet = -1;
|
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
nsGfxButtonControlFrame::nsGfxButtonControlFrame(nsStyleContext* aContext):
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
nsHTMLButtonControlFrame(aContext)
|
1999-08-10 23:13:57 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-11-04 05:38:33 +03:00
|
|
|
nsIFrame*
|
2006-03-27 01:30:36 +04:00
|
|
|
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) nsGfxButtonControlFrame(aContext);
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|
2007-02-18 20:34:09 +03:00
|
|
|
|
|
|
|
void nsGfxButtonControlFrame::Destroy()
|
|
|
|
{
|
|
|
|
nsContentUtils::DestroyAnonymousContent(&mTextContent);
|
|
|
|
nsHTMLButtonControlFrame::Destroy();
|
|
|
|
}
|
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
nsIAtom*
|
|
|
|
nsGfxButtonControlFrame::GetType() const
|
2001-06-30 04:25:09 +04:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
return nsGkAtoms::gfxButtonControlFrame;
|
2001-06-30 04:25:09 +04:00
|
|
|
}
|
1999-08-10 23:13:57 +04:00
|
|
|
|
2000-02-21 08:55:25 +03:00
|
|
|
// Special check for the browse button of a file input.
|
|
|
|
//
|
2004-05-11 22:16:41 +04:00
|
|
|
// We'll return PR_TRUE if type is NS_FORM_INPUT_BUTTON and our parent
|
|
|
|
// is a file input.
|
2000-02-21 08:55:25 +03:00
|
|
|
PRBool
|
2002-09-16 10:23:52 +04:00
|
|
|
nsGfxButtonControlFrame::IsFileBrowseButton(PRInt32 type)
|
2000-02-21 08:55:25 +03:00
|
|
|
{
|
2000-02-23 23:56:39 +03:00
|
|
|
PRBool rv = PR_FALSE;
|
2004-05-11 22:16:41 +04:00
|
|
|
if (NS_FORM_INPUT_BUTTON == type) {
|
2000-02-21 08:55:25 +03:00
|
|
|
// Check to see if parent is a file input
|
2003-11-19 04:20:56 +03:00
|
|
|
nsCOMPtr<nsIFormControl> formCtrl =
|
|
|
|
do_QueryInterface(mContent->GetParent());
|
2000-02-23 23:56:39 +03:00
|
|
|
|
2004-05-11 22:16:41 +04:00
|
|
|
rv = formCtrl && formCtrl->GetType() == NS_FORM_INPUT_FILE;
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
2000-02-23 23:56:39 +03:00
|
|
|
return rv;
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1999-08-06 09:13:07 +04:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 04:33:42 +03:00
|
|
|
nsGfxButtonControlFrame::GetFrameName(nsAString& aResult) const
|
1999-08-06 09:13:07 +04:00
|
|
|
{
|
2001-11-14 04:33:42 +03:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("ButtonControl"), aResult);
|
1999-08-10 23:13:57 +04:00
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-08-06 09:13:07 +04:00
|
|
|
|
2000-02-21 08:55:25 +03:00
|
|
|
// Create the text content used as label for the button.
|
|
|
|
// The frame will be generated by the frame constructor.
|
2007-02-18 20:34:09 +03:00
|
|
|
nsresult
|
|
|
|
nsGfxButtonControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
2000-02-21 08:55:25 +03:00
|
|
|
{
|
2006-02-13 22:42:08 +03:00
|
|
|
nsXPIDLString label;
|
|
|
|
GetLabel(label);
|
2007-02-18 20:34:09 +03:00
|
|
|
|
2000-02-21 08:55:25 +03:00
|
|
|
// Add a child text content node for the label
|
2007-02-18 20:34:09 +03:00
|
|
|
NS_NewTextNode(getter_AddRefs(mTextContent),
|
2005-09-24 22:43:15 +04:00
|
|
|
mContent->NodeInfo()->NodeInfoManager());
|
2007-02-18 20:34:09 +03:00
|
|
|
if (!mTextContent)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
// set the value of the text node and add it to the child list
|
|
|
|
mTextContent->SetText(label, PR_FALSE);
|
|
|
|
if (!aElements.AppendElement(mTextContent))
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2005-10-28 15:25:24 +04:00
|
|
|
return NS_OK;
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
|
|
|
|
2000-08-23 14:38:42 +04:00
|
|
|
// Create the text content used as label for the button.
|
|
|
|
// The frame will be generated by the frame constructor.
|
2007-02-18 20:34:09 +03:00
|
|
|
nsIFrame*
|
|
|
|
nsGfxButtonControlFrame::CreateFrameFor(nsIContent* aContent)
|
2000-08-23 14:38:42 +04:00
|
|
|
{
|
|
|
|
nsIFrame * newFrame = nsnull;
|
|
|
|
|
2006-07-19 08:36:36 +04:00
|
|
|
if (aContent == mTextContent) {
|
2000-08-23 14:38:42 +04:00
|
|
|
nsIFrame * parentFrame = mFrames.FirstChild();
|
|
|
|
|
2007-03-31 01:11:41 +04:00
|
|
|
nsPresContext* presContext = PresContext();
|
2003-02-22 03:32:13 +03:00
|
|
|
nsRefPtr<nsStyleContext> textStyleContext;
|
2007-02-18 20:34:09 +03:00
|
|
|
textStyleContext = presContext->StyleSet()->
|
2007-06-16 09:11:20 +04:00
|
|
|
ResolveStyleForNonElement(mStyleContext);
|
2000-08-23 14:38:42 +04:00
|
|
|
|
2007-06-16 09:11:20 +04:00
|
|
|
if (textStyleContext) {
|
2007-02-18 20:34:09 +03:00
|
|
|
newFrame = NS_NewTextFrame(presContext->PresShell(), textStyleContext);
|
|
|
|
if (newFrame) {
|
|
|
|
// initialize the text frame
|
|
|
|
newFrame->Init(mTextContent, parentFrame, nsnull);
|
|
|
|
newFrame->SetInitialChildList(nsnull, nsnull);
|
2006-03-27 01:30:36 +04:00
|
|
|
}
|
2000-08-23 14:38:42 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-18 20:34:09 +03:00
|
|
|
return newFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsGfxButtonControlFrame::GetFormProperty(nsIAtom* aName, nsAString& aValue) const
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (nsGkAtoms::defaultLabel == aName) {
|
|
|
|
// This property is used by accessibility to get
|
|
|
|
// the default label of the button.
|
|
|
|
nsXPIDLString temp;
|
2007-07-08 11:08:04 +04:00
|
|
|
rv = const_cast<nsGfxButtonControlFrame*>(this)->GetDefaultLabel(temp);
|
2007-02-18 20:34:09 +03:00
|
|
|
aValue = temp;
|
|
|
|
} else {
|
|
|
|
aValue.Truncate();
|
2000-08-23 14:38:42 +04:00
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-18 03:52:32 +04:00
|
|
|
NS_IMETHODIMP nsGfxButtonControlFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
|
|
|
|
if (accService) {
|
2007-07-08 11:08:04 +04:00
|
|
|
return accService->CreateHTMLButtonAccessible(static_cast<nsIFrame*>(this), aAccessible);
|
2001-05-18 03:52:32 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2000-02-21 08:55:25 +03:00
|
|
|
// Frames are not refcounted, no need to AddRef
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsGfxButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|
|
|
{
|
2007-07-04 06:15:31 +04:00
|
|
|
NS_PRECONDITION(aInstancePtr, "null out param");
|
2001-02-06 04:31:18 +03:00
|
|
|
|
|
|
|
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
|
2007-07-08 11:08:04 +04:00
|
|
|
*aInstancePtr = static_cast<nsIAnonymousContentCreator*>(this);
|
2007-07-04 06:15:31 +04:00
|
|
|
return NS_OK;
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
2001-02-06 04:31:18 +03:00
|
|
|
|
2007-07-04 06:15:31 +04:00
|
|
|
return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr);
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Initially we hardcoded the default strings here.
|
|
|
|
// Next, we used html.css to store the default label for various types
|
|
|
|
// of buttons. (nsGfxButtonControlFrame::DoNavQuirksReflow rev 1.20)
|
|
|
|
// However, since html.css is not internationalized, we now grab the default
|
|
|
|
// label from a string bundle as is done for all other UI strings.
|
|
|
|
// See bug 16999 for further details.
|
2002-09-16 10:23:52 +04:00
|
|
|
nsresult
|
2007-02-18 20:34:09 +03:00
|
|
|
nsGfxButtonControlFrame::GetDefaultLabel(nsXPIDLString& aString)
|
2000-02-21 08:55:25 +03:00
|
|
|
{
|
2005-12-13 02:53:06 +03:00
|
|
|
nsCOMPtr<nsIFormControl> form = do_QueryInterface(mContent);
|
|
|
|
NS_ENSURE_TRUE(form, NS_ERROR_UNEXPECTED);
|
|
|
|
|
|
|
|
PRInt32 type = form->GetType();
|
2004-12-17 23:40:48 +03:00
|
|
|
const char *prop;
|
2002-09-16 10:23:52 +04:00
|
|
|
if (type == NS_FORM_INPUT_RESET) {
|
2004-12-17 23:40:48 +03:00
|
|
|
prop = "Reset";
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
2002-09-16 10:23:52 +04:00
|
|
|
else if (type == NS_FORM_INPUT_SUBMIT) {
|
2004-12-17 23:40:48 +03:00
|
|
|
prop = "Submit";
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
2002-09-16 10:23:52 +04:00
|
|
|
else if (IsFileBrowseButton(type)) {
|
2004-12-17 23:40:48 +03:00
|
|
|
prop = "Browse";
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
|
|
|
else {
|
2004-01-30 01:04:45 +03:00
|
|
|
aString.Truncate();
|
2004-12-17 23:40:48 +03:00
|
|
|
return NS_OK;
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
2004-12-17 23:40:48 +03:00
|
|
|
|
|
|
|
return nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
|
|
|
prop, aString);
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
|
|
|
|
2006-02-13 22:42:08 +03:00
|
|
|
nsresult
|
|
|
|
nsGfxButtonControlFrame::GetLabel(nsXPIDLString& aLabel)
|
|
|
|
{
|
2006-04-05 02:34:10 +04:00
|
|
|
// Get the text from the "value" property on our content if there is
|
|
|
|
// one; otherwise set it to a default value (localized).
|
|
|
|
nsresult rv;
|
2006-02-13 22:42:08 +03:00
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> elt = do_QueryInterface(mContent);
|
2006-04-05 02:34:10 +04:00
|
|
|
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value) && elt) {
|
2006-02-13 22:42:08 +03:00
|
|
|
rv = elt->GetValue(aLabel);
|
2006-04-05 02:34:10 +04:00
|
|
|
} else {
|
2006-02-13 22:42:08 +03:00
|
|
|
// Generate localized label.
|
|
|
|
// We can't make any assumption as to what the default would be
|
|
|
|
// because the value is localized for non-english platforms, thus
|
|
|
|
// it might not be the string "Reset", "Submit Query", or "Browse..."
|
|
|
|
rv = GetDefaultLabel(aLabel);
|
|
|
|
}
|
|
|
|
|
2006-04-05 02:34:10 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// Compress whitespace out of label if needed.
|
2006-02-13 22:42:08 +03:00
|
|
|
if (!GetStyleText()->WhiteSpaceIsSignificant()) {
|
|
|
|
aLabel.CompressWhitespace();
|
|
|
|
} else if (aLabel.Length() > 2 && aLabel.First() == ' ' &&
|
|
|
|
aLabel.CharAt(aLabel.Length() - 1) == ' ') {
|
|
|
|
// This is a bit of a hack. The reason this is here is as follows: we now
|
|
|
|
// have default padding on our buttons to make them non-ugly.
|
|
|
|
// Unfortunately, IE-windows does not have such padding, so people will
|
|
|
|
// stick values like " ok " (with the spaces) in the buttons in an attempt
|
|
|
|
// to make them look decent. Unfortunately, if they do this the button
|
|
|
|
// looks way too big in Mozilla. Worse yet, if they do this _and_ set a
|
|
|
|
// fixed width for the button we run into trouble because our focus-rect
|
|
|
|
// border/padding and outer border take up 10px of the horizontal button
|
|
|
|
// space or so; the result is that the text is misaligned, even with the
|
|
|
|
// recentering we do in nsHTMLButtonFrame::Reflow. So to solve this, even
|
|
|
|
// if the whitespace is significant, single leading and trailing _spaces_
|
|
|
|
// (and not other whitespace) are removed. The proper solution, of
|
|
|
|
// course, is to not have the focus rect painting taking up 6px of
|
|
|
|
// horizontal space. We should do that instead (via XBL form controls or
|
|
|
|
// changing the renderer) and remove this.
|
|
|
|
aLabel.Cut(0, 1);
|
|
|
|
aLabel.Truncate(aLabel.Length() - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-02-21 08:55:25 +03:00
|
|
|
NS_IMETHODIMP
|
2005-09-07 20:49:21 +04:00
|
|
|
nsGfxButtonControlFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
2004-12-31 04:13:27 +03:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType)
|
2000-02-21 08:55:25 +03:00
|
|
|
{
|
2000-02-23 23:56:39 +03:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2000-02-21 08:55:25 +03:00
|
|
|
// If the value attribute is set, update the text of the label
|
2006-12-26 20:47:52 +03:00
|
|
|
if (nsGkAtoms::value == aAttribute) {
|
2000-02-23 23:56:39 +03:00
|
|
|
if (mTextContent && mContent) {
|
2006-02-13 22:42:08 +03:00
|
|
|
nsXPIDLString label;
|
|
|
|
rv = GetLabel(label);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
mTextContent->SetText(label, PR_TRUE);
|
2000-02-23 23:56:39 +03:00
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_UNEXPECTED;
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
|
|
|
|
2000-02-23 23:56:39 +03:00
|
|
|
// defer to HTMLButtonControlFrame
|
|
|
|
} else {
|
2005-09-07 20:49:21 +04:00
|
|
|
rv = nsHTMLButtonControlFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
|
2000-02-23 23:56:39 +03:00
|
|
|
}
|
|
|
|
return rv;
|
2000-02-21 08:55:25 +03:00
|
|
|
}
|
|
|
|
|
2005-08-17 02:52:48 +04:00
|
|
|
PRBool
|
|
|
|
nsGfxButtonControlFrame::IsLeaf() const
|
|
|
|
{
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
2007-02-17 17:14:08 +03:00
|
|
|
nsIFrame*
|
|
|
|
nsGfxButtonControlFrame::GetContentInsertionFrame()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
1999-08-06 09:13:07 +04:00
|
|
|
NS_IMETHODIMP
|
2004-08-01 03:15:21 +04:00
|
|
|
nsGfxButtonControlFrame::HandleEvent(nsPresContext* 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)
|
|
|
|
|
2000-08-09 03:38:00 +04:00
|
|
|
// do we have user-input style?
|
2003-05-15 07:42:21 +04:00
|
|
|
const nsStyleUserInterface* uiStyle = GetStyleUserInterface();
|
2000-08-09 03:38:00 +04:00
|
|
|
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
|
|
|
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
|
|
|
|
1999-08-10 23:13:57 +04:00
|
|
|
return NS_OK;
|
1999-08-06 09:13:07 +04:00
|
|
|
}
|