示例#1
0
  /// Called from Message() for MSG_GETCUSTOMICON.
  void OnGetCustomIcon(BaseObject* op, GetCustomIconData* data)
  {
    IconData* dIcon = data->dat;
    BaseBitmap* bmp;
    LONG xoff, yoff, xdim, ydim;

    if (m_customIcon)
    {
      if (dIcon->bmp)
      {
        // We can not free the previous bitmap, because it leads to a
        // crash. We copy the custom icon bitmap to the already
        // present bitmap.
        bmp = dIcon->bmp;
        m_customIcon->CopyTo(bmp);
      }
      else
      {
        bmp = m_customIcon->GetClone();
      }
      xoff = 0;
      yoff = 0;
      xdim = bmp->GetBw();
      ydim = bmp->GetBh();
    }
    else
    {
      bmp = dIcon->bmp;
      if (!bmp)
      {
        bmp = BaseBitmap::Alloc();
        bmp->Init(64, 64);
      }
      if (GetIcon(Ocontainer, dIcon))
      {
        dIcon->bmp->CopyTo(bmp);
      }
      xoff = dIcon->x;
      yoff = dIcon->y;
      xdim = dIcon->w;
      ydim = dIcon->h;
    }

    if (bmp)
    {
      // Adjust the IconData.
      dIcon->x = xoff;
      dIcon->y = yoff;
      dIcon->w = xdim;
      dIcon->h = ydim;
      dIcon->bmp = bmp;
      data->filled = true;
    }
    else
    {
      data->filled = false;
    }
  }
示例#2
0
void PaletteColor::DrawMsg(Int32 x1,Int32 y1,Int32 x2,Int32 y2, const BaseContainer &msg)
{
	OffScreenOn();
	BaseBitmap *bitmap = m_normalBitmap;
	switch(m_hoverState){
		case HOVER_CENTER:
			bitmap = m_hoverBitmap;
			break;
		case HOVER_LEFT:
			bitmap = m_leftHoverBitmap;
			break;
		case HOVER_RIGHT:
			bitmap = m_rightHoverBitmap;
			break;
        case HOVER_DELETE:
            bitmap = m_crossHoverBitmap;
            break;
	}
	DrawBitmap(bitmap,x1,y1,bitmap->GetBw(),bitmap->GetBh(),0,0,bitmap->GetBw(),bitmap->GetBh(),BMP_NORMAL);
}