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* treecell; // A cell in the tree view
static nsIAtom* treechildren; // The children of an item in the tree viw 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* 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* widget;
static nsIAtom* window; static nsIAtom* window;

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

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

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

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

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

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

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

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

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

@ -59,6 +59,7 @@ public:
static nsIAtom* treecell; // A cell in the tree view static nsIAtom* treecell; // A cell in the tree view
static nsIAtom* treechildren; // The children of an item in the tree viw 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* 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* widget;
static nsIAtom* window; static nsIAtom* window;