void TableHeader::checkMouseMargins(MouseEventDetails* const e) { if(isContainedClipBounds(e->getLocation(), this)) { Pnt2f MousePosInComponent = ViewportToComponent(e->getLocation(), this, e->getViewport()); UInt32 CumulativeHeaderWidth(0); for(UInt32 i(0) ; i<getMFColumnHeaders()->size() ; ++i) { CumulativeHeaderWidth += getColumnHeaders(i)->getSize().x(); if(MousePosInComponent.x() >= CumulativeHeaderWidth - getResizingCursorDriftAllowance() && MousePosInComponent.x() <= CumulativeHeaderWidth + getColumnModel()->getColumnMargin() + getResizingCursorDriftAllowance()) { getParentWindow()->getParentDrawingSurface()->getEventProducer()->setCursorType(WindowEventProducer::CURSOR_RESIZE_W_TO_E); return; } CumulativeHeaderWidth += getColumnModel()->getColumnMargin(); } } getParentWindow()->getParentDrawingSurface()->getEventProducer()->setCursorType(WindowEventProducer::CURSOR_POINTER); }
void TableHeader::mousePressed(MouseEventDetails* const e) { if(getResizingAllowed()) { Pnt2f MousePosInComponent = ViewportToComponent(e->getLocation(), this, e->getViewport()); UInt32 CumulativeHeaderWidth(0); for(UInt32 i(0) ; i<getMFColumnHeaders()->size() ; ++i) { CumulativeHeaderWidth += getColumnHeaders(i)->getSize().x(); if(MousePosInComponent.x() >= CumulativeHeaderWidth - getResizingCursorDriftAllowance() && MousePosInComponent.x() <= CumulativeHeaderWidth + getColumnModel()->getColumnMargin() + getResizingCursorDriftAllowance()) { _ColBorderMouseDraggedConnection = getParentWindow()->getParentDrawingSurface()->getEventProducer()->connectMouseDragged(boost::bind(&TableHeader::handleColBorderMouseDragged, this, _1)); _ColBorderMouseReleasedConnection = getParentWindow()->getParentDrawingSurface()->getEventProducer()->connectMouseReleased(boost::bind(&TableHeader::mouseColBorderMouseReleased, this, _1)); _ResizingColumn = i; return; } CumulativeHeaderWidth += getColumnModel()->getColumnMargin(); } } Inherited::mousePressed(e); }
void TableHeader::mousePressed(const MouseEventUnrecPtr e) { if(getResizingAllowed()) { Pnt2f MousePosInComponent = ViewportToComponent(e->getLocation(), TableHeaderRefPtr(this), e->getViewport()); UInt32 CumulativeHeaderWidth(0); for(UInt32 i(0) ; i<getMFColumnHeaders()->size() ; ++i) { CumulativeHeaderWidth += getColumnHeaders(i)->getSize().x(); if(MousePosInComponent.x() >= CumulativeHeaderWidth - getResizingCursorDriftAllowance() && MousePosInComponent.x() <= CumulativeHeaderWidth + getColumnModel()->getColumnMargin() + getResizingCursorDriftAllowance()) { getParentWindow()->getDrawingSurface()->getEventProducer()->addMouseMotionListener(&(_MarginDraggedListener)); getParentWindow()->getDrawingSurface()->getEventProducer()->addMouseListener(&(_MarginDraggedListener)); _ResizingColumn = i; return; } CumulativeHeaderWidth += getColumnModel()->getColumnMargin(); } } Inherited::mousePressed(e); }