Exemplo n.º 1
0
/**************************************************************************/ /*!
* @brief   The function check if the coordination are in screen area
* @param   pScreen - the pointer to screen
* @param   point - pointer to input point structure
* @return  D4D_TRUE - in case that the coordination fits to the screen area, D4D_FALSE if not
* @note    None
*******************************************************************************/
D4D_BOOL D4D_ScrCheckCoor(D4D_SCREEN* pScreen, D4D_POINT* point)
{
  if((point->x >= pScreen->position.x) && (point->y >= (pScreen->position.y + D4D_GetScrHeaderSize(pScreen))))
  { 
    if((point->x <= (pScreen->position.x + pScreen->size.cx)) && (point->y <= (pScreen->position.y + pScreen->size.cy)))
      return D4D_TRUE;
  }
  return D4D_FALSE;
}
Exemplo n.º 2
0
/**************************************************************************/ /*!
* @brief   The function return the real client size of object
* @param   pObject - the pointer to object
* @return  client area object size
* @note    The function already handles also the compounded objects.
*******************************************************************************/
D4D_SIZE D4D_GetClientScreenSize(D4D_OBJECT* pObject)
{
    D4D_SIZE tmp_size = {0, 0};
    D4D_SCREEN* pScreen = pObject->pData->pScreen;


    if(pObject->pRelations)
    {
        D4D_OBJECT* pParent = (D4D_OBJECT*)pObject->pRelations[D4D_OBJECT_USR_DATA_PARENT_IX];

        if(pParent)
        {
            tmp_size = pParent->size;
            if(pParent->pMargin)
            {
                tmp_size.cx -= (D4D_COOR)(pParent->pMargin->left + pParent->pMargin->right);
                tmp_size.cy -= (D4D_COOR)(pParent->pMargin->top + pParent->pMargin->bottom);
            }
            return tmp_size;
        }
    }

    if(pScreen == NULL)
    {
        return tmp_size;
    }

    tmp_size.cx = pScreen->size.cx;
    tmp_size.cy = pScreen->size.cy;

    if(pScreen->flags & D4D_SCR_F_BEVEL)
    {
        tmp_size.cx -= 2 * D4D_BEVEL_WIDTH;
        tmp_size.cy -= 2 * D4D_BEVEL_WIDTH;
    }
    else if(pScreen->flags & D4D_SCR_F_OUTLINE)
    {
        tmp_size.cx -= 2;
        tmp_size.cy -= 2;
    }

    tmp_size.cy -= D4D_GetScrHeaderSize(pScreen);

    return tmp_size;
}
Exemplo n.º 3
0
/**************************************************************************/ /*!
* @brief   The function convert client point on the screen to the global screen point
* @param   pObject - the pointer to object
* @param   nClientPoint - pointer to client point structure
* @return  global screen point
* @note    The function already handles also the compounded objects.
*******************************************************************************/
D4D_POINT D4D_GetClientToScreenPoint(D4D_OBJECT* pObject, D4D_POINT* nClientPoint)
{
  D4D_POINT tmp_point;
  D4D_SCREEN* pScreen = pObject->pData->pScreen;
  
  
  if(pScreen == NULL)
  {
    return *nClientPoint;  
  }
  
  tmp_point.x = (D4D_COOR)(pScreen->position.x + nClientPoint->x);
  tmp_point.y = (D4D_COOR)(pScreen->position.y + nClientPoint->y);
  
  if(pScreen->flags & D4D_SCR_F_BEVEL)
    tmp_point.x += D4D_BEVEL_WIDTH;
  else if(pScreen->flags & D4D_SCR_F_OUTLINE)
  	tmp_point.x++;	
  
  tmp_point.y += D4D_GetScrHeaderSize(pScreen); 
  
  if(pObject->pRelations)
  {
    D4D_OBJECT* pParent = (D4D_OBJECT*)pObject->pRelations[D4D_OBJECT_USR_DATA_PARENT_IX];
  
    while(pParent)
    {
      tmp_point.x += pParent->position.x;
      tmp_point.y += pParent->position.y;
      
      if(pParent->pMargin)
      {
        tmp_point.x += pParent->pMargin->left;
        tmp_point.y += pParent->pMargin->top;        
      }
      
      pParent = (D4D_OBJECT*)pParent->pRelations[D4D_OBJECT_USR_DATA_PARENT_IX];
    }
  }
  
  return tmp_point;
}
Exemplo n.º 4
0
/**************************************************************//*!
*
* Compute position of exit button on screen header title
*
******************************************************************/
static D4D_BOOL D4D_GetScrHeaderExitBtnCoor(D4D_SCREEN* pScreen, D4D_POINT* resultPos, D4D_SIZE* resultSize)
{        
  D4D_COOR tmp_coor = D4D_GetScrHeaderSize(pScreen);
  
  resultPos->x = 0;
  resultPos->y = 0;
  
  resultSize->cx = 0;
  resultSize->cy = 0;
  
  if(pScreen == NULL)
    return D4D_FALSE;
  
  if((tmp_coor - D4D_SCR_TITLE_EXITBTN_OFFSET * 2) <= 0)
    return D4D_FALSE;

  tmp_coor -= D4D_SCR_TITLE_EXITBTN_OFFSET * 2;
  
  if(tmp_coor < D4D_SCR_TITLE_EXITBTN_MIN_SIZE)
    return D4D_FALSE;
  
  resultSize->cx = tmp_coor;
  resultSize->cy = tmp_coor;
  
  resultPos->x = (D4D_COOR)(pScreen->position.x + pScreen->size.cx - tmp_coor - D4D_SCR_TITLE_EXITBTN_OFFSET);
  resultPos->y = (D4D_COOR)(pScreen->position.y + D4D_SCR_TITLE_EXITBTN_OFFSET);
  
  if(pScreen->flags & D4D_SCR_F_BEVEL)
  {
    resultPos->x -= D4D_BEVEL_WIDTH;
    resultPos->y += D4D_BEVEL_WIDTH;
    
  }else if(pScreen->flags & D4D_SCR_F_OUTLINE)
  {
    resultPos->x--;
    resultPos->y++;
  }
  
  return D4D_TRUE;
}
Exemplo n.º 5
0
/**************************************************************//*!
*
* Redraw non client screen area - Header, background, title, etc.
*
******************************************************************/
static void D4D_DrawScreenNC(D4D_SCREEN* pScreen, D4D_BOOL active)
{
  D4D_CLR_SCHEME *pScheme = D4D_ScreenGetScheme(pScreen);
  D4D_COLOR clr;
  D4D_GEOMETRY contentGeom;
  D4D_POINT tmpPoint;
  D4D_SIZE tmpSize;
  
  contentGeom.pnt = pScreen->position;
  contentGeom.sz = pScreen->size;
  
  if(pScreen->flags & D4D_SCR_F_BEVEL)
  {
    contentGeom.pnt.x += D4D_BEVEL_WIDTH;
    contentGeom.pnt.y += D4D_BEVEL_WIDTH;
    contentGeom.sz.cx -= 2*D4D_BEVEL_WIDTH;
    contentGeom.sz.cy -= 2*D4D_BEVEL_WIDTH;
    
  }else if(pScreen->flags & D4D_SCR_F_OUTLINE)
  {
    contentGeom.pnt.x++;
    contentGeom.pnt.y++;
    contentGeom.sz.cx -= 2;
    contentGeom.sz.cy -= 2;      
  }
  
  if(active)
  {    
    if(pScreen->flags & D4D_SCR_F_BCKG)
    {    
      D4D_FillRRect(&contentGeom.pnt, &contentGeom.sz, pScheme->screen.desktop, pScreen->radius);
    }
    
    if(pScreen->flags & D4D_SCR_F_BEVEL)
    {
      D4D_Bevel(&(pScreen->position), &(pScreen->size), pScheme->screen.outline, D4D_BEVEL_RAISED, pScreen->radius);
    }else if(pScreen->flags & D4D_SCR_F_OUTLINE)
    {
      D4D_RRect(&(pScreen->position), &(pScreen->size), D4D_LINE_THIN, pScheme->screen.outline, pScreen->radius);
    }
  }

  if(pScreen->flags & D4D_SCR_F_TITLEBAR)
  {
    
    clr = pScheme->screen.title_bar;
    
    if(!active)
      clr = D4D_GetGreyScale(clr);    
    
    tmpSize = contentGeom.sz;
    tmpSize.cy = D4D_GetScrHeaderSize(pScreen);
    
    if(tmpSize.cy)
      tmpSize.cy--;

    D4D_FillRRect(&contentGeom.pnt, &tmpSize, clr, pScreen->radius);    
  }

  if(pScreen->pIcon != NULL)
  {
    tmpPoint = contentGeom.pnt;
    tmpPoint.x += D4D_SCR_TITLE_OFF_X;
    tmpPoint.y += (D4D_COOR)((D4D_GetScrHeaderSize(pScreen) - D4D_GetBmpHeight(pScreen->pIcon)) / 2);
    
    D4D_DrawRBmp(&tmpPoint, pScreen->pIcon, (D4D_BOOL)!active, pScreen->radius);  
  }

  if(pScreen->textBuff.pText)
  {        
    tmpPoint = contentGeom.pnt;
    tmpPoint.x += D4D_GetScrHeaderTitleOffset(pScreen);
    tmpPoint.y += (D4D_COOR)((D4D_GetScrHeaderSize(pScreen) - D4D_GetFontHeight(pScreen->textBuff.fontId)) / 2);
    
    clr = pScheme->screen.title_text;
    
    if(!active)
      clr = D4D_GetGreyScale(clr);    
    
    D4D_DrawText(&tmpPoint, &pScreen->textBuff, clr, 0);
    }

  if(pScreen->flags & D4D_SCR_F_EXIT)
  {
    clr = pScheme->screen.exitBtnFore;
    
    if(!active)
      clr = D4D_GetGreyScale(clr);
    
    if(D4D_GetScrHeaderExitBtnCoor(pScreen, &tmpPoint, &tmpSize))
    {         
      D4D_RBox(&tmpPoint, &tmpSize, D4D_LINE_THIN, clr, pScheme->screen.exitBtnBckg, pScreen->radius);
      
      tmpPoint.x += D4D_SCR_EXITBTN_CROSS_SIZE;
      tmpPoint.y += D4D_SCR_EXITBTN_CROSS_SIZE;    
#if D4D_ROUND_CORNER_ENABLE != D4D_FALSE    
      tmpPoint.x += (D4D_COOR)(pScreen->radius / 2);
      tmpPoint.y += (D4D_COOR)(pScreen->radius / 2);
#endif      
      
      D4D_MoveTo(&tmpPoint);
      tmpPoint.x += tmpSize.cx - (2 * D4D_SCR_EXITBTN_CROSS_SIZE);
      tmpPoint.y += tmpSize.cy - (2 * D4D_SCR_EXITBTN_CROSS_SIZE);
#if D4D_ROUND_CORNER_ENABLE != D4D_FALSE    
      tmpPoint.x -= (D4D_COOR)(pScreen->radius);
      tmpPoint.y -= (D4D_COOR)(pScreen->radius);
#endif        
      
      D4D_LineTo(&tmpPoint, D4D_LINE_THIN, clr);
      
      tmpPoint.y -= tmpSize.cy - (2 * D4D_SCR_EXITBTN_CROSS_SIZE);    
#if D4D_ROUND_CORNER_ENABLE != D4D_FALSE    
      tmpPoint.y += (D4D_COOR)(pScreen->radius);
#endif       
      D4D_MoveTo(&tmpPoint);
      tmpPoint.x -= tmpSize.cx - (2 * D4D_SCR_EXITBTN_CROSS_SIZE);
      tmpPoint.y += tmpSize.cy - (2 * D4D_SCR_EXITBTN_CROSS_SIZE);    
#if D4D_ROUND_CORNER_ENABLE != D4D_FALSE    
      tmpPoint.x += (D4D_COOR)(pScreen->radius);
      tmpPoint.y -= (D4D_COOR)(pScreen->radius);
#endif 
      D4D_LineTo(&tmpPoint, D4D_LINE_THIN, clr);
    }
  }
}