mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-15 21:36:20 +00:00
added Previous() and ResetToLast() to the Enumerator
This commit is contained in:
parent
4a42999db9
commit
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user