break;
int i = 0; for (i=0;i<gNumRadioBtns;i++) { nsIWidget * win; if (NS_OK == gRadioBtns[i]->QueryInterface(kIWidgetIID, (void**)&win)) { printf("%d  0x%x  0x%x\n", i, win, aEvent->widget); if (win == aEvent->widget) { gRadioBtns[i]->SetState(PR_TRUE); } else { gRadioBtns[i]->SetState(PR_FALSE); } } } } break;
nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent){ 	//  printf("aEvent->message %d\n", aEvent->message);    nsEventStatus result = nsEventStatus_eIgnore;    switch(aEvent->message) {        case NS_SHOW_TOOLTIP:          {            char buf[256];            nsTooltipEvent* tEvent = (nsTooltipEvent*)aEvent;            sprintf(buf,"Show tooltip %d", tEvent->tipIndex);            statusText->SetText(buf);            nsRect oldPos;            oldPos.x = aEvent->point.x;            oldPos.y = aEvent->point.y;            nsRect newPos;            window->WidgetToScreen(oldPos, newPos);            tooltipWindow->Move(newPos.x + 5, newPos.y + 5);            tooltipWindow->Show(PR_TRUE);          }          break;        case NS_HIDE_TOOLTIP:          statusText->SetText("Hide tooltip");          tooltipWindow->Show(PR_FALSE);          break;                case NS_MOVE:            char str[256];            sprintf(str, "Moved window to %d,%d", aEvent->point.x, aEvent->point.y);            statusText->SetText(str);            break;        case NS_MOUSE_LEFT_DOUBLECLICK:            statusText->SetText("Left button double click");            break;        case NS_MOUSE_RIGHT_DOUBLECLICK:            statusText->SetText("Right button double click");            break;        case NS_MOUSE_ENTER:            if (DEBUG_MOUSE) printf("NS_MOUSE_ENTER 0x%X\n", aEvent->widget);            break;        case NS_MOUSE_EXIT:            if (DEBUG_MOUSE) printf("NS_MOUSE_EXIT 0x%X\n", aEvent->widget);            break;        case NS_MOUSE_MOVE:            if (DEBUG_MOUSE) printf("NS_MOUSE_MOVE\n");            break;                case NS_MOUSE_LEFT_BUTTON_UP:            if (DEBUG_MOUSE) printf("NS_MOUSE_LEFT_BUTTON_UP\n");            break;                case NS_MOUSE_LEFT_BUTTON_DOWN:            if (DEBUG_MOUSE) printf("NS_MOUSE_LEFT_BUTTON_DOWN\n");            break;        case NS_CREATE:            printf("Window Created\n");            break;                case NS_PAINT:               // paint the background            if (aEvent->widget == window) {                nsIRenderingContext *drawCtx = ((nsPaintEvent*)aEvent)->renderingContext;                drawCtx->SetColor(aEvent->widget->GetBackgroundColor());                drawCtx->FillRect(*(((nsPaintEvent*)aEvent)->rect));                return nsEventStatus_eIgnore;            }            break;                case NS_DESTROY:            printf("Destroy Window...Release window\n");            fprintf(gFD, "\n\n--------------------------------------------------\n");            fprintf(gFD, "Summary of non-visual tests, Number of Failures %d\n", gNonVisualStatus);            fprintf(gFD, "Summary of visual tests,     Number of Failures %d\n", gOverallStatus-gNonVisualStatus);            fprintf(gFD, "Summary of all tests,        Number of Failures %d\n", gOverallStatus);            fprintf(gFD, "--------------------------------------------------\n");            fflush(gFD);            fclose(gFD);			      exit(0); // for now            break;               case NS_SCROLLBAR_POS:        case NS_SCROLLBAR_PAGE_NEXT:        case NS_SCROLLBAR_PAGE_PREV:        case NS_SCROLLBAR_LINE_NEXT:        case NS_SCROLLBAR_LINE_PREV:            if (nsnull != movingWidget) {              PRUint32  pos = scrollbar->GetPosition();              movingWidget->Move(10, pos);            }            break;        case NS_KEY_UP: {            nsKeyEvent * ke = (nsKeyEvent*)aEvent;            char str[256];            sprintf(str, "Key Event Key Code[%d] Key [%c] Shift [%s] Control [%s] Alt [%s]",              ke->keyCode, ke->keyCode,               (ke->isShift?"Pressed":"Released"),              (ke->isControl?"Pressed":"Released"),              (ke->isAlt?"Pressed":"Released"));            printf("%s\n", str);            statusText->SetText(nsString(str));            }            break;        default:            result = nsEventStatus_eIgnore;    }    //printf("result: %d = %d\n", result, PR_FALSE);    return result;}