コード例 #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
  virtual Bool CopyTo(NodeData* nDest, GeListNode* node, GeListNode* destNode,
        COPYFLAGS flags, AliasTrans* at) override
  {
    Bool result = super::CopyTo(nDest, node, destNode, flags, at);
    if (!result) return result;
    ContainerObject* dest = (ContainerObject*) nDest;

    // Copy the custom icon to the new NodeData.
    if (dest->m_customIcon)
      BaseBitmap::Free(dest->m_customIcon);
    if (m_customIcon)
      dest->m_customIcon = m_customIcon->GetClone();

    // And the other stuff.. :-)
    dest->m_protected = m_protected;
    dest->m_protectionHash = m_protectionHash;

    return result;
  }