From eb2b8ef385819e8337d6b06cd9e3ebf2153a07c2 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Fri, 16 Apr 1999 18:07:51 +0000 Subject: [PATCH] fix bustage --- layout/xul/base/src/nsTriStateCheckboxFrame.cpp | 15 ++++++++++++--- layout/xul/base/src/nsTriStateCheckboxFrame.h | 8 ++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/layout/xul/base/src/nsTriStateCheckboxFrame.cpp b/layout/xul/base/src/nsTriStateCheckboxFrame.cpp index 2e22ad292ba..d5c9a76c6b4 100644 --- a/layout/xul/base/src/nsTriStateCheckboxFrame.cpp +++ b/layout/xul/base/src/nsTriStateCheckboxFrame.cpp @@ -32,6 +32,7 @@ #include "nsINameSpaceManager.h" + // // NS_NewTriStateCheckboxFrame // @@ -53,7 +54,11 @@ NS_NewTriStateCheckboxFrame(nsIFrame*& aResult) nsTriStateCheckboxFrame::nsTriStateCheckboxFrame() : mMouseDownOnCheckbox(PR_FALSE), nsLeafFrame() { -} + // create an atom for the "depress" attribute if it hasn't yet been created. +// if ( !sDepressAtom ) +// sDepressAtom = dont_QueryInterface(NS_NewAtom("depress")); + +} // cntr // @@ -214,12 +219,16 @@ nsTriStateCheckboxFrame::HandleEvent(nsIPresContext& aPresContext, break; case NS_MOUSE_LEFT_BUTTON_DOWN: - // set "hover" state so CSS redraws us + // set "depressed" state so CSS redraws us +// if ( NS_SUCCEEDED(mContent->SetAttribute(kNameSpaceID_None, sDepressAtom, NS_STRING_TRUE, PR_TRUE)) ) +// Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_TRUE); mMouseDownOnCheckbox = PR_TRUE; break; case NS_MOUSE_EXIT: - // clear hover state so css redraws us + // clear "depressed" state so css redraws us + if ( NS_SUCCEEDED(mContent->UnsetAttribute(kNameSpaceID_None, sDepressAtom, PR_TRUE)) ) + Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_TRUE); mMouseDownOnCheckbox = PR_FALSE; break; diff --git a/layout/xul/base/src/nsTriStateCheckboxFrame.h b/layout/xul/base/src/nsTriStateCheckboxFrame.h index 62044158f45..67e24a6583d 100644 --- a/layout/xul/base/src/nsTriStateCheckboxFrame.h +++ b/layout/xul/base/src/nsTriStateCheckboxFrame.h @@ -42,14 +42,14 @@ #define nsTriStateCheckboxFrame_h__ -#include "nsFormControlFrame.h" #include "nsLeafFrame.h" #include "prtypes.h" +#include "nsIAtom.h" +#include "nsCOMPtr.h" class nsIPresContext; class nsString; class nsIContent; -class nsIAtom; nsresult NS_NewTriStateCheckboxFrame(nsIFrame*& aResult) ; @@ -102,6 +102,10 @@ protected: //GFX-rendered state variables PRBool mMouseDownOnCheckbox; + + // atom for the "depress" attribute. We will have a CSS rule that + // when this is set, draws the button depressed. + //static nsCOMPtr sDepressAtom; }; // class nsTriStateCheckboxFrame