printf("aEvent->message %d on 0x%X\n", aEvent->message, aEvent->widget); printf("aEvent->message %d == %d on 0x%X\n", aEvent->message, NS_MOUSE_LEFT_BUTTON_UP, aEvent->widget);
nsEventStatus PR_CALLBACK HandleEventCheck(nsGUIEvent *aEvent){    printf("aEvent->message %d on 0x%X\n", aEvent->message, aEvent->widget);    printf("aEvent->message %d == %d on 0x%X\n", aEvent->message, NS_MOUSE_LEFT_BUTTON_UP, aEvent->widget);    switch(aEvent->message) {        case NS_MOUSE_LEFT_BUTTON_UP:         {            nsICheckButton *option;            if (NS_OK == aEvent->widget->QueryInterface(kICheckButtonIID, (void**)&option)) {                // invert the two checkboxes state                PRBool state = option->GetState();                option->SetState((state) ? PR_FALSE : PR_TRUE);                if (state == PR_FALSE) {                    nsAutoString buf;                    option->GetLabel(buf);                    nsIRenderingContext *drawCtx = scribbleData.drawPane->GetRenderingContext();                                        //                    srand(aEvent->time);                    if (drawCtx) {                        // a sort of random rect                        nsRect rect;                        scribbleData.drawPane->GetBounds(rect);                        nscoord width = rect.width;                        nscoord height = rect.height;                        nsString circles("Circles");                        nsString rects("Rectangles");                        if (buf.Equals(circles)) {                            for (int i = 0; i < 100; i++) {                                drawCtx->SetColor((nscolor)rand());                                rect.MoveTo(rand() % width, rand() % height);                                rect.SizeTo(rand() % (width - rect.x),                                             rand() % (height - rect.y));                                drawCtx->DrawEllipse(rect);                            }                        }                        else if (buf.Equals(rects)) {                            for (int i = 0; i < 100; i++) {                                drawCtx->SetColor((nscolor)rand());                                rect.MoveTo(rand() % width, rand() % height);                                rect.SizeTo(rand() % (width - rect.x),                                             rand() % (height - rect.y));                                drawCtx->DrawRect(rect);                            }                        }                        NS_RELEASE(drawCtx);                    }                }            }        }    }    return nsEventStatus_eIgnore;}