UGL_LOCAL UGL_STATUS wwmRootWinCb ( WIN_ID winId, WIN_MSG * pMsg, void * pData, void * pParam ) { UGL_STATUS status; switch (pMsg->type) { case MSG_DRAW: uglForegroundColorSet(pMsg->data.draw.gcId, WWM_BACKGROUND_COLOR); uglBackgroundColorSet(pMsg->data.draw.gcId, WWM_BACKGROUND_COLOR); uglRectangle( pMsg->data.draw.gcId, pMsg->data.draw.rect.left, pMsg->data.draw.rect.top, pMsg->data.draw.rect.right, pMsg->data.draw.rect.bottom ); status = UGL_STATUS_FINISHED; break; case MSG_RECT_CHILD_CHANGING: { WIN_ID childId = pMsg->data.rectChildChanging.childId; pMsg->type = MSG_RECT_CHANGING; winDrawRectGet(winId, &pMsg->data.rectChanging.maxRect); winMsgSend(childId, pMsg); pMsg->type = MSG_RECT_CHILD_CHANGING; pMsg->data.rectChildChanging.childId = childId; status = UGL_STATUS_FINISHED; } break; default: status = UGL_STATUS_OK; break; } return status; }
void windMLAllDemos(void) { UGL_BOOL windMLFlag = UGL_FALSE; UGL_FB_INFO fbInfo; UGL_EVENT event; UGL_EVENT_SERVICE_ID eventServiceId; UGL_EVENT_Q_ID qId; UGL_INPUT_EVENT * pInputEvent; UGL_INPUT_DEVICE_ID keyboardDevId; UGL_DEVICE_ID devId; UGL_GC_ID gc; UGL_FONT_ID fontId; UGL_FONT_DEF fontDef; UGL_FONT_DRIVER_ID fontDrvId; UGL_ORD textOrigin = UGL_FONT_TEXT_UPPER_LEFT; int displayHeight, displayWidth; int textWidth, textHeight; static UGL_CHAR * message = "Do you want to use WindML exclusively ? (y/n) "; uglInitialize(); uglDriverFind (UGL_DISPLAY_TYPE, 0, (UGL_UINT32 *)&devId); uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId); uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId); qId = uglEventQCreate (eventServiceId, 100); gc = uglGcCreate(devId); uglDriverFind (UGL_FONT_ENGINE_TYPE, 0, (UGL_UINT32 *)&fontDrvId); uglFontDriverInfo(fontDrvId, UGL_FONT_TEXT_ORIGIN, &textOrigin); uglFontFindString(fontDrvId, "familyName=Helvetica; pixelSize = 18", &fontDef); if ((fontId = uglFontCreate(fontDrvId, &fontDef)) == UGL_NULL) { printf("Font not found. Exiting.\n"); return; } uglInfo(devId, UGL_FB_INFO_REQ, &fbInfo); displayWidth = fbInfo.width; displayHeight = fbInfo.height; uglColorAlloc (devId, &colorTable[BLACK].rgbColor, UGL_NULL, &colorTable[BLACK].uglColor, 1); uglColorAlloc(devId, &colorTable[RED].rgbColor, UGL_NULL, &colorTable[RED].uglColor, 1); uglBackgroundColorSet(gc, colorTable[BLACK].uglColor); uglForegroundColorSet(gc, colorTable[RED].uglColor); uglFontSet(gc, fontId); uglTextSizeGet(fontId, &textWidth, &textHeight, -1, message); uglTextDraw(gc, (displayWidth - textWidth) / 2, (displayHeight - textHeight) / 2 - textHeight, -1, message); /* flushQ(); */ if (uglEventGet (qId, &event, sizeof (event), UGL_WAIT_FOREVER) != UGL_STATUS_Q_EMPTY) { pInputEvent = (UGL_INPUT_EVENT *)&event; if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD && pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN) { switch(pInputEvent->type.keyboard.key) { case 'Y': case 'y': windMLFlag = UGL_TRUE; break; default: windMLFlag = UGL_FALSE; } } } uglFontDestroy (fontId); uglGcDestroy (gc); uglEventQDestroy (eventServiceId, qId); uglDeinitialize(); windMLPoint(windMLFlag); windMLLine(windMLFlag); windMLFlip(windMLFlag); windMLCube(windMLFlag); windMLBounce(windMLFlag); windMLGears(windMLFlag); windMLIcoTorus(windMLFlag); windMLOlympic(windMLFlag); windMLTexCube(windMLFlag); windMLTexCyl(windMLFlag); windMLTeapot(windMLFlag); windMLStencil(windMLFlag); windMLDrawPix(windMLFlag); windMLAccum(windMLFlag); return; }