fixing tests to use the enumerator correctly

This commit is contained in:
mjudge%netscape.com 1998-12-01 17:58:50 +00:00
Родитель 43d3cd4a56
Коммит ab27bd9d39
2 изменённых файлов: 15 добавлений и 13 удалений

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

@ -106,11 +106,10 @@ nsEventStatus PR_CALLBACK HandleEventMain(nsGUIEvent *aEvent)
{
nsIEnumerator *enumer = aEvent->widget->GetChildren();
if (enumer) {
nsISupports *next;
next = enumer->Next();
if (next) {
nsISupports *child;
if (NS_SUCCEEDED(enumer->CurrentItem(&child))) {
nsIWidget *widget;
if (NS_OK == next->QueryInterface(kIWidgetIID, (void**)&widget)) {
if (NS_OK == child->QueryInterface(kIWidgetIID, (void**)&widget)) {
widget->Resize(0, 0, 200,
((nsSizeEvent*)aEvent)->windowSize->height, PR_TRUE);
NS_RELEASE(widget);

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

@ -832,15 +832,18 @@ void DumpRects()
// print all children's position
nsIEnumerator *enumerator = window->GetChildren();
nsISupports * widget;
while (widget = enumerator->Next()) {
nsIWidget *child;
if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) {
//
child->GetBounds(rect);
printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height);
NS_RELEASE(child);
}
NS_RELEASE(widget);
if (NS_SUCCEEDED(enumerator->CurrentItem(&widget))) {
do {
nsIWidget *child;
if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) {
//
child->GetBounds(rect);
printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height);
NS_RELEASE(child);
}
NS_RELEASE(widget);
}
while (enumerator->Next());
}
NS_RELEASE(enumerator);