本文整理汇总了C++中BTextView::Window方法的典型用法代码示例。如果您正苦于以下问题:C++ BTextView::Window方法的具体用法?C++ BTextView::Window怎么用?C++ BTextView::Window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTextView
的用法示例。
在下文中一共展示了BTextView::Window方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int32_t
PTextViewLineAtOffset(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);
PArgs *outArgs = static_cast<PArgs*>(out);
int32 offset;
if (inArgs->FindInt32("offset", &offset) != B_OK)
return B_ERROR;
if (backend->Window())
backend->Window()->Lock();
int32 outValue1;
outValue1 = backend->LineAt(offset);
if (backend->Window())
backend->Window()->Unlock();
outArgs->MakeEmpty();
return B_OK;
}
示例2: rect
void BComboBox::ChoiceListView::MouseDown(BPoint where)
{
BRect rect(Window()->Frame());
ConvertFromScreen(&rect);
if (!rect.Contains(where))
{
// hide the popup window when the user clicks outside of it
if (fParent->Window()->Lock())
{
fParent->HidePopupWindow();
fParent->Window()->Unlock();
}
// HACK: the window is locked and unlocked so that it will get
// activated before we potentially send the mouse down event in the
// code below. Is there a way to wait until the window is activated
// before sending the mouse down? Should we call
// fParent->Window()->MakeActive(true) here?
if (fParent->Window()->Lock())
{
// resend the mouse event to the textinput, if necessary
BTextView *text = fParent->TextView();
BPoint screenWhere(ConvertToScreen(where));
rect = text->Window()->ConvertToScreen(text->Frame());
if (rect.Contains(screenWhere))
{
//printf(" resending mouse down to textinput\n");
BMessage *msg = new BMessage(*Window()->CurrentMessage());
msg->RemoveName("be:view_where");
text->ConvertFromScreen(&screenWhere);
msg->AddPoint("be:view_where", screenWhere);
text->Window()->PostMessage(msg, text);
delete msg;
}
fParent->Window()->Unlock();
}
return;
}
rect = Bounds();
if (!rect.Contains(where))
return;
fTrackingMouseDown = true;
// check for double click
bigtime_t now = system_time();
bigtime_t clickSpeed;
get_click_speed(&clickSpeed);
if ((now - fClickTime < clickSpeed)
&& ((abs((int)(fClickLoc.x - where.x)) < 3)
&& (abs((int)(fClickLoc.y - where.y)) < 3)))
{
// this is a double click
// XXX: what to do here?
printf("BComboBox::ChoiceListView::MouseDown() -- unhandled double click\n");
}
fClickTime = now;
fClickLoc = where;
float h = LineHeight();
int32 oldIndex = fSelIndex;
fSelIndex = (int32)floor(where.y / h);
int32 choices = fParent->fChoiceList->CountChoices();
if (fSelIndex < 0 || fSelIndex >= choices)
fSelIndex = -1;
if (oldIndex != fSelIndex)
{
InvalidateItem(oldIndex);
InvalidateItem(fSelIndex);
}
// XXX: this probably isn't necessary since we are doing a SetEventMask
// whenever the popup window becomes visible which routes all mouse events
// to this view
// SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
}
示例3: str
status_t
PTextView::SetProperty(const char *name, PValue *value, const int32 &index)
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
return B_READ_ONLY;
BTextView *backend = (BTextView*)fView;
BoolValue boolval;
CharValue charval;
ColorValue colorval;
FloatValue floatval;
IntValue intval;
PointValue pointval;
RectValue rectval;
StringValue stringval;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (backend->Window())
backend->Window()->Lock();
else if (str.ICompare("Selectable") == 0)
{
prop->GetValue(&boolval);
backend->MakeSelectable(*boolval.value);
}
else if (str.ICompare("CurrentLine") == 0)
{
prop->GetValue(&intval);
backend->GoToLine(*intval.value);
}
else if (str.ICompare("TabWidth") == 0)
{
prop->GetValue(&floatval);
backend->SetTabWidth(*floatval.value);
}
else if (str.ICompare("TextRect") == 0)
{
prop->GetValue(&rectval);
backend->SetTextRect(*rectval.value);
}
else if (str.ICompare("MaxBytes") == 0)
{
prop->GetValue(&intval);
backend->SetMaxBytes(*intval.value);
}
else if (str.ICompare("UseWordWrap") == 0)
{
prop->GetValue(&boolval);
backend->SetWordWrap(*boolval.value);
}
else if (str.ICompare("HideTyping") == 0)
{
prop->GetValue(&boolval);
backend->HideTyping(*boolval.value);
}
else if (str.ICompare("Editable") == 0)
{
prop->GetValue(&boolval);
backend->MakeEditable(*boolval.value);
}
else if (str.ICompare("ColorSpace") == 0)
{
prop->GetValue(&intval);
backend->SetColorSpace((color_space)*intval.value);
}
else if (str.ICompare("Text") == 0)
{
prop->GetValue(&stringval);
backend->SetText(*stringval.value);
}
else if (str.ICompare("Resizable") == 0)
{
prop->GetValue(&boolval);
backend->MakeResizable(*boolval.value);
}
else if (str.ICompare("Alignment") == 0)
{
prop->GetValue(&intval);
backend->SetAlignment((alignment)*intval.value);
}
else if (str.ICompare("Undoable") == 0)
{
prop->GetValue(&boolval);
backend->SetDoesUndo(*boolval.value);
}
else if (str.ICompare("AutoIndent") == 0)
{
prop->GetValue(&boolval);
//.........这里部分代码省略.........