зеркало из https://github.com/mozilla/pjs.git
Not part of build.
This commit is contained in:
Родитель
127a9543b4
Коммит
2dd75261f9
|
@ -31,7 +31,8 @@ XPIDL_MODULE = layout_xul_outliner
|
|||
|
||||
XPIDLSRCS= nsIOutlinerRangeList.idl \
|
||||
nsIOutlinerRange.idl \
|
||||
nsIOutlinerStore.idl \
|
||||
nsIOutlinerView.idl \
|
||||
nsIOutlinerSelection.idl \
|
||||
nsIOutlinerBoxObject.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ DEPTH=..\..\..\..\..\..
|
|||
|
||||
XPIDLSRCS= .\nsIOutlinerRangeList.idl \
|
||||
.\nsIOutlinerRange.idl \
|
||||
.\nsIOutlinerStore.idl \
|
||||
.\nsIOutlinerView.idl \
|
||||
.\nsIOutlinerSelection.idl \
|
||||
.\nsIOutlinerBoxObject.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -24,36 +24,15 @@
|
|||
|
||||
#include "nsIOutlinerRangeList.idl"
|
||||
|
||||
interface nsIOutlinerStore;
|
||||
interface nsIOutlinerView;
|
||||
|
||||
[scriptable, uuid(8398C757-6387-480c-82B2-C914E15CE00D)]
|
||||
interface nsIOutlinerBoxObject : nsISupports
|
||||
{
|
||||
// The store that backs the outliner and that supplies it with its data.
|
||||
// It is dynamically settable, either using a store attribute on the
|
||||
// The view that backs the outliner and that supplies it with its data.
|
||||
// It is dynamically settable, either using a view attribute on the
|
||||
// outliner tag or by setting this attribute to a new value.
|
||||
attribute nsIOutlinerStore store;
|
||||
|
||||
// Deselect all rows and select the row at the specified index.
|
||||
void select(in long index);
|
||||
|
||||
// Toggle the selection state of the row at the specified index.
|
||||
void toggleSelect(in long index);
|
||||
|
||||
// Select the range specified by the indices.
|
||||
void rangedSelect(in long startIndex, in long endIndex);
|
||||
|
||||
// The selected row indices in a sorted list of ranges.
|
||||
readonly attribute nsIOutlinerRangeList selectedRows;
|
||||
|
||||
// Clears the selection.
|
||||
void clearSelection();
|
||||
|
||||
// Inverts the selection.
|
||||
void invertSelection();
|
||||
|
||||
// Selects all rows.
|
||||
void selectAll();
|
||||
attribute nsIOutlinerView view;
|
||||
|
||||
// Get the index of the first visible row.
|
||||
long getIndexOfVisibleRow();
|
||||
|
@ -71,11 +50,12 @@ interface nsIOutlinerBoxObject : nsISupports
|
|||
// A hit test that can tell you what cell the mouse is over.
|
||||
void getCellAt(in long x, in long y, out long row, out wstring colID);
|
||||
|
||||
// The store is responsible for calling these notification methods when
|
||||
// The view is responsible for calling these notification methods when
|
||||
// nodes are added or removed. Index is the position at which the new
|
||||
// rows start. count is the number of new contiguous rows added. For
|
||||
// rows start. Count is the number of new contiguous rows added. For
|
||||
// non-contiguous additions, these methods should be called multiple times.
|
||||
void rowsAdded(in long index, in long count);
|
||||
void rowsAppended(in long count);
|
||||
void rowsInserted(in long index, in long count);
|
||||
void rowsRemoved(in long index, in long count);
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
interface nsIOutlinerBoxObject;
|
||||
interface nsIOutlinerRangeList;
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(F848D7CF-F3D6-4775-8C9F-135546E61E1E)]
|
||||
interface nsIOutlinerSelection : nsISupports
|
||||
{
|
||||
// The outliner widget for this selection.
|
||||
attribute nsIOutlinerBoxObject outliner;
|
||||
|
||||
// The current selected indices.
|
||||
attribute nsIOutlinerRangeList selectedRows;
|
||||
|
||||
// Indicates whether or not the row at the specified index is
|
||||
// part of the selection.
|
||||
boolean isSelected(in long index);
|
||||
|
||||
// Deselect all rows and select the row at the specified index.
|
||||
void select(in long index);
|
||||
|
||||
// Toggle the selection state of the row at the specified index.
|
||||
void toggleSelect(in long index);
|
||||
|
||||
// Select the range specified by the indices.
|
||||
void rangedSelect(in long startIndex, in long endIndex);
|
||||
|
||||
// Clears the selection.
|
||||
void clearSelection();
|
||||
|
||||
// Inverts the selection.
|
||||
void invertSelection();
|
||||
|
||||
// Selects all rows.
|
||||
void selectAll();
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Initializer,
|
||||
%}
|
|
@ -0,0 +1,89 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIOutlinerBoxObject.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
interface nsIOutlinerSelection;
|
||||
|
||||
[scriptable, uuid(7660811D-3CB8-441f-8E58-466DE4F3FA9A)]
|
||||
interface nsIOutlinerView : nsISupports
|
||||
{
|
||||
// The total number of rows in the outliner (including the offscreen rows).
|
||||
readonly attribute long rowCount;
|
||||
|
||||
// The selection for this view.
|
||||
attribute nsIOutlinerSelection selection;
|
||||
|
||||
// An atomized list of properties for a given row. Each property, x, that
|
||||
// the store gives back will cause the pseudoclass :moz-outliner-row-x
|
||||
// to be matched on the pseudoelement ::moz-outliner-row.
|
||||
//
|
||||
// The special property "separator" can be returned to supply the outliner
|
||||
// with the hint that there are no cells in this row and that it should draw
|
||||
// a separator. It uses the border properties on the separator pseudoclass
|
||||
// to draw the separator.
|
||||
nsISupportsArray getRowProperties(in long index);
|
||||
|
||||
// An atomized list of properties for a given cell. Each property, x, that
|
||||
// the store gives back will cause the pseudoclass :moz-outliner-cell-x
|
||||
// to be matched on the ::moz-outliner-cell pseudoelement.
|
||||
nsISupportsArray getCellProperties(in long row, in wstring colID);
|
||||
|
||||
// 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
|
||||
// :moz-outliner-indentation pseudoclass to compute the exact indendation.
|
||||
wstring getCellText(in long row, in wstring colID, out long level);
|
||||
|
||||
// Ensures that a row at a given index is visible.
|
||||
void scrollToRow(in long index);
|
||||
|
||||
// Called during initialization to link the store to the front end box object.
|
||||
void setOutliner(in nsIOutlinerBoxObject outliner);
|
||||
|
||||
// Called on the store when an item is opened or closed.
|
||||
void toggleOpenState(in long index);
|
||||
|
||||
// Called on the store when a header is clicked.
|
||||
void cycleHeader(in wstring colID);
|
||||
|
||||
// Called on the store when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
|
||||
void cycleCell(in long row, in wstring colID);
|
||||
|
||||
// A command API that can be used to invoke commands on the selection. The outliner
|
||||
// will automatically invoke this method when certain keys are pressed. For example,
|
||||
// when the DEL key is pressed, performAction will be called with the "delete" string.
|
||||
void performAction(in wstring action);
|
||||
|
||||
// A command API that can be used to invoke commands on a specific row.
|
||||
void performActionOnRow(in wstring action, in long row);
|
||||
|
||||
// A command API that can be used to invoke commands on a specific cell.
|
||||
void performActionOnCell(in wstring action, in long row, in wstring colID);
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Initializer,
|
||||
%}
|
|
@ -76,16 +76,16 @@ nsOutlinerBodyFrame::Release(void)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetStore(nsIOutlinerStore * *aStore)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetView(nsIOutlinerView * *aView)
|
||||
{
|
||||
*aStore = mStore;
|
||||
NS_IF_ADDREF(*aStore);
|
||||
*aView = mView;
|
||||
NS_IF_ADDREF(*aView);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SetStore(nsIOutlinerStore * aStore)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SetView(nsIOutlinerView * aView)
|
||||
{
|
||||
mStore = aStore;
|
||||
mView = aView;
|
||||
|
||||
// Changing the store causes us to refetch our data. This will
|
||||
// necessarily entail a full invalidation of the outliner.
|
||||
|
@ -95,43 +95,6 @@ NS_IMETHODIMP nsOutlinerBodyFrame::SetStore(nsIOutlinerStore * aStore)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::Select(PRInt32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::ToggleSelect(PRInt32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RangedSelect(PRInt32 aStartIndex, PRInt32 aEndIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetSelectedRows(nsIOutlinerRangeList** aResult)
|
||||
{
|
||||
*aResult = mSelectedRows;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::ClearSelection()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::InvertSelection()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SelectAll()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetIndexOfVisibleRow(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = mTopRowIndex;
|
||||
|
@ -174,7 +137,12 @@ NS_IMETHODIMP nsOutlinerBodyFrame::GetCellAt(PRInt32 x, PRInt32 y, PRInt32 *row,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RowsAdded(PRInt32 index, PRInt32 count)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RowsAppended(PRInt32 count)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RowsInserted(PRInt32 index, PRInt32 count)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "nsLeafBoxFrame.h"
|
||||
#include "nsIOutlinerBoxObject.h"
|
||||
#include "nsIOutlinerStore.h"
|
||||
#include "nsIOutlinerView.h"
|
||||
#include "nsIOutlinerRangeList.h"
|
||||
|
||||
class nsSupportsHashtable;
|
||||
|
@ -66,9 +66,9 @@ protected:
|
|||
virtual ~nsOutlinerBodyFrame();
|
||||
|
||||
protected: // Data Members
|
||||
// The current store for this outliner widget. We get all of our row and cell data
|
||||
// from the store.
|
||||
nsCOMPtr<nsIOutlinerStore> mStore;
|
||||
// The current view for this outliner widget. We get all of our row and cell data
|
||||
// from the view.
|
||||
nsCOMPtr<nsIOutlinerView> mView;
|
||||
|
||||
// A cache of all the style contexts we have seen for rows of the tree. This is a mapping from
|
||||
// a list of atoms to a corresponding style context. This cache stores every combination that
|
||||
|
@ -87,8 +87,4 @@ protected: // Data Members
|
|||
// this index and going up to index+pageCount.
|
||||
PRInt32 mTopRowIndex;
|
||||
PRInt32 mPageCount;
|
||||
|
||||
// Our current selection.
|
||||
nsCOMPtr<nsIOutlinerRangeList> mSelectedRows;
|
||||
|
||||
}; // class nsOutlinerBodyFrame
|
||||
|
|
|
@ -112,75 +112,19 @@ nsOutlinerBoxObject::GetOutlinerBody()
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::GetStore(nsIOutlinerStore * *aStore)
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::GetView(nsIOutlinerView * *aView)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->GetStore(aStore);
|
||||
return body->GetView(aView);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::SetStore(nsIOutlinerStore * aStore)
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::SetView(nsIOutlinerView * aView)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->SetStore(aStore);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::Select(PRInt32 aIndex)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->Select(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::ToggleSelect(PRInt32 aIndex)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->ToggleSelect(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RangedSelect(PRInt32 aStartIndex, PRInt32 aEndIndex)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->RangedSelect(aStartIndex, aEndIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::GetSelectedRows(nsIOutlinerRangeList * *aSelectedRows)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->GetSelectedRows(aSelectedRows);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::ClearSelection()
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->ClearSelection();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::InvertSelection()
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->InvertSelection();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::SelectAll()
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->SelectAll();
|
||||
return body->SetView(aView);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -248,11 +192,19 @@ NS_IMETHODIMP nsOutlinerBoxObject::GetCellAt(PRInt32 x, PRInt32 y, PRInt32 *row,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RowsAdded(PRInt32 index, PRInt32 count)
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RowsAppended(PRInt32 count)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->RowsAdded(index, count);
|
||||
return body->RowsAppended(count);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RowsInserted(PRInt32 index, PRInt32 count)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->RowsInserted(index, count);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,36 +24,15 @@
|
|||
|
||||
#include "nsIOutlinerRangeList.idl"
|
||||
|
||||
interface nsIOutlinerStore;
|
||||
interface nsIOutlinerView;
|
||||
|
||||
[scriptable, uuid(8398C757-6387-480c-82B2-C914E15CE00D)]
|
||||
interface nsIOutlinerBoxObject : nsISupports
|
||||
{
|
||||
// The store that backs the outliner and that supplies it with its data.
|
||||
// It is dynamically settable, either using a store attribute on the
|
||||
// The view that backs the outliner and that supplies it with its data.
|
||||
// It is dynamically settable, either using a view attribute on the
|
||||
// outliner tag or by setting this attribute to a new value.
|
||||
attribute nsIOutlinerStore store;
|
||||
|
||||
// Deselect all rows and select the row at the specified index.
|
||||
void select(in long index);
|
||||
|
||||
// Toggle the selection state of the row at the specified index.
|
||||
void toggleSelect(in long index);
|
||||
|
||||
// Select the range specified by the indices.
|
||||
void rangedSelect(in long startIndex, in long endIndex);
|
||||
|
||||
// The selected row indices in a sorted list of ranges.
|
||||
readonly attribute nsIOutlinerRangeList selectedRows;
|
||||
|
||||
// Clears the selection.
|
||||
void clearSelection();
|
||||
|
||||
// Inverts the selection.
|
||||
void invertSelection();
|
||||
|
||||
// Selects all rows.
|
||||
void selectAll();
|
||||
attribute nsIOutlinerView view;
|
||||
|
||||
// Get the index of the first visible row.
|
||||
long getIndexOfVisibleRow();
|
||||
|
@ -71,11 +50,12 @@ interface nsIOutlinerBoxObject : nsISupports
|
|||
// A hit test that can tell you what cell the mouse is over.
|
||||
void getCellAt(in long x, in long y, out long row, out wstring colID);
|
||||
|
||||
// The store is responsible for calling these notification methods when
|
||||
// The view is responsible for calling these notification methods when
|
||||
// nodes are added or removed. Index is the position at which the new
|
||||
// rows start. count is the number of new contiguous rows added. For
|
||||
// rows start. Count is the number of new contiguous rows added. For
|
||||
// non-contiguous additions, these methods should be called multiple times.
|
||||
void rowsAdded(in long index, in long count);
|
||||
void rowsAppended(in long count);
|
||||
void rowsInserted(in long index, in long count);
|
||||
void rowsRemoved(in long index, in long count);
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
interface nsIOutlinerBoxObject;
|
||||
interface nsIOutlinerRangeList;
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(F848D7CF-F3D6-4775-8C9F-135546E61E1E)]
|
||||
interface nsIOutlinerSelection : nsISupports
|
||||
{
|
||||
// The outliner widget for this selection.
|
||||
attribute nsIOutlinerBoxObject outliner;
|
||||
|
||||
// The current selected indices.
|
||||
attribute nsIOutlinerRangeList selectedRows;
|
||||
|
||||
// Indicates whether or not the row at the specified index is
|
||||
// part of the selection.
|
||||
boolean isSelected(in long index);
|
||||
|
||||
// Deselect all rows and select the row at the specified index.
|
||||
void select(in long index);
|
||||
|
||||
// Toggle the selection state of the row at the specified index.
|
||||
void toggleSelect(in long index);
|
||||
|
||||
// Select the range specified by the indices.
|
||||
void rangedSelect(in long startIndex, in long endIndex);
|
||||
|
||||
// Clears the selection.
|
||||
void clearSelection();
|
||||
|
||||
// Inverts the selection.
|
||||
void invertSelection();
|
||||
|
||||
// Selects all rows.
|
||||
void selectAll();
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Initializer,
|
||||
%}
|
|
@ -0,0 +1,89 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsIOutlinerBoxObject.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
interface nsIOutlinerSelection;
|
||||
|
||||
[scriptable, uuid(7660811D-3CB8-441f-8E58-466DE4F3FA9A)]
|
||||
interface nsIOutlinerView : nsISupports
|
||||
{
|
||||
// The total number of rows in the outliner (including the offscreen rows).
|
||||
readonly attribute long rowCount;
|
||||
|
||||
// The selection for this view.
|
||||
attribute nsIOutlinerSelection selection;
|
||||
|
||||
// An atomized list of properties for a given row. Each property, x, that
|
||||
// the store gives back will cause the pseudoclass :moz-outliner-row-x
|
||||
// to be matched on the pseudoelement ::moz-outliner-row.
|
||||
//
|
||||
// The special property "separator" can be returned to supply the outliner
|
||||
// with the hint that there are no cells in this row and that it should draw
|
||||
// a separator. It uses the border properties on the separator pseudoclass
|
||||
// to draw the separator.
|
||||
nsISupportsArray getRowProperties(in long index);
|
||||
|
||||
// An atomized list of properties for a given cell. Each property, x, that
|
||||
// the store gives back will cause the pseudoclass :moz-outliner-cell-x
|
||||
// to be matched on the ::moz-outliner-cell pseudoelement.
|
||||
nsISupportsArray getCellProperties(in long row, in wstring colID);
|
||||
|
||||
// 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
|
||||
// :moz-outliner-indentation pseudoclass to compute the exact indendation.
|
||||
wstring getCellText(in long row, in wstring colID, out long level);
|
||||
|
||||
// Ensures that a row at a given index is visible.
|
||||
void scrollToRow(in long index);
|
||||
|
||||
// Called during initialization to link the store to the front end box object.
|
||||
void setOutliner(in nsIOutlinerBoxObject outliner);
|
||||
|
||||
// Called on the store when an item is opened or closed.
|
||||
void toggleOpenState(in long index);
|
||||
|
||||
// Called on the store when a header is clicked.
|
||||
void cycleHeader(in wstring colID);
|
||||
|
||||
// Called on the store when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
|
||||
void cycleCell(in long row, in wstring colID);
|
||||
|
||||
// A command API that can be used to invoke commands on the selection. The outliner
|
||||
// will automatically invoke this method when certain keys are pressed. For example,
|
||||
// when the DEL key is pressed, performAction will be called with the "delete" string.
|
||||
void performAction(in wstring action);
|
||||
|
||||
// A command API that can be used to invoke commands on a specific row.
|
||||
void performActionOnRow(in wstring action, in long row);
|
||||
|
||||
// A command API that can be used to invoke commands on a specific cell.
|
||||
void performActionOnCell(in wstring action, in long row, in wstring colID);
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Initializer,
|
||||
%}
|
|
@ -76,16 +76,16 @@ nsOutlinerBodyFrame::Release(void)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetStore(nsIOutlinerStore * *aStore)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetView(nsIOutlinerView * *aView)
|
||||
{
|
||||
*aStore = mStore;
|
||||
NS_IF_ADDREF(*aStore);
|
||||
*aView = mView;
|
||||
NS_IF_ADDREF(*aView);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SetStore(nsIOutlinerStore * aStore)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SetView(nsIOutlinerView * aView)
|
||||
{
|
||||
mStore = aStore;
|
||||
mView = aView;
|
||||
|
||||
// Changing the store causes us to refetch our data. This will
|
||||
// necessarily entail a full invalidation of the outliner.
|
||||
|
@ -95,43 +95,6 @@ NS_IMETHODIMP nsOutlinerBodyFrame::SetStore(nsIOutlinerStore * aStore)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::Select(PRInt32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::ToggleSelect(PRInt32 aIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RangedSelect(PRInt32 aStartIndex, PRInt32 aEndIndex)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetSelectedRows(nsIOutlinerRangeList** aResult)
|
||||
{
|
||||
*aResult = mSelectedRows;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::ClearSelection()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::InvertSelection()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SelectAll()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::GetIndexOfVisibleRow(PRInt32 *_retval)
|
||||
{
|
||||
*_retval = mTopRowIndex;
|
||||
|
@ -174,7 +137,12 @@ NS_IMETHODIMP nsOutlinerBodyFrame::GetCellAt(PRInt32 x, PRInt32 y, PRInt32 *row,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RowsAdded(PRInt32 index, PRInt32 count)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RowsAppended(PRInt32 count)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::RowsInserted(PRInt32 index, PRInt32 count)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "nsLeafBoxFrame.h"
|
||||
#include "nsIOutlinerBoxObject.h"
|
||||
#include "nsIOutlinerStore.h"
|
||||
#include "nsIOutlinerView.h"
|
||||
#include "nsIOutlinerRangeList.h"
|
||||
|
||||
class nsSupportsHashtable;
|
||||
|
@ -66,9 +66,9 @@ protected:
|
|||
virtual ~nsOutlinerBodyFrame();
|
||||
|
||||
protected: // Data Members
|
||||
// The current store for this outliner widget. We get all of our row and cell data
|
||||
// from the store.
|
||||
nsCOMPtr<nsIOutlinerStore> mStore;
|
||||
// The current view for this outliner widget. We get all of our row and cell data
|
||||
// from the view.
|
||||
nsCOMPtr<nsIOutlinerView> mView;
|
||||
|
||||
// A cache of all the style contexts we have seen for rows of the tree. This is a mapping from
|
||||
// a list of atoms to a corresponding style context. This cache stores every combination that
|
||||
|
@ -87,8 +87,4 @@ protected: // Data Members
|
|||
// this index and going up to index+pageCount.
|
||||
PRInt32 mTopRowIndex;
|
||||
PRInt32 mPageCount;
|
||||
|
||||
// Our current selection.
|
||||
nsCOMPtr<nsIOutlinerRangeList> mSelectedRows;
|
||||
|
||||
}; // class nsOutlinerBodyFrame
|
||||
|
|
|
@ -112,75 +112,19 @@ nsOutlinerBoxObject::GetOutlinerBody()
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::GetStore(nsIOutlinerStore * *aStore)
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::GetView(nsIOutlinerView * *aView)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->GetStore(aStore);
|
||||
return body->GetView(aView);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::SetStore(nsIOutlinerStore * aStore)
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::SetView(nsIOutlinerView * aView)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->SetStore(aStore);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::Select(PRInt32 aIndex)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->Select(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::ToggleSelect(PRInt32 aIndex)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->ToggleSelect(aIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RangedSelect(PRInt32 aStartIndex, PRInt32 aEndIndex)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->RangedSelect(aStartIndex, aEndIndex);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::GetSelectedRows(nsIOutlinerRangeList * *aSelectedRows)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->GetSelectedRows(aSelectedRows);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::ClearSelection()
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->ClearSelection();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::InvertSelection()
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->InvertSelection();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::SelectAll()
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->SelectAll();
|
||||
return body->SetView(aView);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -248,11 +192,19 @@ NS_IMETHODIMP nsOutlinerBoxObject::GetCellAt(PRInt32 x, PRInt32 y, PRInt32 *row,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RowsAdded(PRInt32 index, PRInt32 count)
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RowsAppended(PRInt32 count)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->RowsAdded(index, count);
|
||||
return body->RowsAppended(count);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsOutlinerBoxObject::RowsInserted(PRInt32 index, PRInt32 count)
|
||||
{
|
||||
nsIOutlinerBoxObject* body = GetOutlinerBody();
|
||||
if (body)
|
||||
return body->RowsInserted(index, count);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче