本文整理汇总了C++中TextLine::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ TextLine::getString方法的具体用法?C++ TextLine::getString怎么用?C++ TextLine::getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLine
的用法示例。
在下文中一共展示了TextLine::getString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawCursor
void TextEdit::drawCursor(int cx, int cy, bool on, bool createGC /* = false */)
{
bool cursorOn = on;
if (!focusIn || inputDisabled) cursorOn = false;
if (cx < windowX || cy < windowY || cx >= windowX + windowWidth || cy >= windowY + windowHeight) return; // Cursor outside of window
GC savedGC;
if (createGC) {
// Save the previous graphic contex, create a temporary GC
savedGC = m_GC;
m_GC = XCreateGC(m_Display, m_Window, 0, 0);
setFont(textFont);
}
if (cursorOn) setForeground(fgColor);
else setForeground(bgColor);
int x = leftMargin + (cx - windowX) * dx;
int y = topMargin + (cy - windowY) * dy;
fillRectangle(I2Rectangle(x, y, dx, ascent + descent));
if (cursorOn) setForeground(bgColor);
else setForeground(fgColor);
if (cy <= text.size())
{
TextLine* line;
if (cy == text.size()) { line = &(endOfText); } else { line = &(text.getLine(cy)); }
if (cx < line->length()) { drawString(x, y + ascent, line->getString() + cx, 1); }
}
if (createGC)
{
// Release the temporary graphic contex, restore the previous GC
XFreeGC(m_Display, m_GC);
m_GC = savedGC;
}
}