本文整理汇总了C++中GetText函数的典型用法代码示例。如果您正苦于以下问题:C++ GetText函数的具体用法?C++ GetText怎么用?C++ GetText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BeginScan
void
CBCSharpStyler::Scan
(
istream& input,
const TokenExtra& initData
)
{
BeginScan(input);
const JString& text = GetText();
Token token;
JFontStyle style;
do
{
token = NextToken();
if (token.type == kEOF)
{
break;
}
// save token starts
if (token.type == kID ||
token.type == kReservedCKeyword ||
token.type == kBuiltInDataType ||
token.type == kString ||
token.type == kComment ||
token.type == kDocComment)
{
SaveTokenStart(TokenExtra());
}
// set the style
const JIndex typeIndex = token.type - kWhitespace;
if (token.type == kWhitespace)
{
style = GetDefaultFontStyle();
}
else if (token.type == kComment ||
token.type == kDocComment ||
token.type == kString)
{
style = GetTypeStyle(typeIndex);
}
else if (token.type == kPPDirective && SlurpPPComment(&(token.range)))
{
token.type = kComment;
style = GetTypeStyle(kComment - kWhitespace);
}
else if (token.type == kPPDirective)
{
style = GetStyle(typeIndex, text.GetSubstring(GetPPNameRange()));
}
else if (token.type < kWhitespace)
{
style = GetTypeStyle(kError - kWhitespace);
}
else if (token.type > kError) // misc
{
if (!GetWordStyle(text.GetSubstring(token.range), &style))
{
style = GetDefaultFontStyle();
}
}
else
{
style = GetStyle(typeIndex, text.GetSubstring(token.range));
}
}
while (SetStyle(token.range, style));
}
示例2: IsOn
bool CPrefsDialog::OKClicked()
{
font_family defFamily;
font_style defStyle;
be_plain_font->GetFamilyAndStyle(&defFamily, &defStyle);
gPrefs->SetPrefString("defdoc font family", fNewFontFamily);
gPrefs->SetPrefString("defdoc font style", defStyle);
gPrefs->SetPrefDouble("defdoc font size", fNewFontSize);
be_bold_font->GetFamilyAndStyle(&defFamily, &defStyle);
gPrefs->SetPrefString("border font family", fNewBFontFamily);
gPrefs->SetPrefString("border font style", defStyle);
gPrefs->SetPrefDouble("border font size", fNewBFontSize);
gPrefs->SetPrefInt("decimal point", *GetText("decsep"));
gPrefs->SetPrefInt("thousands separator", *GetText("thoussep"));
gPrefs->SetPrefInt("list separator", *GetText("listsep"));
gPrefs->SetPrefInt("date separator", *GetText("datesep"));
gPrefs->SetPrefInt("time separator", *GetText("timesep"));
gPrefs->SetPrefString("date order", fDMY->FindMarked()->Label());
gPrefs->SetPrefInt("24 hours", IsOn("24 hours"));
gPrefs->SetPrefInt("Excel keys", IsOn("excel"));
gPrefs->SetPrefInt("Select Gray", IsOn("grayselect"));
gPrefs->SetPrefInt("start with new", IsOn("donew"));
gWithEqualSign = IsOn("formula starts with equal");
gPrefs->SetPrefInt("formula starts with equal", gWithEqualSign);
gPrefs->SetPrefInt("dark gridlines", IsOn("dark gridlines"));
if (gPrefs->GetPrefInt("dark gridlines", 0))
gGridColor = 10;
else
gGridColor = 6;
gPrefs->SetPrefString("c_symbol", GetText("c_symbol"));
gPrefs->SetPrefInt("c_before", IsOn("c_before"));
gPrefs->SetPrefInt("c_neg_par", IsOn("c_neg_par"));
gPrefs->SetPrefInt("c_digits", atoi(GetText("c_digits")));
if (fPageSetup)
{
char *ps = Bin2Hex(fPageSetup, fPageSetupSize);
gPrefs->SetPrefString("default page setup", ps);
FREE(ps);
}
BMessage msg(msg_WindowOptions);
msg.AddString("docfamily", fDocFontFamily);
msg.AddString("docstyle", "Roman");
msg.AddFloat("docsize", fDocFontSize);
msg.AddString("borderfamily", fDocBFontFamily);
msg.AddString("borderstyle", "Bold");
msg.AddFloat("bordersize", fDocBFontSize);
msg.AddBool("autorecalc", IsOn("autorecalc"));
msg.AddBool("displayzero", IsOn("displayzero"));
msg.AddBool("dispgrid", IsOn("dispgrid"));
msg.AddBool("disphead", IsOn("disphead"));
msg.AddBool("prgrid", IsOn("prgrid"));
msg.AddBool("prhead", IsOn("prhead"));
fOwner->PostMessage(&msg, fOwner->GetCellView());
BButton *b;
b = (BButton *)FindView("ok");
b->SetEnabled(false);
b = (BButton *)FindView("cancel");
b->SetEnabled(false);
InitFormatter();
return false;
} /* CPrefsDialog::OKClicked */
示例3: GetText
void CListBoxEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
m_pwndSBV->MoveWindow(m_rcSBV);
if ((int)lpDrawItemStruct->itemID < 0)
return;
CString text;
GetText(lpDrawItemStruct->itemID, text);
CRect rect = lpDrawItemStruct->rcItem;
int cntItem = GetCount();
int numShow = m_rcSBV.Height() / m_nItemHeight;
// 스크롤바가 생성되면 List Box의 드로우 영역을 줄인다.
if (cntItem > numShow)
rect.right -= 20;
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
Graphics mainG (lpDrawItemStruct->hDC);
Color clrText = m_clrTextNom;
// 선택된 Item 영역 그리는 부분.
if ((lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
{
DrawItem(&mainG,rect,m_clrItemHot);
clrText = m_clrTextHot;
DrawText(&mainG,rect,text,clrText);
}
// 기본 Item 영역 그리는 부분.
if (!(lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
{
if (m_bModeOneColor == true)
{
DrawItem(&mainG,rect,m_clrItemNom1);
}
else
{
Color clr;
lpDrawItemStruct->itemID%2 ? clr = m_clrItemNom1 : clr = m_clrItemNom2;
DrawItem(&mainG,rect,clr);
}
DrawText(&mainG,rect,text,clrText);
}
// 선택 -> 미선택 Item 영역 그리는 부분.
if (!(lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & ODA_SELECT))
{
if (m_bModeOneColor == true)
{
DrawItem(&mainG,rect,m_clrItemNom1);
}
else
{
Color clr;
lpDrawItemStruct->itemID%2 ? clr = m_clrItemNom1 : clr = m_clrItemNom2;
DrawItem(&mainG,rect,clr);
}
DrawText(&mainG,rect,text,clrText);
}
}
示例4: GetText
CString FORMULA_Formula::GetText(byte mode)
{
int layer = 0;
return GetText(mode, layer);
}
示例5: GetText
WString GuiBindableListView::ItemSource::GetTextValue(vint itemIndex)
{
return GetText(itemIndex);
}
示例6: GetText
const char32_t* LineEditData::GetViewText() const {
return GetText().c_str() + scroll;
}
示例7: GetText
std::string CGUITextBox::GetDescription() const
{
return GetText();
}
示例8: BeginScan
void
CBTCLStyler::Scan
(
std::istream& input,
const TokenExtra& initData
)
{
BeginScan(input);
const JString& text = GetText();
JBoolean keepGoing;
Token token;
JFontStyle style;
do
{
token = NextToken();
if (token.type == kEOF)
{
break;
}
// save token starts
if (token.type == kPredefinedWord ||
token.type == kOtherWord ||
token.type == kVariable ||
token.type == kString ||
token.type == kComment)
{
SaveTokenStart(TokenExtra());
}
// handle special cases
if (token.type == kString ||
token.type == kUnterminatedString)
{
ExtendCheckRangeForString(token.range);
}
// set the style
const JIndex typeIndex = token.type - kWhitespace;
if (token.type == kWhitespace)
{
style = GetDefaultFont().GetStyle();
}
else if (token.type == kComment ||
token.type == kString ||
token.type == kBrace ||
token.type == kSquareBracket ||
token.type == kParenthesis)
{
style = GetTypeStyle(typeIndex);
}
else if (token.type < kWhitespace)
{
style = GetTypeStyle(kError - kWhitespace);
}
else
{
style = GetStyle(typeIndex, text.GetSubstring(token.range));
}
keepGoing = SetStyle(token.range, style);
if (token.type == kString)
{
StyleEmbeddedVariables(token);
}
}
while (keepGoing);
}
示例9: SaveOptStringValue
void CUIEditBox::SaveValue(){
CUIOptionsItem::SaveValue();
SaveOptStringValue(GetText());
}
示例10: SelectAll
/**
* Convenience for {@link Selection#selectAll}.
*/
ECode EditText::SelectAll()
{
Selection::SelectAll(ISpannable::Probe(GetText().Get()));
return NOERROR;
}
示例11: ExtendSelection
/**
* Convenience for {@link Selection#extendSelection}.
*/
ECode EditText::ExtendSelection(
/* [in] */ Int32 index)
{
Selection::ExtendSelection(ISpannable::Probe(GetText().Get()), index);
return NOERROR;
}
示例12: GetText
void Field::AutoComplete() {
//We want to complete in the middle of a command text with potentially multiple commands
//Add slash prefix and get command text up to cursor
if (GetText().empty() || (GetText()[0] != '/' && GetText()[0] != '\\')) {
GetText().insert(GetText().begin(), '/');
SetCursor(GetCursorPos() + 1);
}
std::string commandText = Str::UTF32To8(GetText().substr(1, GetCursorPos() - 1));
//Split the command text and find the command to complete
const char* commandStart = commandText.data();
const char* commandEnd = commandText.data() + commandText.size();
while (true) {
const char* next = Cmd::SplitCommand(commandStart, commandEnd);
if (next != commandEnd)
commandStart = next;
else
break;
}
//Parse the arguments and get the list of candidates
Cmd::Args args(std::string(commandStart, commandEnd));
int argNum = args.Argc() - 1;
std::string prefix;
if (!args.Argc() || Str::cisspace(GetText()[GetCursorPos() - 1])) {
argNum++;
} else {
prefix = args.Argv(argNum);
}
Cmd::CompletionResult candidates = Cmd::CompleteArgument(args, argNum);
if (candidates.empty()) {
return;
}
std::sort(candidates.begin(), candidates.end());
candidates.erase(std::unique(candidates.begin(), candidates.end()), candidates.end());
//Compute the longest common prefix of all the results
int prefixSize = candidates[0].first.size();
size_t maxCandidateLength = 0;
for (auto& candidate : candidates) {
prefixSize = std::min(prefixSize, Str::LongestIPrefixSize(candidate.first, candidates[0].first));
maxCandidateLength = std::max(maxCandidateLength, candidate.first.length());
}
std::string completedArg(candidates[0].first, 0, prefixSize);
//Help the user bash the TAB key, but not when completing paths
if (candidates.size() == 1 && !Str::cisspace(GetText()[GetCursorPos()]) && !Str::IsSuffix("/", completedArg)) {
completedArg += " ";
}
//Insert the completed arg
std::u32string toInsert = Str::UTF8To32(completedArg);
DeletePrev(prefix.size());
GetText().insert(GetCursorPos(), toInsert);
SetCursor(GetCursorPos() + toInsert.size());
//Print the matches if it is ambiguous
if (candidates.size() >= 2) {
Com_Printf(S_COLOR_YELLOW "-> " S_COLOR_WHITE "%s\n", Str::UTF32To8(GetText()).c_str());
for (const auto& candidate : candidates) {
std::string filler(maxCandidateLength - candidate.first.length(), ' ');
Com_Printf(" %s%s %s\n", candidate.first.c_str(), filler.c_str(), candidate.second.c_str());
}
}
}
示例13: HistoryNext
void Field::HistoryNext() {
std::string current = Str::UTF32To8(GetText());
NextLine(hist, current);
SetText(Str::UTF8To32(current));
}
示例14: ASSERT
void CListBox::GetText(int nIndex, CString& rString) const
{
ASSERT(::IsWindow(m_hWnd));
GetText(nIndex, rString.GetBufferSetLength(GetTextLen(nIndex)));
rString.ReleaseBuffer();
}
示例15: GetText
/*
* Return true if the two tokens are equivalent in a
* Speech recognition way.
*/
bool Token::IsEquivalentTo(Token* token)
{
string tok1;
string tok2;
if (segment->PerformCaseSensitiveAlignment()) //case sensitive
{
tok1 = GetText();
tok2 = token->GetText();
}
else
{
tok1 = GetTextInLowerCase();
tok2 = token->GetTextInLowerCase();
}
if (segment->AreFragmentsCorrect())
{
int otherFrag = token->GetFragmentStatus();
if(fragment == NOT_FRAGMENT)
{
if(otherFrag == NOT_FRAGMENT)
{
return tok1 == tok2;
}
else if (otherFrag == BEGIN_FRAGMENT)
{
return (tok1.find(tok2, 0) == 0);
}
else
{
return (tok1.find(tok2, tok1.size()-tok2.size()) != string::npos);
}
}
else if (fragment == BEGIN_FRAGMENT)
{
if(otherFrag == NOT_FRAGMENT)
{
return (tok2.find(tok1, 0) == 0);
}
else if (otherFrag == BEGIN_FRAGMENT)
{
return ((tok1.find(tok2, 0) != string::npos) || (tok2.find(tok1, 0) != string::npos));
}
else
{
return false;
}
}
else
{ // fragment == END_FRAGMENT
if(otherFrag == NOT_FRAGMENT)
{
return (tok2.find(tok1, tok2.size()-tok1.size()) != string::npos);
}
else if (otherFrag == BEGIN_FRAGMENT)
{
return false;
}
else
{
uint s1 = tok1.size();
uint s2 = tok2.size();
return (tok1.find(tok2, s1 - s2) != string::npos) || (tok2.find(tok1, s2 - s1) != string::npos);
}
}
}
else
{
return tok1 == tok2;
}
}