本文整理汇总了C++中InlineTextBox::checkSelectionPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineTextBox::checkSelectionPoint方法的具体用法?C++ InlineTextBox::checkSelectionPoint怎么用?C++ InlineTextBox::checkSelectionPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineTextBox
的用法示例。
在下文中一共展示了InlineTextBox::checkSelectionPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkSelectionPoint
FindSelectionResult RenderText::checkSelectionPoint(int _x, int _y, int _tx, int _ty, DOM::NodeImpl*& node, int &offset, SelPointState &)
{
// kdDebug(6040) << "RenderText::checkSelectionPoint " << this << " _x=" << _x << " _y=" << _y
// << " _tx=" << _tx << " _ty=" << _ty << endl;
//kdDebug(6040) << renderName() << "::checkSelectionPoint x=" << xPos() << " y=" << yPos() << " w=" << width() << " h=" << height() << " m_lines.count=" << m_lines.count() << endl;
NodeImpl *lastNode = 0;
int lastOffset = 0;
FindSelectionResult lastResult = SelectionPointAfter;
for(unsigned int si = 0; si < m_lines.count(); si++)
{
InlineTextBox* s = m_lines[si];
FindSelectionResult result;
const Font *f = htmlFont( si==0 );
result = s->checkSelectionPoint(_x, _y, _tx, _ty, f, this, offset, m_lineHeight);
// kdDebug(6040) << "RenderText::checkSelectionPoint " << this << " line " << si << " result=" << result << " offset=" << offset << endl;
if ( result == SelectionPointInside ) // x,y is inside the textrun
{
offset += s->m_start; // add the offset from the previous lines
// kdDebug(6040) << "RenderText::checkSelectionPoint inside -> " << offset << endl;
node = element();
return SelectionPointInside;
} else if ( result == SelectionPointBefore ) {
if (!lastNode) {
// x,y is before the textrun -> stop here
offset = 0;
// kdDebug(6040) << "RenderText::checkSelectionPoint " << this << "before us -> returning Before" << endl;
node = element();
return SelectionPointBefore;
}
} else if ( result == SelectionPointBeforeInLine ) {
offset = s->m_start;
node = element();
return SelectionPointInside;
} else if ( result == SelectionPointAfterInLine ) {
lastOffset = s->m_start + s->m_len;
lastNode = element();
lastResult = result;
// no return here
}
}
if (lastNode) {
offset = lastOffset;
node = lastNode;
// kdDebug(6040) << "RenderText::checkSelectionPoint: lastNode " << lastNode << " lastOffset " << lastOffset << endl;
return lastResult;
}
// set offset to max
offset = str->l;
//qDebug("setting node to %p", element());
node = element();
// kdDebug(6040) << "RenderText::checkSelectionPoint: node " << node << " offset " << offset << endl;
return SelectionPointAfter;
}