void CCQChildStatic::SetText(int x, int y, CString text,COLORREF TextColor) { if(m_ParentDC !=NULL) { int OldMode = m_ParentDC->SetBkMode(TRANSPARENT); if(OldMode == 0 ) { DisplayErrorInfo(string("SetBkMode")); } COLORREF OldColor = m_ParentDC->SetTextColor(TextColor); if(OldColor == CLR_INVALID) { DisplayErrorInfo(string("SetTextColor")); } if(!m_ParentDC->TextOut(m_Range.left +x ,m_Range.top + y,text,text.GetLength())) { DisplayErrorInfo(string("TextOut")); } if(!m_ParentDC->SetBkMode(OldMode)) { DisplayErrorInfo(string("SetBkMode")); } if(m_ParentDC->SetTextColor(OldColor) == CLR_INVALID) { DisplayErrorInfo(string("SetTextColor")); } } }
void BitMapProgress::SetForegroundBmp(UINT ForegroundBmpID) { if((HBITMAP)m_cbForeground) { if(!m_cbForeground.DeleteObject()) { DisplayErrorInfo(string("DeleteObject")); } } if(!m_cbForeground.LoadBitmap(ForegroundBmpID)) { DisplayErrorInfo(string("LoadBitmap")); } }
/************************************************************************ Function: BYTE ShowNextSlide(void) Overview: Display the next image when slide show is enabled. Input: none Output: Returns the status if at the end of the list. ************************************************************************/ BYTE ShowNextSlide(void) { BYTE temp = NextSlide; IMG_FILE *pImgFile; if(NextSlide == 0xFF || NextSlide >= bNumElementsInFolder) { return (0); } while(aFolderElement[NextSlide].blFolder == 1 || aFolderElement[NextSlide].blText == 1) { NextSlide = (NextSlide + 1) % bNumElementsInFolder; if(NextSlide == temp) { return (0); } } pImgFile = IMG_FOPEN(aFolderElement[NextSlide].Name, "rb"); if(pImgFile != NULL) { if ( ImageDecode ( pImgFile, aFolderElement[NextSlide].ImgType, 0, 0, IMG_SCREEN_WIDTH, IMG_SCREEN_HEIGHT, (IMG_DOWN_SCALE | IMG_ALIGN_CENTER), NULL, NULL ) ) { DisplayErrorInfo(); } IMG_FCLOSE(pImgFile); NextSlide = (NextSlide + 1) % bNumElementsInFolder; return (1); } return (0); }
/************************************************************************ Function: WORD JPEGMsgCallback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg) Overview: This function is called by GOLMsg() function when in this particular demo each time the valid message is received for the objects in the demo. Input: objMsg - translated message for the object, pObj - pointer to the object, pMsg - pointer to the non-translated, raw GOL message Output: If the function returns non-zero the message will be processed by the object directly affected by the message. Default action on the object based on the message will be performed. ************************************************************************/ WORD JPEGMsgCallback(WORD objMsg, OBJ_HEADER *pObj, GOL_MSG *pMsg) { LISTITEM *pItemSel; // check if an image is being shown if((blImageOnScreen == 1) || (blSlideShowOn == 1)) { // this is the routine to go back and show the list when an // image is being shown on the screen or the slide show is // currently ongoing if(pMsg->uiEvent == EVENT_RELEASE) { blImageOnScreen = 0; blSlideShowOn = 0; GOLRedrawRec(0, 0, GetMaxX(), GetMaxY()); } return (0); } switch(GetObjID(pObj)) { case ID_BUTTON_A: if(objMsg == BTN_MSG_RELEASED) { // check if button is pressed // do not process if user moved the touch away from the button // returning 1 wil update the button if(pMsg->uiEvent == EVENT_MOVE) return (1); screenState = CREATE_DEMOSELECTION; } return (1); case ID_BUTTON_D: if(objMsg == BTN_MSG_RELEASED) { // check if button is pressed // do not process if user moved the touch away from the button // returning 1 wil update the button if(pMsg->uiEvent == EVENT_MOVE) return (1); // enable the slide show blSlideShowOn = 1; // initialize the screen SetColor(BLACK); ClearDevice(); ClrState(pObj, BTN_PRESSED); // clear the pressed state, will be shown only when redrawn blSlideShowDelay = 0; // force slide show to immediately start return (0); } return (1); case ID_JPGLISTBOX: if(pMsg->uiEvent == EVENT_MOVE) { pMsg->uiEvent = EVENT_PRESS; // change event for listbox // Process message by default LbMsgDefault(objMsg, (LISTBOX *)pObj, pMsg); // Set new list box position SldSetPos(pSlider, LbGetCount(pListBox) - LbGetFocusedItem(pListBox) - 1); SetState(pSlider, SLD_DRAW_THUMB); pMsg->uiEvent = EVENT_MOVE; // restore event for listbox } else if(pMsg->uiEvent == EVENT_PRESS) { // call the message default processing of the list box to select the item LbMsgDefault(objMsg, (LISTBOX *)pObj, pMsg); } else if(pMsg->uiEvent == EVENT_RELEASE) { // check which item was selected and display appropriate screen pItemSel = LbGetSel(pListBox, NULL); // get the selected item if(aFolderElement[pItemSel->data].blFolder == 1) { if(FSchdir(aFolderElement[pItemSel->data].Name) == 0) { FillNewElements(); return (1); } } else if(aFolderElement[pItemSel->data].blText == 0) { IMG_FILE *pImgFile = IMG_FOPEN(aFolderElement[pItemSel->data].Name, "rb"); if(pImgFile != NULL) { blImageOnScreen = 1; // initialize the screen SetColor(BLACK); ClearDevice(); if ( ImageDecode ( pImgFile, aFolderElement[pItemSel->data].ImgType, 0, 0, IMG_SCREEN_WIDTH, IMG_SCREEN_HEIGHT, (IMG_DOWN_SCALE | IMG_ALIGN_CENTER), NULL, NULL ) ) { DisplayErrorInfo(); } IMG_FCLOSE(pImgFile); } } } // The message was processed. To avoid other objects processing the // processed message reset the message. pMsg->uiEvent = EVENT_INVALID; return (0); case ID_SLD4LB: if((objMsg == SLD_MSG_INC) || (objMsg == SLD_MSG_DEC)) { // check slider was touched. // Process message by default SldMsgDefault(objMsg, (SLIDER *)pObj, pMsg); // Set new list box position if(LbGetFocusedItem(pListBox) != LbGetCount(pListBox) - SldGetPos(pSlider)) { LbSetFocusedItem(pListBox, LbGetCount(pListBox) - SldGetPos(pSlider)); SetState(pListBox, LB_DRAW_ITEMS); } } // The message was processed return (0); case ID_BTNUP4LB: // slider up button was pressed if(objMsg == BTN_MSG_RELEASED) { // check if we have reached the very first then stay there. if (LbGetFocusedItem(pListBox) == 0) LbSetFocusedItem(pListBox,0); else LbSetFocusedItem(pListBox,LbGetFocusedItem(pListBox)-1); SetState(pListBox, LB_DRAW_ITEMS); SldSetPos(pSlider, SldGetPos(pSlider) + 1); SetState(pSlider, SLD_DRAW_THUMB); } return (1); case ID_BTNDN4LB: // slider down button was pressed if(objMsg == BTN_MSG_RELEASED) { // set all items to be not displayed pItemSel = pListBox->pItemList; while(pItemSel != NULL) { pItemSel->status = 0; pItemSel = pItemSel->pNextItem; } LbSetFocusedItem(pListBox, LbGetFocusedItem(pListBox) + 1); SetState(pListBox, LB_DRAW_ITEMS); SldSetPos(pSlider, SldGetPos(pSlider) - 1); SetState(pSlider, SLD_DRAW_THUMB); } return (1); } return (1); }