Exemple #1
0
/*-----------------------------------------------------------------------------
* FUNCTION:    SCRSVR_PicOnUsrMessage
* SCOPE:       Screen saver screen related function - local
* DESCRIPTION: User message handler function for picture object, to redraw the last picture position by background color
*
* PARAMETERS:  pMsg - pointer to D4D_MESSAGE structure
*              
* RETURNS:     return if this message discard or not
*-----------------------------------------------------------------------------*/
static Byte SCRSVR_PicOnUsrMessage(D4D_MESSAGE* pMsg)
{
  if(pMsg->nMsgId == D4D_MSG_DRAWDONE)
  {
    D4D_SIZE pictSize = D4D_GetBmpSize(((D4D_PICTURE*)scrsvr_picLogo.pParam)->pBmp);    
    D4D_SIZE rectSize;
    D4D_POINT rectPoint;
    
    // Draw the horizontal box
    rectSize.cy = D4D_Abs16(dy);
    rectSize.cx = pictSize.cx;
    
    rectPoint = oldPos;
    
    if(oldPos.y > scrsvr_picLogo.position.y)
      rectPoint.y += pictSize.cy;
    
    D4D_FillRect(&rectPoint, &rectSize, D4D_COLOR_BLACK);
    
    // Draw the vertical box
    rectSize.cx = D4D_Abs16(dx);
    rectSize.cy = pictSize.cy;
    
    rectPoint = oldPos;
    
    if(oldPos.x > scrsvr_picLogo.position.x)
      rectPoint.x += pictSize.cx;
    
    D4D_FillRect(&rectPoint, &rectSize, D4D_COLOR_BLACK);
  }
  
  return D4D_MSG_NOSKIP;
}
Exemple #2
0
/*-----------------------------------------------------------------------------
* FUNCTION:    ScreenScrSvr_MovePicture
* SCOPE:       Screen saver screen related function - local
* DESCRIPTION: Local function to move the screen saver picture
*
* PARAMETERS:  none
*              
* RETURNS:     none
*-----------------------------------------------------------------------------*/
static void ScreenScrSvr_MovePicture(void)
{  
  D4D_SIZE pictSize = D4D_GetBmpSize(((D4D_PICTURE*)scrsvr_picLogo.pParam)->pBmp);
  
  // Move the picture on new position
  oldPos = scrsvr_picLogo.position;
  
  if(((oldPos.x + dx + pictSize.cx + 1) >= screen_scrsvr.size.cx) || ((oldPos.x + dx) < 0))
    dx *= -1;
    
  scrsvr_picLogo.position.x = oldPos.x + dx;
  
  if(((oldPos.y + dy + pictSize.cy + 1) >= screen_scrsvr.size.cy) || ((oldPos.y + dy) < 0))
    dy *= -1;
    
  scrsvr_picLogo.position.y = oldPos.y + dy;
  
  D4D_InvalidateObject(&scrsvr_picLogo, D4D_TRUE);
}
Exemple #3
0
static void D4D_CheckBoxValue2Coor(D4D_OBJECT* pThis)
{
  D4D_CHECKBOX* pCheckB = D4D_GET_CHECKBOX(pThis);
  D4D_SIZE sizeBmpEnabled;
  D4D_COOR tmp_BorderOffset;

  _calc.position = D4D_GetClientToScreenPoint(pThis, &pThis->position);
  D4D_ComputeGeometry(&(_calc.contentGeom), pThis);
  
  sizeBmpEnabled = D4D_GetBmpSize(pCheckB->pBmpChecked);
  
  _calc.BmpGeom = _calc.contentGeom;
  
  if(!sizeBmpEnabled.cx || !sizeBmpEnabled.cy)
  {
    _calc.BmpGeom.sz.cy = (D4D_COOR)((_calc.BmpGeom.sz.cy * 2) / 3);
    _calc.BmpGeom.sz.cx = _calc.BmpGeom.sz.cy;
  }else
    _calc.BmpGeom.sz = sizeBmpEnabled; 
 
  tmp_BorderOffset = (D4D_COOR)((_calc.contentGeom.sz.cy - _calc.BmpGeom.sz.cy) / 2);
  _calc.BmpGeom.pnt.x += tmp_BorderOffset;
  _calc.BmpGeom.pnt.y += tmp_BorderOffset;
 
  if(pCheckB->textBuff.pText)
  {
    _calc.TxtGeom = _calc.contentGeom;
    
    _calc.TxtGeom.pnt.x = (D4D_COOR) (_calc.BmpGeom.pnt.x + _calc.BmpGeom.sz.cx + D4D_CHECKBOX_TEXT_OFFSET);      
    _calc.TxtGeom.sz.cx -= (D4D_COOR) (_calc.TxtGeom.pnt.x - _calc.contentGeom.pnt.x);
    #if D4D_ROUND_CORNER_ENABLE != D4D_FALSE  
      _calc.TxtGeom.sz.cx -= (D4D_COOR) (pThis->radius / 2);
    #endif   
  }
     
#if D4D_ROUND_CORNER_ENABLE != D4D_FALSE  
    _calc.iconRadius = pThis->radius;
#endif

}