void ZLTextView::PositionIndicator::draw() { ZLTextBaseStyle &baseStyle = ZLTextStyleCollection::instance().baseStyle(); ZLPaintContext &context = this->context(); ZLTextWordCursor endCursor = myTextView.endCursor(); bool isEndOfText = false; if (endCursor.isEndOfParagraph()) { isEndOfText = !endCursor.nextParagraph(); } myExtraWidth = 0; if (myInfo.isTimeShown()) { drawExtraText(timeString()); } if (myInfo.isBatteryShown()) { drawExtraText(batteryString()); } if (myInfo.isTextPositionShown()) { drawExtraText(textPositionString()); } const long bottom = this->bottom(); const long top = this->top(); const long left = this->left(); const long right = this->right(); if (left >= right) { return; } size_t fillWidth = right - left - 1; if (!isEndOfText) { fillWidth = muldiv(fillWidth, sizeOfTextBeforeCursor(myTextView.endCursor()), sizeOfTextBeforeParagraph(endTextIndex())); } context.setColor(baseStyle.RegularTextColorOption.value()); context.setFillColor(myInfo.color()); context.fillRectangle(myTextView.visualX(left + 1), top + 1, myTextView.visualX(left + fillWidth + 1), bottom - 1); context.drawLine(myTextView.visualX(left), top, myTextView.visualX(right), top); context.drawLine(myTextView.visualX(left), bottom, myTextView.visualX(right), bottom); context.drawLine(myTextView.visualX(left), bottom, myTextView.visualX(left), top); context.drawLine(myTextView.visualX(right), bottom, myTextView.visualX(right), top); }
void ZLTextView::PositionIndicator::draw() { ZLPaintContext &context = this->context(); ZLTextWordCursor endCursor = myTextView.textArea().endCursor(); bool isEndOfText = false; if (endCursor.isEndOfParagraph()) { isEndOfText = !endCursor.nextParagraph(); } myExtraWidth = 0; if (myInfo.isTimeShown()) { drawExtraText(timeString()); } if (myInfo.isTextPositionShown()) { drawExtraText(textPositionString()); } const long bottom = this->bottom(); const long top = this->top(); const long left = this->left(); const long right = this->right(); if (left >= right) { return; } size_t fillWidth = right - left - 1; if (!isEndOfText) { fillWidth = muldiv(fillWidth, sizeOfTextBeforeCursor(myTextView.textArea().endCursor()), sizeOfTextBeforeParagraph(endTextIndex())); } context.setColor(myTextView.color()); context.setFillColor(myInfo.color()); context.fillRectangle(left + 1, top + 1, left + fillWidth + 1, bottom - 1); context.drawLine(left, top, right, top); context.drawLine(left, bottom, right, bottom); context.drawLine(left, bottom, left, top); context.drawLine(right, bottom, right, top); }