Implementing .count in the Outliner. Now you can do |outliner.outlinerBoxObject.selection.count| to get the number of currently selected rows. This is much more convenient (and faster) than messing around with .getRangeAt() and then calculate the amount of selected rows by hand...

bug 75552

r=varga@utcru.sk, sr=hyatt@netscape.com
This commit is contained in:
hwaara%chello.se 2001-04-11 23:15:49 +00:00
Родитель 473036a7fc
Коммит 66cd4b7f18
4 изменённых файлов: 32 добавлений и 0 удалений

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

@ -20,6 +20,7 @@
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
* Håkan Waara (hwaara@chello.se)
*/
interface nsIOutlinerBoxObject;
@ -34,6 +35,11 @@ interface nsIOutlinerSelection : nsISecurityCheckedComponent
*/
attribute nsIOutlinerBoxObject outliner;
/**
* The number of rows currently selected in this outliner.
*/
readonly attribute long count;
/**
* Indicates whether or not the row at the specified index is
* part of the selection.

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

@ -504,6 +504,16 @@ NS_IMETHODIMP nsOutlinerSelection::GetRangeAt(PRInt32 aIndex, PRInt32* aMin, PRI
return NS_OK;
}
NS_IMETHODIMP nsOutlinerSelection::GetCount(PRInt32 *count)
{
if (mFirstRange)
*count = mFirstRange->Count();
else // No range available, so there's no selected row.
*count = 0;
return NS_OK;
}
NS_IMETHODIMP nsOutlinerSelection::GetSelectEventsSuppressed(PRBool *aSelectEventsSuppressed)
{
*aSelectEventsSuppressed = mSuppressed;

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

@ -20,6 +20,7 @@
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
* Håkan Waara (hwaara@chello.se)
*/
interface nsIOutlinerBoxObject;
@ -34,6 +35,11 @@ interface nsIOutlinerSelection : nsISecurityCheckedComponent
*/
attribute nsIOutlinerBoxObject outliner;
/**
* The number of rows currently selected in this outliner.
*/
readonly attribute long count;
/**
* Indicates whether or not the row at the specified index is
* part of the selection.

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

@ -504,6 +504,16 @@ NS_IMETHODIMP nsOutlinerSelection::GetRangeAt(PRInt32 aIndex, PRInt32* aMin, PRI
return NS_OK;
}
NS_IMETHODIMP nsOutlinerSelection::GetCount(PRInt32 *count)
{
if (mFirstRange)
*count = mFirstRange->Count();
else // No range available, so there's no selected row.
*count = 0;
return NS_OK;
}
NS_IMETHODIMP nsOutlinerSelection::GetSelectEventsSuppressed(PRBool *aSelectEventsSuppressed)
{
*aSelectEventsSuppressed = mSuppressed;