本文整理汇总了C++中Preferences::getCursorType方法的典型用法代码示例。如果您正苦于以下问题:C++ Preferences::getCursorType方法的具体用法?C++ Preferences::getCursorType怎么用?C++ Preferences::getCursorType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::getCursorType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPreferences
void CodeEditor::getPreferences() {
Preferences *p = Preferences::instance();
mFontSize = p->getFontSize();
mTextColor = p->getTheme().textColor;
mCursorColor = p->getTheme().cursorColor;
mMarkColor = p->getTheme().markColor;
mCurrentCharColor = p->getTheme().currentCharColor;
mLineNumberAreaColor = p->getTheme().lineNumberAreaColor;
mLineNumberTextColor = p->getTheme().lineNumberTextColor;
mLineHighlightColor = p->getTheme().lineHighlightColor;
mLineHighlightTextColor = p->getTheme().lineHighlightTextColor;
mTabWidth = p->getTabWidth();
mLineEnding = "\n"; //TODO: Make this an option.
mShowLineNumbers = p->showLineNumbers();
mUseTabs = p->useTabs();
mShowMark = p->showMark();
mShowLineHighlight = p->showLineHighlight();
mLineHighlightType = p->getLineHighlightType();
mScrollSpeed = p->getScrollSpeed();
Font *font = p->getFont();
Glyph g = font->getGlyph('a', mFontSize, false);
mFontWidth = staticCastu32(g.advance);
if (mShowLineNumbers) {
mLineNumberAreaWidth = mFontSize * 3;
} else {
mLineNumberAreaWidth = 0;
}
if (mText.size() > 0) {
for (int i = 0; i < mText.size(); ++i) {
mText[i].setColor(mTextColor);
mText[i].setCharSize(mFontSize);
mText[i].setPosition(mPos.x + mLineNumberAreaWidth, mText[i].getPosition().y);
mText[i].setFont(*font);
}
}
if (mLineNumbers.size() > 0) {
for (int i = 0; i < mLineNumbers.size(); ++i) {
mLineNumbers[i].setColor(mLineNumberTextColor);
mLineNumbers[i].setCharSize(mFontSize);
mLineNumbers[i].setFont(*font);
}
}
mLineNumberArea = RectangleShape(mLineNumberAreaWidth, 1920);
mLineNumberArea.setFillColor(mLineNumberAreaColor);
mLineNumberArea.setPosition(mPos.x, mPos.y);
mCursorType = p->getCursorType();
mBlinkCursor = p->cursorBlinks();
mShowCursor = true;
mLastBlinkTime = mClock.getCurrentTimeInMilliseconds();
if (mCursorType == CursorType::Block) {
mCursorRect = RectangleShape(g.advance, font->getLineSpacing(mFontSize));
mCursorRect.setFillColor(mCursorColor);
} else if (mCursorType == CursorType::Outline) {
mCursorRect = RectangleShape(g.advance, font->getLineSpacing(mFontSize));
mCursorRect.setOutlineColor(mCursorColor);
mCursorRect.setOutlineThickness(1);
mCursorRect.setFillColor(Color::Transparent);
} else if (mCursorType == CursorType::Underscore) {
mCursorRect = RectangleShape(g.advance, 2);
mCursorRect.setFillColor(mCursorColor);
} else {
mCursorRect = RectangleShape(1, font->getLineSpacing(mFontSize));
mCursorRect.setFillColor(mCursorColor);
}
mMarkRect = RectangleShape(g.advance, font->getLineSpacing(mFontSize));
mMarkRect.setOutlineColor(mMarkColor);
mMarkRect.setOutlineThickness(1);
mMarkRect.setFillColor(Color::Transparent);
mLineHighlightRect = RectangleShape(128, font->getLineSpacing(mFontSize));
mLineHighlightRect.setFillColor(mLineHighlightColor);
mCurrentChar = Text("", *font, mFontSize);
mCurrentChar.setDoMultiColor(false);
mCurrentChar.setColor(mCurrentCharColor);
mCurrentChar.setPosition(mCursorRect.getPosition());
//TODO: Topbar will be seperate widget, will be given a code editor to monitor.
mTopBarText = Text("", *font, mFontSize);
mTopBarText.setPosition(8, 22);
mTopBarText.setColor(p->getTheme().barTextColor);
mTopbar = RectangleShape(128, 22);
mTopbar.setFillColor(p->getTheme().barColor);
mTopbar.setPosition(mPos.x, 20);
}