本文整理汇总了C++中TextEditor类的典型用法代码示例。如果您正苦于以下问题:C++ TextEditor类的具体用法?C++ TextEditor怎么用?C++ TextEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_QueryInterface
NS_IMETHODIMP
DeleteCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* aCommandRefCon, bool* aIsEnabled) {
if (NS_WARN_IF(!aIsEnabled)) {
return NS_ERROR_INVALID_ARG;
}
*aIsEnabled = false;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
if (!editor) {
return NS_OK;
}
TextEditor* textEditor = editor->AsTextEditor();
MOZ_ASSERT(textEditor);
// We can generally delete whenever the selection is editable. However,
// cmd_delete doesn't make sense if the selection is collapsed because it's
// directionless, which is the same condition under which we can't cut.
*aIsEnabled = textEditor->IsSelectionEditable();
if (!nsCRT::strcmp("cmd_delete", aCommandName) && *aIsEnabled) {
nsresult rv = textEditor->CanDelete(aIsEnabled);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
return NS_OK;
}
示例2: textEditorEscapeKeyPressed
//------------------------------------------------------------------------------
void PreferencesDialog::textEditorEscapeKeyPressed(TextEditor &editor)
{
if(editor.getName() == "oscPortEditor")
editor.setText(currentPort, false);
else if(editor.getName() == "oscMulticastEditor")
editor.setText(currentMulticast, false);
}
示例3: toLower
string CreatureEditor::edit(vector<string> args)
{
if(args.size() < 2)
{
return "What do you want to edit?";
}
string editNoun = args[1];
toLower(&editNoun);
if(editNoun == STR_NAME)
{
return set(args);
}
else if(editNoun == STR_DESCRIPTION || editNoun == STR_DESC)
{
TextEditor ed;
creature->description = ed.edit("Editing Description For Creature:"+creature->getPrimaryName(),creature->description);
clearWindows();
resetWindows();
return "";
}
else
{
return "I don't know how to edit that";
}
}
示例4: QSplitter
EditorTab::EditorTab(WebFile* file, QWidget* parent)
: QSplitter(parent)
{
m_options = OptionStore::getInstance();
m_listmodel =new QStringListModel;
m_documentList = new QList<QTextDocument*>;
TextEditor* textedit = new TextEditor(this);//qobject_cast<TextEditor*>(m_editor->widget());
if(file)
connect(textedit,SIGNAL(textChanged()),file,SLOT(hasBeenModified()));
p = new PhpHighLighter(textedit->document());
connect(m_options,SIGNAL(fontChanged(QFont)),textedit,SLOT(setCurrentFont(QFont)));
textedit->setCurrentFont(m_options->font());
m_leftcolumn = new QSplitter(Qt::Vertical,this);
ProjectFilesBrowser* tmpBrowser=new ProjectFilesBrowser();
m_view = new FancyWidget(tmpBrowser);
m_leftcolumn->addWidget(m_view->widget());
addWidget(m_leftcolumn);
setStretchFactor(0,1);
addEditor(textedit);
setStretchFactor(1,3);
}
示例5: Window
MenuWindow::MenuWindow(AmobaApplication &app, int x, int y) : Window (x, y), _app(app) {
StaticText *text = new StaticText(170, 50, 100,30, "Amöba");
widgets.push_back(text);
ClickButton *kilepesGomb = new ClickButton([&]() { kilepesClicked(); }, 40, 320, 100, 35);
widgets.push_back(kilepesGomb);
StaticText *exit = new StaticText(70, 330, 40, 20, "EXIT");
widgets.push_back(exit);
ClickButton *jatekGomb = new ClickButton([&]() { jatekClicked(); }, 260, 320, 100, 35);
widgets.push_back(jatekGomb);
StaticText *kek = new StaticText(40, 180, 100, 35, "Kék játékos:");
widgets.push_back(kek);
TextEditor *ed = new TextEditor(40, 200, 100, 35, _app.players[0]);
ed->addValueChangeListener([&](ValueChangedEvent event) { textEditorChanged(event); });
widgets.push_back(ed);
StaticText *play = new StaticText(290, 330, 40, 20, "PLAY");
widgets.push_back(play);
StaticText *piros = new StaticText(260, 180, 100, 35, "Piros játékos:");
widgets.push_back(piros);
TextEditor *ed2 = new TextEditor(260, 200, 100, 35, _app.players[1]);
ed2->addValueChangeListener([&](ValueChangedEvent event) { textEditorChanged2(event); });
widgets.push_back(ed2);
}
示例6: mapToParent
void IDLabel::showExtended(const QPoint &p) {//, bool alreadyAdjusted, RegisterLabel *v) {
/* QPoint p2 = p;
if (!alreadyAdjusted)
p2 = mapToParent(p);
if (v == NULL)
v = this;*/
/* if (m_parent->m_extended->m_orig == this || m_parent->m_extended->m_orig == v) {
m_parent->m_extended->move(p2);
return;
}*/
QString alias = getRegisterText(m_register, true);
QString regName = ((m_register >= 32) ?
QString("<b>%1</b>").arg(alias) :
QString("<b>r%1</b> (%2)").arg(QString::number(m_register), alias));
QString mText = QString(
"<span style=\"font-size: 12;\">%1</span>"
"<pre>").arg(regName);
if (m_value == 0)
mText += QString("Value = 0");
else {
QString one = getNoInBase(m_value, 16),
// two = getNoInBase(m_value, 2),
three = getNoInBase(m_value, -10),
four = getNoInBase(m_value, 10);
mText += QString(
"Hex: %1<br>"
// "Binary: %2<br>"
"Decimal: %2")
.arg(one, /*two, */three);
if (three != four)
mText += QString("<br>UDecimal: %1").arg(four);
}
// Display the line which is responsible for setting
// the value currently in this register.
TextEditor *active = NULL;
if (m_lastModified != NULL && m_lastModified->isValid() && m_lastModified->getTextBlock() != NULL && (active = m_parent->m_parent->m_gui->getActiveProgram()) != NULL) {
mText += QString("<br>"
"(Set by line <i>%1</i>)").arg(1 + active->lineNumber(*m_lastModified->getTextBlock()));
}
mText += QString("</pre>");
/*
QString("");
("Last modifed by<br>line: <b>%1</b>").arg(QString("N/A"));*/
//"<ul style=\"list-style: none;\">"
/*"<li "STYLE_LEFT">Hex</li><li "STYLE_RIGHT">%2</li>"
"<li "STYLE_LEFT">Binary</li><li "STYLE_RIGHT">%3</li>"
"<li "STYLE_LEFT">Decimal</li><li "STYLE_RIGHT">%4</li>"
"<li "STYLE_LEFT">Unsigned</li><li "STYLE_RIGHT">%5</li>"*/
//"</ul>"
m_parent->showExtended(p, mText, this);
}
示例7: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
SelectAllCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* aCommandRefCon,
bool* aIsEnabled) {
NS_ENSURE_ARG_POINTER(aIsEnabled);
nsresult rv = NS_OK;
// You can always select all, unless the selection is editable,
// and the editable region is empty!
*aIsEnabled = true;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
if (!editor) {
return NS_OK;
}
// You can select all if there is an editor which is non-empty
TextEditor* textEditor = editor->AsTextEditor();
MOZ_ASSERT(textEditor);
bool isEmpty = false;
rv = textEditor->IsEmpty(&isEmpty);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
*aIsEnabled = !isEmpty;
return NS_OK;
}
示例8: TextEditor
void AddFilmWindow::ShowEditor( CutLabel* editDataIn, const QString& title )
{
TextEditor* editor = new TextEditor( this );
editor->SetDataSource( editDataIn );
editor->SetDataReceiver( editDataIn );
editor->SetTitle( title );
editor->show();
}
示例9: fillTextEditorBackground
void ProjucerLookAndFeel::fillTextEditorBackground (Graphics& g, int width, int height, TextEditor& textEditor)
{
g.setColour (textEditor.findColour (TextEditor::backgroundColourId));
g.fillRect (0, 0, width, height);
g.setColour (textEditor.findColour (TextEditor::outlineColourId));
g.drawHorizontalLine (height - 1, 0.0f, static_cast<float> (width));
}
示例10: editHtml
QString editHtml(const QString& s, const QString& title)
{
TextEditor editor;
editor.setWindowTitle(title);
editor.setHtml(s);
editor.exec();
return editor.toHtml();
}
示例11: drawTextEditorOutline
//==============================================================================
void OldSchoolLookAndFeel::drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor)
{
if (textEditor.isEnabled())
{
g.setColour (textEditor.findColour (TextEditor::outlineColourId));
g.drawRect (0, 0, width, height);
}
}
示例12: editPlainText
QString editPlainText(const QString& s, const QString& title)
{
TextEditor editor;
editor.setWindowTitle(title);
editor.setPlainText(s);
editor.exec();
return editor.toPlainText();
}
示例13: textEditorReturnKeyPressed
void HadronLabel::textEditorReturnKeyPressed(TextEditor& editor)
{
if (use_modal_editor_) {
setText(editor.getText(), true);
editor.exitModalState(0);
}
else {
Label::textEditorReturnKeyPressed(editor);
}
}
示例14: do_QueryInterface
NS_IMETHODIMP
InsertLineBreakCommand::DoCommand(const char* aCommandName,
nsISupports* aCommandRefCon)
{
nsCOMPtr<nsIPlaintextEditor> editor = do_QueryInterface(aCommandRefCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_NOT_IMPLEMENTED;
}
TextEditor* textEditor = static_cast<TextEditor*>(editor.get());
return textEditor->TypedText(EmptyString(), TextEditor::eTypedBR);
}
示例15: mouseUp
void DragLabel::mouseUp(const MouseEvent& e)
{
// By showing the editor here (instead of letting the base class do it
// for us) we can get a pointer to the editor and make sure that users
// can't enter anything except 1..5 digits.
this->showEditor();
TextEditor* ed = this->getCurrentTextEditor();
if (ed)
{
ed->setInputRestrictions(5, "0123456789");
}
Label::mouseUp(e);
}