Making events for arbitrary HTML still work in tree cells.

This commit is contained in:
hyatt%netscape.com 1999-01-27 12:42:21 +00:00
Родитель 9eef28cab4
Коммит 902e7c0207
6 изменённых файлов: 24 добавлений и 8 удалений

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

@ -59,6 +59,7 @@ public:
static nsIAtom* treecell; // A cell in the tree view
static nsIAtom* treechildren; // The children of an item in the tree viw
static nsIAtom* treeindentation; // Specifies that the indentation for the level should occur here.
static nsIAtom* treeallowevents; // Lets events be handled on the cell contents.
static nsIAtom* widget;
static nsIAtom* window;

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

@ -41,6 +41,7 @@ nsIAtom* nsXULAtoms::treerow;
nsIAtom* nsXULAtoms::treecell;
nsIAtom* nsXULAtoms::treechildren;
nsIAtom* nsXULAtoms::treeindentation;
nsIAtom* nsXULAtoms::treeallowevents;
nsIAtom* nsXULAtoms::widget;
nsIAtom* nsXULAtoms::window;
@ -77,6 +78,7 @@ void nsXULAtoms::AddrefAtoms() {
treeitem = NS_NewAtom("treeitem");
treechildren = NS_NewAtom("treechildren");
treeindentation = NS_NewAtom("treeindentation");
treeallowevents = NS_NewAtom("treeallowevents");
widget = NS_NewAtom("widget");
window = NS_NewAtom("window");
@ -104,6 +106,7 @@ void nsXULAtoms::ReleaseAtoms() {
NS_RELEASE(treeitem);
NS_RELEASE(treechildren);
NS_RELEASE(treeindentation);
NS_RELEASE(treeallowevents);
NS_RELEASE(widget);
NS_RELEASE(window);

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

@ -65,9 +65,9 @@ static void ForceDrawFrame(nsIFrame * aFrame)
// Creates a new tree cell frame
//
nsresult
NS_NewTreeCellFrame (nsIFrame*& aNewFrame)
NS_NewTreeCellFrame (nsIFrame*& aNewFrame, PRBool allowEvents)
{
nsTreeCellFrame* theFrame = new nsTreeCellFrame;
nsTreeCellFrame* theFrame = new nsTreeCellFrame(allowEvents);
if (theFrame == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
@ -78,8 +78,8 @@ NS_NewTreeCellFrame (nsIFrame*& aNewFrame)
// Constructor
nsTreeCellFrame::nsTreeCellFrame()
:nsTableCellFrame() { mIsHeader = PR_FALSE; mBeenReflowed = PR_FALSE; }
nsTreeCellFrame::nsTreeCellFrame(PRBool allowEvents)
:nsTableCellFrame() { mAllowEvents = allowEvents; mIsHeader = PR_FALSE; mBeenReflowed = PR_FALSE; }
// Destructor
nsTreeCellFrame::~nsTreeCellFrame()
@ -165,8 +165,15 @@ NS_IMETHODIMP
nsTreeCellFrame::GetFrameForPoint(const nsPoint& aPoint,
nsIFrame** aFrame)
{
*aFrame = this; // Capture all events so that we can perform selection and expand/collapse.
return NS_OK;
if (mAllowEvents)
{
return nsTableCellFrame::GetFrameForPoint(aPoint, aFrame);
}
else
{
*aFrame = this; // Capture all events so that we can perform selection and expand/collapse.
return NS_OK;
}
}
NS_IMETHODIMP

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

@ -24,7 +24,7 @@ class nsTreeFrame;
class nsTreeCellFrame : public nsTableCellFrame
{
public:
friend nsresult NS_NewTreeCellFrame(nsIFrame*& aNewFrame);
friend nsresult NS_NewTreeCellFrame(nsIFrame*& aNewFrame, PRBool allowEvents);
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, // Overridden to capture events
nsIFrame** aFrame);
@ -46,7 +46,7 @@ public:
void Select(nsIPresContext& presContext, PRBool isSelected);
protected:
nsTreeCellFrame();
nsTreeCellFrame(PRBool allowEvents);
virtual ~nsTreeCellFrame();
nsresult HandleMouseDownEvent(nsIPresContext& aPresContext,
@ -64,6 +64,7 @@ protected:
nsIStyleContext* mSelectedContext; // The style context to use when the tree item is selected
nsIStyleContext* mNormalContext; // The style context to use normally.
nsTreeFrame* mTreeFrame; // Our parent tree frame.
PRBool mAllowEvents; // Whether we let events go through.
PRBool mBeenReflowed; // Hack for now.
}; // class nsTableCellFrame

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

@ -41,6 +41,7 @@ nsIAtom* nsXULAtoms::treerow;
nsIAtom* nsXULAtoms::treecell;
nsIAtom* nsXULAtoms::treechildren;
nsIAtom* nsXULAtoms::treeindentation;
nsIAtom* nsXULAtoms::treeallowevents;
nsIAtom* nsXULAtoms::widget;
nsIAtom* nsXULAtoms::window;
@ -77,6 +78,7 @@ void nsXULAtoms::AddrefAtoms() {
treeitem = NS_NewAtom("treeitem");
treechildren = NS_NewAtom("treechildren");
treeindentation = NS_NewAtom("treeindentation");
treeallowevents = NS_NewAtom("treeallowevents");
widget = NS_NewAtom("widget");
window = NS_NewAtom("window");
@ -104,6 +106,7 @@ void nsXULAtoms::ReleaseAtoms() {
NS_RELEASE(treeitem);
NS_RELEASE(treechildren);
NS_RELEASE(treeindentation);
NS_RELEASE(treeallowevents);
NS_RELEASE(widget);
NS_RELEASE(window);

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

@ -59,6 +59,7 @@ public:
static nsIAtom* treecell; // A cell in the tree view
static nsIAtom* treechildren; // The children of an item in the tree viw
static nsIAtom* treeindentation; // Specifies that the indentation for the level should occur here.
static nsIAtom* treeallowevents; // Lets events be handled on the cell contents.
static nsIAtom* widget;
static nsIAtom* window;