void Tooltip_CtorZ(Tooltip *me, IShell *piShell, IDisplay *piDisplay, int16 yBottom, int16 nX, int16 nDx, uint32 ulDelay, uint32 ulExpires, PFNNOTIFY pfnInvalidate, void *pInvalidateData) { me->piShell = piShell; ISHELL_AddRef(piShell); me->piDisplay = piDisplay; IDISPLAY_AddRef(piDisplay); me->nX = nX; me->nDx = nDx; me->ulDelay = ulDelay; me->ulExpires = ulExpires; me->pfnInvalidate = pfnInvalidate; me->pInvalidateData = pInvalidateData; { int nAscent, nDescent; IDISPLAY_GetFontMetrics(piDisplay,AEE_FONT_NORMAL,&nAscent,&nDescent); me->rc.x = 0; me->rc.dy = nAscent + nDescent + 4; me->rc.y = MAX(0, yBottom - me->rc.dy - 2); } }
uint32 IMainUI_Show(IMainUI* pUI){ CtlAddItem ai; AEERect rRect; boolean ok; pUI->glbVar->appState = APP_STATE_MAINUI; IDisplay_ClearScreen(pUI->glbVar->pIDisplay); IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_TITLE); IMENUCTL_SetTitle(pUI->pMenu, NULL, 0, pUI->glbVar->pIResouce->idsResource); // Add Items in the Menu IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_LOCATE); // Add Items in the Menu //ai.pText = pUI->glbVar->pIResouce->idsResource; ai.pImage = NULL; ai.pszResImage = ai.pszResText = NULL; ai.wImage = NULL; ai.wText = NULL; ai.dwData = 0; // Add New ai.wFont = AEE_FONT_NORMAL; ai.wItemID = IDS_MAINUI_LOCATE; //位置上报 IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_LOCATE); ai.pText = pUI->glbVar->pIResouce->idsResource; ai.wItemID = IDS_MAINUI_LOCATE; ok = IMENUCTL_AddItemEx(pUI->pMenu, &ai); //拍照上传 IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_PHOTO); ai.pText = pUI->glbVar->pIResouce->idsResource; ai.wItemID = IDS_MAINUI_PHOTO; IMENUCTL_AddItemEx(pUI->pMenu, &ai); SETAEERECT(&rRect, 0, 5, pUI->glbVar->pDevice->cxScreen, pUI->glbVar->pDevice->cyScreen - IDISPLAY_GetFontMetrics( pUI->glbVar->pIDisplay, AEE_FONT_NORMAL, NULL, NULL ) - 10); IMENUCTL_SetRect(pUI->pMenu, &rRect); IMENUCTL_SetActive(pUI->pMenu, FALSE); IMENUCTL_Redraw(pUI->pMenu); IRESOURCE_LoadResource(pUI->glbVar->pIResouce, IDS_MAINUI_SETTINGS); IMENUCTL_AddItem(pUI->pSK, NULL, NULL, IDS_MAINUI_SETTINGS, pUI->glbVar->pIResouce->idsResource, 0); IMENUCTL_Redraw(pUI->pSK); pUI->focusCTL = MAINUI_INIT; return AEE_SUCCESS; }
void COMMON_Init(Common* common, IDisplay* display, IShell* shell, int buffer_size) { AEEDeviceInfo devinfo; common->display = display; common->size = buffer_size; common->start_line = 0; common->lines = 0; common->message = (AECHAR*)MALLOC(buffer_size * sizeof(AECHAR)); common->message[0] = 0; common->message[buffer_size - 1] = 0; // 画面サイズを取得 ISHELL_GetDeviceInfo(shell, &devinfo); common->width = devinfo.cxScreen; common->height = devinfo.cyScreen; // フォント情報を取得 common->font_height = IDISPLAY_GetFontMetrics(common->display, AEE_FONT_NORMAL, NULL, NULL); return; }
/*=========================================================================== This function redraws the main window. ===========================================================================*/ static void CWhereDetailsWin_Redraw(IWindow * po) { CWhereDetailsWin * pme = (CWhereDetailsWin *)po; if (!pme->m_bActive) return; //XXX __begin IDISPLAY_ClearScreen(pme->m_pIDisplay); TS_DrawBackgroud(po); { AECHAR bufRes[MP_MAX_STRLEN]; int a = 0, b = 0; int h = 0, xx = 0, yy = 0, dxx = 0, dyy = 0; AEERect rect; int xMargin = 0; ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_0, bufRes, sizeof(bufRes)); h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12; xx = xMargin; yy = 64; dxx = pme->m_pOwner->m_cxWidth - 2; dyy = h; SETAEERECT(&rect, xx, yy, dxx, dyy); TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect); ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_1, bufRes, sizeof(bufRes)); h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12; xx = xMargin; yy += h; dxx = pme->m_pOwner->m_cxWidth - 2; dyy = h; SETAEERECT(&rect, xx, yy, dxx, dyy); TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect); ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_2, bufRes, sizeof(bufRes)); h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12; xx = xMargin; yy += h; dxx = pme->m_pOwner->m_cxWidth - 2; dyy = h; SETAEERECT(&rect, xx, yy, dxx, dyy); TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect); ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_3, bufRes, sizeof(bufRes)); h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12; xx = xMargin; yy += h; dxx = pme->m_pOwner->m_cxWidth - 2; dyy = h; SETAEERECT(&rect, xx, yy, dxx, dyy); TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect); ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_4, bufRes, sizeof(bufRes)); h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12; xx = xMargin; yy += h; dxx = pme->m_pOwner->m_cxWidth - 2; dyy = h; SETAEERECT(&rect, xx, yy, dxx, dyy); TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect); ISHELL_LoadResString(pme->m_pOwner->a.m_pIShell,NAVIGATE_RES_FILE,IDS_STRING_WHERE_DETAILS_5, bufRes, sizeof(bufRes)); h = IDISPLAY_GetFontMetrics(pme->m_pIDisplay, WIN_FONT, &a, &b) + 12; xx = xMargin; yy += h; dxx = pme->m_pOwner->m_cxWidth - 2; dyy = h; SETAEERECT(&rect, xx, yy, dxx, dyy); TS_DrawText(pme->m_pIDisplay, WIN_FONT, bufRes, &rect); } IDISPLAY_Update(pme->m_pIDisplay); //XXX _end }
/*=========================================================================== FUNCTION CallDemoApp_InitAppData DESCRIPTION This function initializes app specific data. PROTOTYPE: static boolean CallDemoApp_InitAppData(IApplet* pi); PARAMETERS: pi [in]: Pointer to the IApplet structure. DEPENDENCIES None. RETURN VALUE TRUE: If the app has app data is allocated and initialized successfully FALSE: Either app data could not be allocated or initialized SIDE EFFECTS None. ===========================================================================*/ static boolean CallDemoApp_InitAppData(IApplet* pi) { CallDemoApp * pMe = (CallDemoApp*)pi; int charHeight, pnAscent, pnDescent; AEEDeviceInfo di; int nErr; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL) return FALSE; pMe->m_pIMenu = NULL; // Determine the amount of available screen space ZEROAT(&di); di.wStructSize = sizeof(di); ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); pMe->m_rc.dx = di.cxScreen; pMe->m_rc.dy = di.cyScreen; // Determine the height of a line of text charHeight = IDISPLAY_GetFontMetrics (pMe->a.m_pIDisplay, AEE_FONT_NORMAL, &pnAscent, &pnDescent); // Number of available lines equals the available screen // space divided by the height of a line, minus 3 for the // lines we always print at the top and bottom of the screen pMe->m_cMaxLine = (di.cyScreen / charHeight) - 3; pMe->m_pCallMgr = NULL; pMe->m_pOutgoingCall = NULL; pMe->m_pIncomingCall = NULL; nErr =ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_CALLMGR, (void**) &pMe->m_pCallMgr); DBGPRINTF("CreateInst AEECLSID_CALLMGR ret %d", nErr); if(nErr != AEE_SUCCESS) { return FALSE; } if(SUCCESS != ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_TELEPHONE, (void **) &pMe->m_pTelephone)) { return FALSE; } if(SUCCESS != ITELEPHONE_QueryInterface(pMe->m_pTelephone, AEEIID_MODEL, (void **) &pMe->m_pModel)) { return FALSE; } LISTENER_Init((ModelListener *)&pMe->m_lisPhone, MyPhoneListener, (void *) pMe); IMODEL_AddListener(pMe->m_pModel, (ModelListener *) &pMe->m_lisPhone); #ifdef EVENT_AUTO_GET pMe->m_UserAnswerEvent = ISHELL_RegisterEvent(pMe->a.m_pIShell, "user anwser event", NULL ); pMe->m_UserRedirectEvent = ISHELL_RegisterEvent(pMe->a.m_pIShell, "user redirect event", NULL ); #endif pMe->m_isDTMFItem = FALSE; pMe->m_isParty3Item= FALSE; pMe->m_isRedirectItem = FALSE; return TRUE; }
/*=========================================================================== FUNCTION: DisplayOutput DESCRIPTION This function displays an output string at a given line number on the screen. If the nline parameter is a negative value (-1) the string is displayed in the middle of the screen. If the "nline" value is larger than or equal to zero the "nline" value is multiplied by 15 and the resulting value in pixels is set to the y-coordinate of the start of the string display on the screen. If the string does not fit on one line the string wraps around to the next line (spaced rougly 10-15 pixels apart). By default 5 is used as the starting the x-coordinate of a displayed string. How many characters that fit on one line is calculated for each line that is wrapped around to the next line. Note: depending on the phone screen size and the fonts used for characters the output might differ on different handsets (devices). Where some handsets will have a smaller screen and large default fonts which will cause partial overlapping of lines. This function does not try to address these issues (this is meant as a simple display function). PROTOTYPE: int DisplayOutput(IShell *pIShell, IDisplay *pDisplay, int nline, char *pszStr, AECHAR *pszwStr, boolean isWideChar) PARAMETERS: pIShell: [in]: Contains a pointer to the IShell interface. pIDisplay: [in]: Contains a pointer to the IDisplay interface. nline: [in]: Contains the line number to start displaying the text. The line numbers are by default spaced 15 pixels apart along the y-axis. pszStr: [in]: The character string to be displayed on the screen. DEPENDENCIES None RETURN VALUE Number of lines written to the screen. SIDE EFFECTS None ===========================================================================*/ static int DisplayOutput(IShell *pIShell, IDisplay *pIDisplay, int nline, char *pszStr, AECHAR *pszwStr, boolean isWideChar) { AEEDeviceInfo di; // Device Info AECHAR * szBuf; // a buffer that supports 200 char string AECHAR * psz = NULL; int charHeight = 0; // Stores the char height in pixels for given font int pnAscent = 0; // Stores the ascent in number of pixels int pnDescent = 0; // Stores the descent in number of pixels int pixelWidth; AEEFont font = AEE_FONT_NORMAL; int pnFits = 0, dy; int totalCh = 0; int numLinesPrinted = 0; // Make sure the pointers we'll be using are valid if (pIShell == NULL || pIDisplay == NULL) { return 0; } if ((szBuf = (AECHAR *) MALLOC(TEXT_BUFFER_SIZE)) == NULL) { return 0; } // Get device information ISHELL_GetDeviceInfo(pIShell,&di); // Get the font metrics info charHeight = IDISPLAY_GetFontMetrics (pIDisplay, AEE_FONT_NORMAL, &pnAscent, &pnDescent); if(isWideChar) { WSTRCPY(szBuf,pszwStr); } else { // Convert to wide string (unicode) STR_TO_WSTR ((char *)pszStr, szBuf, TEXT_BUFFER_SIZE); } // If nlines is zero then print this string starting around the middle of // the screen. Or else multiply nlines by charheight to decide the y coordinate of // the start of the string. if (nline < 0) { dy = di.cyScreen*2/5; } else{ dy = nline * charHeight + 5; } // psz keeps track of the point from which to write from the string buffer // in case the string does not fit one line and needs to wrap around in the // next line. psz = szBuf; // Need to calculate the lotal string length to decide if any wrapping // around is needed. if(isWideChar) { totalCh = 2*WSTRLEN (pszwStr); } else { totalCh = STRLEN ((char *)pszStr); } // Keep displaying text string on multiple lines if the string can't be displayed // on one single line. Lines are spaced 15 pixels apart. while ((totalCh > 0) && (*psz != NULL)) { // Get information on how many characters will fit in a line. // Give the pointer to the buffer to be displayed, and the number of // pixels along the x axis you want to display the string in (max number) // pnFits will have the max number of chars that will fit in the maxWidth // number of pixels (given string can't fit in one line), or the number of // chars in the string (if it does fit in one line). pnWidth gives the // number of pixels that will be used to display pnFits number of chars. pixelWidth = IDISPLAY_MeasureTextEx(pIDisplay, font, (AECHAR *) psz, // Start of the buffer to display, -1, di.cxScreen - 5, // maxWidth &pnFits); // Number of chars that will fit a line // If pnFits is zero there is something wrong in the input to above function. // Normally this scenario should not occur. But, have the check anyway. if (pnFits == 0) { FREE(szBuf); return 0; } IDISPLAY_DrawText(pIDisplay, AEE_FONT_NORMAL, psz, pnFits, 5 /*start dx*/, dy, 0 /* use default rectangle coordinates */, 0); psz += pnFits; // move pointer to the next segment to be displayed totalCh -= pnFits; // reduce the total number of characters to still display dy += charHeight; // Place next line charHeight pixels below the // previous line. ++numLinesPrinted; IDISPLAY_Update(pIDisplay); //, TRUE); if (totalCh < pnFits) pnFits = totalCh; // if total number is less than pnFits, adjust pnFits } FREE(szBuf); return numLinesPrinted; } // End of DisplayOutput
/*=========================================================================== FUNCTION ISmsApp_InitAppData DESCRIPTION This function initializes app specific data. PROTOTYPE: static boolean ISmsApp_InitAppData(IApplet* pi); PARAMETERS: pi [in]: Pointer to the IApplet structure. DEPENDENCIES None. RETURN VALUE TRUE: If the app has app data is allocated and initialized successfully FALSE: Either app data could not be allocated or initialized SIDE EFFECTS None. ===========================================================================*/ static boolean ISmsApp_InitAppData(IApplet* pi) { ISmsApp * pMe = (ISmsApp*)pi; int charHeight, pnAscent, pnDescent; AEEDeviceInfo di; int nErr; int i; AECHAR szwStr[32]; char szNumber[32]; #define MAX_ENC 32 uint32 *EncodingMoSms; uint32 nSize; IModel * pIModel = NULL; // Make sure the pointers we'll be using are valid if (pMe == NULL || pMe->a.m_pIShell == NULL) return FALSE; pMe->m_pIMenu = NULL; pMe->m_pISMSMsg = NULL; pMe->m_pISMS = NULL; pMe->m_pISMSStorage = NULL; // Determine the amount of available screen space ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&di); // Determine the height of a line of text charHeight = IDISPLAY_GetFontMetrics (pMe->a.m_pIDisplay, AEE_FONT_NORMAL, &pnAscent, &pnDescent); // Number of available lines equals the available screen // space divided by the height of a line, minus 3 for the // lines we always print at the top and bottom of the screen pMe->m_cMaxLine = (di.cyScreen / charHeight) - 3; nErr =ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMS, (void **)&pMe->m_pISMS); DBGPRINTF("CreateInstance of AEECLSID_SMS ret %d", nErr); if(nErr != AEE_SUCCESS) { return FALSE; } if ((ISMS_GetEncodingsAvailableForMOSMS(pMe->m_pISMS, NULL, (uint32*)&nSize) == SUCCESS) && ((EncodingMoSms = (uint32*)MALLOC(nSize)) != NULL) && (ISMS_GetEncodingsAvailableForMOSMS(pMe->m_pISMS, EncodingMoSms, (uint32*)&nSize) == SUCCESS)) { nSize = nSize/sizeof(uint32); DBGPRINTF("ISMS_GetEncodingsAvailableForMOSMS"); DBGPRINTF("size Encode ret:%d", nSize); for(i=0; i<nSize; i++) { DBGPRINTF("en[%d]=%x", i, EncodingMoSms[i]); } } if ((nErr = ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SMSSTORAGE, (void**)&pMe->m_pISMSStorage)) != SUCCESS) { DBGPRINTF("CreateInstance SMSSTORAGE ret %d", nErr); return FALSE; } if (pMe->m_pISMSStorage && (SUCCESS == ISMSSTORAGE_QueryInterface(pMe->m_pISMSStorage, AEEIID_MODEL, (void**)&pIModel))) { IMODEL_AddListenerEx(pIModel, &pMe->m_SMSStorageModelListener, (PFNLISTENER)OATSMSStorage_ModelListener, pMe); IMODEL_Release(pIModel); pIModel = NULL; } ISHELL_LoadResString(pMe->a.m_pIShell, ISMS_RES_FILE, IDS_SMS_TAG, szwStr, sizeof(szwStr)); WSTRTOSTR(szwStr, szNumber, sizeof(szNumber)); pMe->m_tag = STRTOUL(szNumber, NULL, 10); ISHELL_LoadResString(pMe->a.m_pIShell, ISMS_RES_FILE, IDS_SMS_MT, szwStr, sizeof(szwStr)); WSTRTOSTR(szwStr, szNumber, sizeof(szNumber)); pMe->m_mt = STRTOUL(szNumber, NULL, 10); return TRUE; }
/*=========================================================================== FUNCTION: CGMENUCTL_Redraw DESCRIPTION: Redraws the control on the device screen. If the control currently has focus, the control is drawn with a border. PARAMETERS: pCtl [in] - A pointer to a CGMeuCtl instance DEPENDENCIES: None RETURN VALUE: None SIDE EFFECTS: Updates the device screen. ===========================================================================*/ extern void CGMENUCTL_Redraw(CGMeuCtl* pMe) { AEEApplet* pApp = (AEEApplet*)GETAPPINSTANCE(); AEERect rRect; if (pMe) { int i, j, height, h, a, b; AEEImageInfo infSe, infIc; AEERect rec; int xx, yy, dxx, dyy; RGBVAL oldColor; GMenuItem * pData = NULL; TQueueList * p = pMe->m_pDataList; ZEROAT(&infSe); IDISPLAY_EraseRect(pApp->m_pIDisplay, &pMe->m_Rect); h = IDISPLAY_GetFontMetrics(pApp->m_pIDisplay, AEE_FONT_NORMAL, &a, &b); //绘制背景图 if (pMe->m_pImageBk) { IIMAGE_SetDrawSize(pMe->m_pImageBk, pMe->m_Rect.dx, pMe->m_Rect.dy); IIMAGE_Draw(pMe->m_pImageBk, pMe->m_Rect.x, pMe->m_Rect.y); } //确定菜单高度 if (pMe->m_pImageSe) { IIMAGE_GetInfo(pMe->m_pImageSe, &infSe); IIMAGE_SetDrawSize(pMe->m_pImageSe, pMe->m_Rect.dx, infSe.cy); } else { infSe.cx = pMe->m_Rect.dx; infSe.cy = h; } //绘制菜单项 i = 0; j = 0; height = pMe->m_Rect.y + 5; while (p) { AECHAR iTemText[256]; if (i < pMe->m_startIndex) { p = p->pNext; i++; continue; } if (j >= pMe->m_pageSize) { break; } pData = (GMenuItem*)p->pData; //加载菜单ICON if (pData->pImage == NULL && pData->pszResImage != NULL && pData->wImage != 0) { pData->pImage = ISHELL_LoadResImage(pApp->m_pIShell, pData->pszResImage, pData->wImage); } //加载菜单Text if (pData->pszResText != NULL && pData->wText != 0) { MEMSET(iTemText, 0, sizeof(AECHAR)*256); ISHELL_LoadResString(pApp->m_pIShell, pData->pszResText, pData->wText, iTemText, sizeof(AECHAR)* 256); pData->pText = iTemText; } if (i == pMe->m_Index) { if (pMe->m_pImageSe) IIMAGE_Draw(pMe->m_pImageSe, pMe->m_Rect.x, height + 2); ZEROAT(&infIc); if (pData->pImage) { IIMAGE_GetInfo(pData->pImage, &infIc); IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2); } xx = pMe->m_Rect.x + infIc.cx + 2; yy = height + (infSe.cy - h) / 2 + 2; dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx; dyy = h; SETAEERECT(&rec, xx, yy, dxx, dyy); oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cSelText); if (pMe->m_Properties & 0x02) IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT); IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT); if (pMe->m_isActive) { if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText) > dxx) { if (IDISPLAY_MeasureText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText + pMe->m_textPos) > dxx) { pMe->m_textPos++; } else pMe->m_textPos = 0; //单行太长的话,动态显示 ISHELL_SetTimer(pApp->m_pIShell, 300, (PFNNOTIFY)CGMENUCTL_Redraw, (void*)pMe); } } height += infSe.cy; IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor); } else { ZEROAT(&infIc); if (pData->pImage) { IIMAGE_GetInfo(pData->pImage, &infIc); IIMAGE_Draw(pData->pImage, pMe->m_Rect.x, height + (infSe.cy - infIc.cy) / 2); } xx = pMe->m_Rect.x + infIc.cx + 2; yy = height + (infSe.cy - h) / 2 + 2; dxx = pMe->m_Rect.x + pMe->m_Rect.dx - xx; dyy = h; SETAEERECT(&rec, xx, yy, dxx, dyy); oldColor = IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, pMe->m_Colors.cText); if (pMe->m_Properties & 0x01) IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx + 1, yy, &rec, IDF_TEXT_TRANSPARENT); IDISPLAY_DrawText(pApp->m_pIDisplay, AEE_FONT_NORMAL, pData->pText, -1, xx, yy, &rec, IDF_TEXT_TRANSPARENT); height += infSe.cy; IDISPLAY_SetColor(pApp->m_pIDisplay, CLR_USER_TEXT, oldColor); } p = p->pNext; i++; j++; } IDISPLAY_Update(pApp->m_pIDisplay); return ; } }
/** || Function || -------- || static void StatusBox_Init(StatusBox *me) || || Description || ----------- || load the IImage, calculate rectangles || || Parameters || ---------- || StatusBox *me: the status box || || Returns || ------- || nothing || || Remarks || ------- || */ static void StatusBox_Init(StatusBox *me) { AEEImageInfo ii; ZEROAT(&ii); /* re-init this stuff every time */ if ((IImage *)0 != me->piImage) { IIMAGE_GetInfo(me->piImage, &ii); if ((ii.cx == 0) || (ii.cy == 0)) { /* IIMAGE barfed */ RELEASEIF(me->piImage); ZEROAT(&ii); } else if (ii.bAnimated) { me->bSelfAnimated = TRUE; me->nFrame = -1; IIMAGE_SetParm(me->piImage, IPARM_REDRAW, (int)me->pfnInvalidate, (int)me->pInvalidateData); } else { uint16 uFrameWidth; if (me->uFrameWidth != 0) { uFrameWidth = me->uFrameWidth; } else { /* use the height, for square frames */ uFrameWidth = ii.cy; } me->nFrames = MAX(1,ii.cx/uFrameWidth); if ((me->nFrames * uFrameWidth) != ii.cx) { /* not exact frames, don't animate */ me->nFrames = 1; } else { ii.cx = uFrameWidth; /* fake out rect calc stuff below */ } if (0 == me->uFrameDuration) { me->uFrameDuration = 150; } IIMAGE_SetFrameCount(me->piImage, me->nFrames); me->nFrame = 0; /* Don't do this, run animation myself for invalidation code to work animate over 1 second... IIMAGE_SetAnimationRate(me->piImage, 1000/nFrames); */ } } /* initialize status rectangles */ /* if we found the image above and it's non-empty...*/ if (0 != ii.cy) { me->rcImage.y = me->rcCenter.y + ((me->rcCenter.dy - ii.cy) / 2) - 1; me->rcImage.x = me->rcCenter.x + ((me->rcCenter.dx - ii.cx) / 2) - 1; /* insist on square */ me->rcImage.dy = ii.cy + 2; me->rcImage.dx = ii.cx + 2; /* image too big for screen, fuggedaboudit */ if ((me->rcImage.dy > me->rcCenter.dy) || (me->rcImage.dx > me->rcCenter.dx)) { RELEASEIF(me->piImage); ZEROAT(&me->rcImage); } } else {/* no image, just text box... */ ZEROAT(&me->rcImage); } { int nAscent; int nDescent; IDISPLAY_GetFontMetrics(me->piDisplay,AEE_FONT_NORMAL, &nAscent,&nDescent); me->rcText.dy = nAscent + nDescent + 4; } if ((0 == me->rcImage.dy) || (me->rcImage.dy + me->rcText.dy - 1 > me->rcCenter.dy)) { me->rcText.y = me->rcCenter.y + ((me->rcCenter.dy - me->rcText.dy) / 2); } else { me->rcImage.y -= me->rcText.dy/2; me->rcText.y = me->rcImage.y + me->rcImage.dy - 1; } }