本文整理汇总了C++中TextLine::text方法的典型用法代码示例。如果您正苦于以下问题:C++ TextLine::text方法的具体用法?C++ TextLine::text怎么用?C++ TextLine::text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextLine
的用法示例。
在下文中一共展示了TextLine::text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPosition
void TextCursor::setPosition(const KTextEditor::Cursor& position, bool init)
{
// any change or init? else do nothing
if (!init && position.line() == line() && position.column() == m_column)
return;
// remove cursor from old block in any case
if (m_block)
m_block->removeCursor (this);
// first: validate the line and column, else invalid
if (position.column() < 0 || position.line () < 0 || position.line () >= m_buffer.lines ()) {
if (!m_range)
m_buffer.m_invalidCursors.insert (this);
m_block = 0;
m_line = m_column = -1;
return;
}
// else, find block
TextBlock *block = m_buffer.blockForIndex (m_buffer.blockForLine (position.line()));
Q_ASSERT(block);
// get line
TextLine textLine = block->line (position.line());
#if 0 // this is no good idea, smart cursors don't do that, too, for non-wrapping cursors
// now, validate column, else stay invalid
if (position.column() > textLine->text().size()) {
if (!m_range)
m_buffer.m_invalidCursors.insert (this);
m_block = 0;
m_line = m_column = -1;
return;
}
#endif
// if cursor was invalid before, remove it from invalid cursor list
if (!m_range && !m_block && !init) {
Q_ASSERT(m_buffer.m_invalidCursors.contains (this));
m_buffer.m_invalidCursors.remove (this);
}
// else: valid cursor
m_block = block;
m_line = position.line () - m_block->startLine ();
m_column = position.column ();
m_block->insertCursor (this);
}
示例2: promptWindow
/****************************************************************************
* WindowPrompt
*
* Displays a prompt window to user, with information, an error message, or
* presenting a user with a choice
***************************************************************************/
void
revtext(const char *msg)
{
bool stop = false;
GuiWindow promptWindow(520,360);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiImageData btnOutline(Theme.button_small);
GuiImageData btnOutlineOver(Theme.button_small_focus);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiImageData dialogBox(Theme.dialog_background);
GuiImage dialogBoxImg(&dialogBox);
TextLine revtext;
revtext.text(msg, 18, 400);
int i = 0;
int y = 90;
int place = 25;
int number = 7;
GuiText upTxt("c", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
upTxt.SetFont(symbol_ttf, symbol_ttf_size);
upTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
upTxt.SetPosition(0, y -20);
GuiText downTxt("d", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
downTxt.SetFont(symbol_ttf, symbol_ttf_size);
downTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
downTxt.SetPosition(0, y + (place * (number-1)) + 15);
GuiText * Entrie[number];
for(i=0; i < number && i < (signed)revtext.line.size(); i++)
{
Entrie[i] = new GuiText(revtext.line[i].c_str(), 20, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
Entrie[i]->SetPosition(50, y);
y += place;
}
GuiText titleTxt(tr("Info"), 26, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,40);
GuiText backTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage backImg(&btnOutline);
GuiImage backImgOver(&btnOutlineOver);
GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
back.SetPosition(0, -25);
back.SetLabel(&backTxt);
back.SetImage(&backImg);
back.SetImageOver(&backImgOver);
back.SetTrigger(&trigA);
back.SetState(STATE_SELECTED);
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt);
for(int x=0; x < i; x++)
promptWindow.Append(Entrie[x]);
if((signed)revtext.line.size() >= number)
{
promptWindow.Append(&upTxt);
promptWindow.Append(&downTxt);
}
promptWindow.Append(&back);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
ResumeGui();
while(!stop)
{
usleep(100);
if(WPAD_ButtonsDown(0) & (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP) || PAD_ButtonsDown(0) & PAD_BUTTON_UP)
{
int z = revtext.text_up();
for(int x=0; x < i; x++)
Entrie[x]->SetText(revtext.line[x + z].c_str());
//.........这里部分代码省略.........
示例3: in
/****************************************************************************
* MetaEdit
*
* meta bearbeiten
***************************************************************************/
bool
MetaEdit(string dir)
{
int choice = -1;
bool changed = false;
dir += "meta.xml";
string line, quelltext;
ifstream in(dir.c_str());
while(getline(in, line))
quelltext += line + "\n";
GuiWindow promptWindow(520,360);
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
promptWindow.SetPosition(0, -10);
GuiImageData btnOutline(Theme.button_small);
GuiImageData btnOutlineOver(Theme.button_small_focus);
GuiTrigger trigA;
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiImageData dialogBox(Theme.dialog_background);
GuiImage dialogBoxImg(&dialogBox);
TextLine meta;
meta.text(quelltext, 18, 440);
int i = 0;
int y = 90;
int place = 25;
int number = 7;
int startline = 0;
GuiText upTxt("c", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
upTxt.SetFont(symbol_ttf, symbol_ttf_size);
upTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
upTxt.SetPosition(0, y -20);
GuiText downTxt("d", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
downTxt.SetFont(symbol_ttf, symbol_ttf_size);
downTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
downTxt.SetPosition(0, y + (place * (number-1)) + 15);
GuiButton * Entrie[number];
GuiText * EntrieTxt[number];
for(i=0; i < number && i < (signed)meta.line.size(); i++)
{
EntrieTxt[i] = new GuiText(meta.line[i].c_str(), 18, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
EntrieTxt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
Entrie[i] = new GuiButton(440, 18);
Entrie[i]->SetLabel(EntrieTxt[i]);
Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
Entrie[i]->SetPosition(40, y);
Entrie[i]->SetTrigger(&trigA);
y += place;
}
GuiText titleTxt("meta.xml", 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
titleTxt.SetPosition(0,40);
GuiText backTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
GuiImage backImg(&btnOutline);
GuiImage backImgOver(&btnOutlineOver);
GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
back.SetPosition(0, -25);
back.SetLabel(&backTxt);
back.SetImage(&backImg);
back.SetImageOver(&backImgOver);
back.SetTrigger(&trigA);
back.SetState(STATE_SELECTED);
promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt);
for(int x=0; x < i; x++)
promptWindow.Append(Entrie[x]);
if((signed)meta.line.size() >= number)
{
promptWindow.Append(&upTxt);
promptWindow.Append(&downTxt);
}
promptWindow.Append(&back);
HaltGui();
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&promptWindow);
mainWindow->ChangeFocus(&promptWindow);
//.........这里部分代码省略.........