本文整理汇总了C++中BView::ConvertToScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::ConvertToScreen方法的具体用法?C++ BView::ConvertToScreen怎么用?C++ BView::ConvertToScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BView
的用法示例。
在下文中一共展示了BView::ConvertToScreen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: color_tear_drag
int32 color_tear_drag (void *data)
{
colorTearInfo *tearInfo = (colorTearInfo *) data;
uint32 buttons = 1;
BPoint point;
ColorMenu *menu = tearInfo->parent;
BRect place = tearInfo->dragRect;
BView *view = tearInfo->someView;
// It might seem a good idea to use `menu' as the view, but
// this gave errors: `Method requires owner but doesn't have one'.
delete tearInfo; // The caller doesn't do this (race condition otherwise)
// printf ("Entering loop; view = %p\n", view);
while (buttons)
{
view->Window()->Lock();
view->GetMouse (&point, &buttons);
view->Window()->Unlock();
snooze (50000);
}
// printf ("Exited loop\n");
view->Window()->Lock();
point = view->ConvertToScreen (point);
view->Window()->Unlock();
// printf ("Released at (%.0f, %.0f)\n", point.x, point.y);
place.OffsetTo (point);
menu->getParent()->lock->Lock();
menu->TearDone (place, !menu->getParent()->MenuWinOnScreen);
menu->getParent()->lock->Unlock();
return B_NO_ERROR;
}
示例2: BWindow
/*! Returns the current mouse position in screen coordinates.
Since there is no method to retrieve this in the Be API without a view,
this looks a bit more complicated.
*/
static BPoint
mouse_position()
{
BWindow* window = new BWindow(BRect(-1000, -1000, -900, -900), "mouse",
B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_AVOID_FRONT | B_AVOID_FOCUS);
BView* view = new BView(window->Bounds(), "mouse", B_FOLLOW_ALL, 0);
window->AddChild(view);
window->Run();
window->Lock();
BPoint position;
uint32 buttons;
view->GetMouse(&position, &buttons);
view->ConvertToScreen(&position);
window->Quit();
return position;
}
示例3: im_msg
//.........这里部分代码省略.........
open.AddRef("refs", &fEntry);
be_roster->Launch("application/x-vnd.BeClan.im_binlog_viewer", &open);
} break;
case VIEW_WEBPAGE: {
entry_ref htmlRef;
be_roster->FindApp("application/x-vnd.Be.URL.http", &htmlRef);
BPath htmlPath(&htmlRef);
BMessage argv(B_ARGV_RECEIVED);
argv.AddString("argv", htmlPath.Path());
int32 length = -1;
char *url = ReadAttribute(BNode(&fEntry), "META:url", &length);
if ((url != NULL) && (length > 1)) {
url = (char *)realloc(url, (length + 1) * sizeof(char));
url[length] = '\0';
argv.AddString("argv", url);
argv.AddInt32("argc", 2);
be_roster->Launch(&htmlRef, &argv);
} else {
LOG("im_emoclient", liMedium, "Contact had no homepage");
};
if (url) free(url);
} break;
case VIEW_EMOTICONS: {
//find emoticon button
BView* button = FindView("Emoticons");
BRect buttonBounds = button->Bounds();
//move emoticon window to just below the button
BPoint emotLeftBottom = button->ConvertToScreen(buttonBounds.LeftBottom());
popup->SetTargetForItems(this);
popup->Go(emotLeftBottom,true,true);
} break;
case ADD_EMOTICON:
{
int32 index=msg->FindInt32("index");
BString txt;
emoticor->config->menu.FindString("face",index,&txt);
txt << " ";
fInput->Insert(txt.String());
} break;
case EMAIL:
{
BMessage open_msg(B_REFS_RECEIVED);
open_msg.AddRef("refs", &fEntry);
// "application/x-vnd.Be-MAIL"
be_roster->Launch("text/x-email", &open_msg );
} break;
case BLOCK:
{
IM::Contact contact(fEntry);
char status[256];
if ( contact.GetStatus( status, sizeof(status) ) != B_OK )
status[0] = 0;
if ( strcmp(status, BLOCKED_TEXT) == 0 )