This commit is contained in:
hyatt%netscape.com 2001-02-05 07:03:42 +00:00
Родитель d84d79d43e
Коммит ae3e2f8b4f
5 изменённых файлов: 80 добавлений и 6 удалений

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

@ -52,6 +52,11 @@ interface nsIOutlinerView : nsISupports
// to be matched on the ::moz-outliner-cell pseudoelement.
void getCellProperties(in long row, in wstring colID, in nsISupportsArray properties);
// Methods that can be used to test whether or not a twisty should be drawn,
// and if so, whether an open or closed twisty should be used.
boolean isContainer(in long index);
boolean isContainerOpen(in long index);
// The text for a given cell. If a column consists only of an image, then
// the empty string is returned. The level is an integer value that represents
// the level of indentation. It is multiplied by the width specified in the

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

@ -29,6 +29,9 @@
#include "nsXULAtoms.h"
#include "nsIContent.h"
#include "nsIStyleContext.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsIContent.h"
// The style context cache impl
nsresult
@ -267,7 +270,7 @@ NS_IMETHODIMP nsOutlinerBodyFrame::Paint(nsIPresContext* aPresContext,
mView->GetRowCount(&rowCount);
// Ensure our column info is built.
EnsureColumns();
EnsureColumns(aPresContext);
// Loop through our onscreen rows.
for (PRInt32 i = mTopRowIndex; i < rowCount && i < mTopRowIndex+mPageCount+1; i++) {
@ -307,10 +310,39 @@ nsOutlinerBodyFrame::GetPseudoStyleContext(nsIPresContext* aPresContext, nsIStyl
}
void
nsOutlinerBodyFrame::EnsureColumns()
nsOutlinerBodyFrame::EnsureColumns(nsIPresContext* aPresContext)
{
if (!mColumns) {
nsCOMPtr<nsIContent> parent;
mContent->GetParent(*getter_AddRefs(parent));
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(parent));
nsCOMPtr<nsIDOMNodeList> cols;
elt->GetElementsByTagName(NS_LITERAL_STRING("outlinercol"), getter_AddRefs(cols));
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
PRUint32 count;
cols->GetLength(&count);
nsOutlinerColumn* currCol = nsnull;
for (PRUint32 i = 0; i < count; i++) {
nsCOMPtr<nsIDOMNode> node;
cols->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIContent> child(do_QueryInterface(node));
// Get the frame for this column.
nsIFrame* frame;
shell->GetPrimaryFrameFor(child, &frame);
// Create a new column structure.
nsOutlinerColumn* col = new nsOutlinerColumn(child, frame);
if (currCol)
currCol->SetNext(col);
else mColumns = col;
currCol = col;
}
}
}

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

@ -122,7 +122,7 @@ class nsOutlinerColumn {
nsIFrame* mColFrame;
public:
nsOutlinerColumn(nsIContent* aColElement);
nsOutlinerColumn(nsIContent* aColElement, nsIFrame* aFrame);
virtual ~nsOutlinerColumn();
void SetNext(nsOutlinerColumn* aNext) { mNext = aNext; };
@ -178,7 +178,7 @@ protected:
nsresult GetPseudoStyleContext(nsIPresContext* aPresContext, nsIStyleContext** aResult);
// Builds our cache of column info.
void EnsureColumns();
void EnsureColumns(nsIPresContext* aContext);
protected: // Data Members
// The current view for this outliner widget. We get all of our row and cell data

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

@ -52,6 +52,11 @@ interface nsIOutlinerView : nsISupports
// to be matched on the ::moz-outliner-cell pseudoelement.
void getCellProperties(in long row, in wstring colID, in nsISupportsArray properties);
// Methods that can be used to test whether or not a twisty should be drawn,
// and if so, whether an open or closed twisty should be used.
boolean isContainer(in long index);
boolean isContainerOpen(in long index);
// The text for a given cell. If a column consists only of an image, then
// the empty string is returned. The level is an integer value that represents
// the level of indentation. It is multiplied by the width specified in the

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

@ -29,6 +29,9 @@
#include "nsXULAtoms.h"
#include "nsIContent.h"
#include "nsIStyleContext.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsIContent.h"
// The style context cache impl
nsresult
@ -267,7 +270,7 @@ NS_IMETHODIMP nsOutlinerBodyFrame::Paint(nsIPresContext* aPresContext,
mView->GetRowCount(&rowCount);
// Ensure our column info is built.
EnsureColumns();
EnsureColumns(aPresContext);
// Loop through our onscreen rows.
for (PRInt32 i = mTopRowIndex; i < rowCount && i < mTopRowIndex+mPageCount+1; i++) {
@ -307,10 +310,39 @@ nsOutlinerBodyFrame::GetPseudoStyleContext(nsIPresContext* aPresContext, nsIStyl
}
void
nsOutlinerBodyFrame::EnsureColumns()
nsOutlinerBodyFrame::EnsureColumns(nsIPresContext* aPresContext)
{
if (!mColumns) {
nsCOMPtr<nsIContent> parent;
mContent->GetParent(*getter_AddRefs(parent));
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(parent));
nsCOMPtr<nsIDOMNodeList> cols;
elt->GetElementsByTagName(NS_LITERAL_STRING("outlinercol"), getter_AddRefs(cols));
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
PRUint32 count;
cols->GetLength(&count);
nsOutlinerColumn* currCol = nsnull;
for (PRUint32 i = 0; i < count; i++) {
nsCOMPtr<nsIDOMNode> node;
cols->Item(i, getter_AddRefs(node));
nsCOMPtr<nsIContent> child(do_QueryInterface(node));
// Get the frame for this column.
nsIFrame* frame;
shell->GetPrimaryFrameFor(child, &frame);
// Create a new column structure.
nsOutlinerColumn* col = new nsOutlinerColumn(child, frame);
if (currCol)
currCol->SetNext(col);
else mColumns = col;
currCol = col;
}
}
}