зеркало из https://github.com/mozilla/gecko-dev.git
added Previous() and ResetToLast() to the Enumerator
This commit is contained in:
Родитель
4a42999db9
Коммит
26526207cf
|
@ -452,6 +452,24 @@ nsISupports* nsBaseWidget::Enumerator::Next()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get enumeration previous element. Return null at the end
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsISupports* nsBaseWidget::Enumerator::Previous()
|
||||
{
|
||||
if (mCurrentPosition > 0) {
|
||||
mCurrentPosition--;
|
||||
nsIWidget* widget = (nsIWidget*)mChildren.ElementAt(mCurrentPosition);
|
||||
|
||||
NS_IF_ADDREF(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -464,6 +482,17 @@ void nsBaseWidget::Enumerator::Reset()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Reset enumerator internal pointer to the end
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void nsBaseWidget::Enumerator::ResetToLast()
|
||||
{
|
||||
mCurrentPosition = mChildren.Count();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Append an element
|
||||
|
|
|
@ -118,7 +118,9 @@ protected:
|
|||
~Enumerator();
|
||||
|
||||
NS_IMETHOD_(nsISupports*) Next();
|
||||
NS_IMETHOD_(nsISupports*) Previous();
|
||||
NS_IMETHOD_(void) Reset();
|
||||
NS_IMETHOD_(void) ResetToLast();
|
||||
|
||||
void Append(nsIWidget* aWidget);
|
||||
void Remove(nsIWidget* aWidget);
|
||||
|
|
Загрузка…
Ссылка в новой задаче