本文整理汇总了C++中ZLTextWordCursor::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ ZLTextWordCursor::isNull方法的具体用法?C++ ZLTextWordCursor::isNull怎么用?C++ ZLTextWordCursor::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZLTextWordCursor
的用法示例。
在下文中一共展示了ZLTextWordCursor::isNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lower_bound
std::vector<size_t>::const_iterator ZLTextView::nextBreakIterator() const {
ZLTextWordCursor cursor = endCursor();
if (cursor.isNull()) {
cursor = startCursor();
}
if (cursor.isNull()) {
return myTextBreaks.begin();
}
return std::lower_bound(myTextBreaks.begin(), myTextBreaks.end(), cursor.paragraphCursor().index());
}
示例2: isEnabled
bool ScrollToHomeAction::isEnabled() const {
if (!isVisible()) {
return false;
}
ZLTextWordCursor cursor = FBReader::Instance().bookTextView().textArea().startCursor();
return cursor.isNull() || !cursor.isStartOfParagraph() || !cursor.paragraphCursor().isFirst();
}
示例3: sizeOfParagraph
size_t ZLTextView::PositionIndicator::sizeOfTextBeforeParagraph(size_t paragraphIndex) const {
if (myTextView.myModel->kind() == ZLTextModel::TREE_MODEL) {
ZLTextWordCursor cursor = myTextView.startCursor();
if (cursor.isNull()) {
cursor = myTextView.endCursor();
}
if (!cursor.isNull()) {
const ZLTextTreeModel &treeModel = (const ZLTextTreeModel&)*myTextView.myModel;
size_t sum = 0;
for (size_t i = 0; i < paragraphIndex; ++i) {
const ZLTextTreeParagraph *para = (const ZLTextTreeParagraph*)treeModel[i];
if (para->parent()->isOpen()) {
sum += sizeOfParagraph(i);
}
}
return sum;
}
}
return myTextView.myTextSize[paragraphIndex] - myTextView.myTextSize[startTextIndex()];
}
示例4: preparePaintInfo
bool ZLTextAreaController::preparePaintInfo() {
if ((myPaintState == NOTHING_TO_PAINT) || (myPaintState == READY)) {
return false;
}
myArea.myLineInfoCache.insert(myArea.myLineInfos.begin(), myArea.myLineInfos.end());
switch (myPaintState) {
default:
break;
case TO_SCROLL_FORWARD:
if (!myArea.myEndCursor.paragraphCursor().isLast() ||
!myArea.myEndCursor.isEndOfParagraph()) {
ZLTextWordCursor startCursor;
switch (myScrollingMode) {
case NO_OVERLAPPING:
break;
case KEEP_LINES:
startCursor = findLineFromEnd(myOverlappingValue);
break;
case SCROLL_LINES:
startCursor = findLineFromStart(myOverlappingValue);
if (startCursor.isEndOfParagraph()) {
startCursor.nextParagraph();
}
break;
case SCROLL_PERCENTAGE:
startCursor = findPercentFromStart(myOverlappingValue);
break;
}
if (!startCursor.isNull() && (startCursor == myArea.myStartCursor)) {
startCursor = findLineFromStart(1);
}
if (!startCursor.isNull()) {
ZLTextWordCursor endCursor = buildInfos(startCursor);
if (!visiblePageIsEmpty() && ((myScrollingMode != KEEP_LINES) || (endCursor != myArea.myEndCursor))) {
myArea.myStartCursor = startCursor;
myArea.myEndCursor = endCursor;
break;
}
}
myArea.myStartCursor = myArea.myEndCursor;
myArea.myEndCursor = buildInfos(myArea.myStartCursor);
}
break;
case TO_SCROLL_BACKWARD:
if (!myArea.myStartCursor.paragraphCursor().isFirst() || !myArea.myStartCursor.isStartOfParagraph()) {
switch (myScrollingMode) {
case NO_OVERLAPPING:
myArea.myStartCursor = findStart(myArea.myStartCursor, PIXEL_UNIT, myArea.height());
break;
case KEEP_LINES:
{
ZLTextWordCursor endCursor = findLineFromStart(myOverlappingValue);
if (!endCursor.isNull() && (endCursor == myArea.myEndCursor)) {
endCursor = findLineFromEnd(1);
}
if (!endCursor.isNull()) {
ZLTextWordCursor startCursor = findStart(endCursor, PIXEL_UNIT, myArea.height());
myArea.myStartCursor =
(startCursor != myArea.myStartCursor) ?
startCursor : findStart(myArea.myStartCursor, PIXEL_UNIT, myArea.height());
} else {
myArea.myStartCursor = findStart(myArea.myStartCursor, PIXEL_UNIT, myArea.height());
}
break;
}
case SCROLL_LINES:
myArea.myStartCursor = findStart(myArea.myStartCursor, LINE_UNIT, myOverlappingValue);
break;
case SCROLL_PERCENTAGE:
myArea.myStartCursor =
findStart(myArea.myStartCursor, PIXEL_UNIT, myArea.height() * myOverlappingValue / 100);
break;
}
myArea.myEndCursor = buildInfos(myArea.myStartCursor);
if (visiblePageIsEmpty()) {
myArea.myStartCursor = findStart(myArea.myStartCursor, LINE_UNIT, 1);
myArea.myEndCursor = buildInfos(myArea.myStartCursor);
}
}
break;
case START_IS_KNOWN:
myArea.myEndCursor = buildInfos(myArea.myStartCursor);
if (visiblePageIsEmpty()) {
ZLTextWordCursor startCursor = findLineFromStart(1);
//.........这里部分代码省略.........