Пример #1
0
void XUIObject::onMouseMove(int x, int y) {
  if (m_dndDragging) return;
  int _x = x;
  int _y = y;
  m_wnd->clientToScreen(&_x, &_y);
  if (pointInRegion(x, y)) {
    if (!m_mouseInArea) {
      m_mouseInArea = 1;
      beginCapture(CAPTURETYPE_AREA);
      onMouseEnter();
    }
  } else {
    if (m_mouseInArea) {
      m_mouseInArea = 0;
      endCapture(CAPTURETYPE_AREA);
      onMouseLeave();
      // prevent further mousemove event processing, because we would not have gotten here 
      // had we not captured the mouse, and we only capture the mouse to implement the 
      // mouseenter/mouseleave events, not to cause any more mousemove events than normal.
      return;
    }
  }
  eventSource_onMouseMove(x, y);
  if (m_draggingWindow) {
    int ox = _x - m_draganchor_x;
    int oy = _y - m_draganchor_y;
    RECT r;
    m_wnd->getRootParent()->getWindowRect(&r);
    m_wnd->getRootParent()->move(r.left + ox, r.top + oy);
    m_draganchor_x = _x;
    m_draganchor_y = _y;
  }
  if (m_dndlbuttondown && !m_trieddnd) {
    if (ABS(_x - m_draganchor_x) >= 4 ||
        ABS(_y - m_draganchor_y) >= 4) {
      m_trieddnd = true;
      onBeginDrag(NULL);
      m_wnd->handleDrag();
    }
  }
}
Пример #2
0
   bool  ListView::onNotify(const UINT  iControlID, NMHDR*  pHeader)
   {
      bool   bResult = Unhandled;

      try
      {
         switch (pHeader->code)
         {
         case LVN_BEGINDRAG:     bResult = onBeginDrag(pHeader, reinterpret_cast<NMLISTVIEW*>(pHeader));             break;
         case LVN_COLUMNCLICK:   bResult = onColumnClick(pHeader, reinterpret_cast<NMLISTVIEW*>(pHeader));           break;
         case LVN_GETDISPINFO:   bResult = onRetrieveItem(pHeader, reinterpret_cast<NMLVDISPINFO*>(pHeader)->item);  break;
         case LVN_ENDLABELEDIT:  bResult = onLabelEditEnd(pHeader, reinterpret_cast<NMLVDISPINFO*>(pHeader)->item);  break;

         default:                bResult = BaseControl::onNotify(iControlID, pHeader);                                break;
         }

         return bResult;
      }
      catch (WindowsException&  ex) 
      {
         ex.Display(HERE, Handle);
         return Unhandled;
      }
   }