本文整理汇总了C++中BTextView::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ BTextView::Delete方法的具体用法?C++ BTextView::Delete怎么用?C++ BTextView::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTextView
的用法示例。
在下文中一共展示了BTextView::Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int32_t
PTextViewDelete(void *pobject, void *in, void *out, void *extraData)
{
if (!pobject || !in || !out)
return B_ERROR;
PView *parent = static_cast<PView*>(pobject);
if (!parent)
return B_BAD_TYPE;
BTextView *backend = (BTextView*)parent->GetView();
PArgs *inArgs = static_cast<PArgs*>(in);
int32 start;
if (inArgs->FindInt32("start", &start) != B_OK)
return B_ERROR;
int32 end;
if (inArgs->FindInt32("end", &end) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
backend->Delete(start, end);
if (backend->Window())
backend->Window()->Unlock();
return B_OK;
}
示例2: if
void
PersonView::SetAttribute(const char* attribute, const char* value,
bool update)
{
if (!LockLooper())
return;
AttributeTextControl* control = NULL;
for (int32 i = fControls.CountItems() - 1; i >= 0; i--) {
if (fControls.ItemAt(i)->Attribute() == attribute) {
control = fControls.ItemAt(i);
break;
}
}
if (control == NULL)
return;
if (update) {
control->SetText(value);
control->Update();
} else {
BTextView* text = control->TextView();
int32 start, end;
text->GetSelection(&start, &end);
if (start != end) {
text->Delete();
text->Insert(value);
} else if ((end = text->TextLength())) {
text->Select(end, end);
text->Insert(",");
text->Insert(value);
text->Select(text->TextLength(), text->TextLength());
} else
control->SetText(value);
}
UnlockLooper();
}
示例3: strcmp
//.........这里部分代码省略.........
break;
case P_SIZE:
old_size = (int32) fNewFont->Size();
msg->FindInt32("size", &new_size);
if (old_size != new_size) {
fNewFont->SetSize(new_size);
message.what = M_FONT;
be_app->PostMessage(&message);
}
break;
case P_WRAP:
msg->FindBool("wrap", fNewWrap);
break;
case P_ATTACH_ATTRIBUTES:
msg->FindBool("attachAttributes", fNewAttachAttributes);
break;
case P_COLORED_QUOTES:
msg->FindBool("cquotes", fNewColoredQuotes);
break;
case P_ACCOUNT:
msg->FindInt32("id",(int32*)fNewAccount);
break;
case P_REPLYTO:
msg->FindInt32("replyTo", fNewReplyTo);
break;
case P_REPLY_PREAMBLE:
{
int32 index = -1;
if (msg->FindInt32("index", &index) < B_OK)
break;
BMenuItem *item = fReplyPreambleMenu->ItemAt(index);
if (item == NULL) {
msg->PrintToStream();
break;
}
BTextView *text = fReplyPreamble->TextView();
int32 selectionStart;
int32 selectionEnd;
text->GetSelection(&selectionStart, &selectionEnd);
if (selectionStart != selectionEnd)
text->Delete(selectionStart, selectionEnd);
text->Insert(item->Label(), 2);
}
case P_SIG:
free(*fNewSignature);
if (msg->FindString("signature", &signature) == B_NO_ERROR) {
*fNewSignature = (char*)malloc(strlen(signature) + 1);
strcpy(*fNewSignature, signature);
} else {
*fNewSignature = (char*)malloc(
strlen(B_TRANSLATE("None")) + 1);
strcpy(*fNewSignature, B_TRANSLATE("None"));
}
break;
case P_ENC:
msg->FindInt32("encoding", (int32*)fNewEncoding);
break;
case P_WARN_UNENCODABLE:
msg->FindBool("warnUnencodable", fNewWarnUnencodable);
break;
case P_SPELL_CHECK_START_ON:
msg->FindBool("spellCheckStartOn", fNewSpellCheckStartOn);
break;
case P_MARK_READ:
msg->FindBool("autoMarkRead", fNewAutoMarkRead);
be_app->PostMessage(PREFS_CHANGED);
break;
case P_BUTTON_BAR:
msg->FindInt8("bar", (int8*)fNewButtonBar);
be_app->PostMessage(PREFS_CHANGED);
break;
default:
BWindow::MessageReceived(msg);
}
fFont.GetFamilyAndStyle(&old_family, &old_style);
fNewFont->GetFamilyAndStyle(&new_family, &new_style);
old_size = (int32) fFont.Size();
new_size = (int32) fNewFont->Size();
bool changed = old_size != new_size
|| fWrap != *fNewWrap
|| fAttachAttributes != *fNewAttachAttributes
|| fColoredQuotes != *fNewColoredQuotes
|| fAccount != *fNewAccount
|| fReplyTo != *fNewReplyTo
|| strcmp(old_family, new_family)
|| strcmp(old_style, new_style)
|| strcmp(fReplyPreamble->Text(), *fNewPreamble)
|| strcmp(fSignature, *fNewSignature)
|| fEncoding != *fNewEncoding
|| fWarnUnencodable != *fNewWarnUnencodable
|| fSpellCheckStartOn != *fNewSpellCheckStartOn
|| fAutoMarkRead != *fNewAutoMarkRead
|| fButtonBar != *fNewButtonBar;
fRevert->SetEnabled(changed);
}