本文整理汇总了C++中BRegion::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ BRegion::Contains方法的具体用法?C++ BRegion::Contains怎么用?C++ BRegion::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRegion
的用法示例。
在下文中一共展示了BRegion::Contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
BView *BubbleHelper::FindView(BPoint where)
{
BView *winview=NULL;
BWindow *win;
long windex=0;
while((winview==NULL)&&((win=be_app->WindowAt(windex++))!=NULL))
{
if(win!=textwin)
{
// lock with timeout, in case somebody has a non-running window around
// in their app.
if(win->LockWithTimeout(1E6)==B_OK)
{
BRect frame=win->Frame();
if(frame.Contains(where))
{
BPoint winpoint;
winpoint=where-frame.LeftTop();
winview=win->FindView(winpoint);
if(winview)
{
BRegion region;
BPoint newpoint=where;
winview->ConvertFromScreen(&newpoint);
winview->GetClippingRegion(®ion);
if(!region.Contains(newpoint))
winview=0;
}
}
win->Unlock();
}
}
}
return winview;
}
示例2: menu
void
MouseView::MouseDown(BPoint where)
{
BMessage *mouseMsg = Window()->CurrentMessage();
fButtons = mouseMsg->FindInt32("buttons");
int32 modifiers = mouseMsg->FindInt32("modifiers");
if (modifiers & B_CONTROL_KEY) {
if (modifiers & B_COMMAND_KEY)
fButtons = B_TERTIARY_MOUSE_BUTTON;
else
fButtons = B_SECONDARY_MOUSE_BUTTON;
}
// Get the current clipping region before requesting any updates.
// Otherwise those parts would be excluded from the region.
BRegion clipping;
GetClippingRegion(&clipping);
if (fOldButtons != fButtons) {
Invalidate(_ButtonsRect());
fOldButtons = fButtons;
}
const int32* offset = getButtonOffsets(fType);
int32 button = -1;
for (int32 i = 0; i <= fType; i++) {
if (_ButtonRect(offset, i).Contains(where)) {
button = i;
break;
}
}
if (button < 0)
return;
// We are setup to receive all mouse events, even if our window
// is not active, so make sure that we don't display the menu when
// the user clicked inside our view, but another window is on top.
if (clipping.Contains(where)) {
button = _ConvertFromVisualOrder(button);
BPopUpMenu menu("Mouse Map Menu");
BMessage message(kMsgMouseMap);
message.AddInt32("button", button);
menu.AddItem(new BMenuItem("1", new BMessage(message)));
menu.AddItem(new BMenuItem("2", new BMessage(message)));
menu.AddItem(new BMenuItem("3", new BMessage(message)));
menu.ItemAt(getMappingNumber(fSettings.Mapping(button)))
->SetMarked(true);
menu.SetTargetForItems(Window());
ConvertToScreen(&where);
menu.Go(where, true);
}
}
示例3: Window
void
PadView::MouseDown(BPoint where)
{
BWindow* window = Window();
if (window == NULL)
return;
BRegion region;
GetClippingRegion(®ion);
if (!region.Contains(where))
return;
bool handle = true;
for (int32 i = 0; BView* child = ChildAt(i); i++) {
if (child->Frame().Contains(where)) {
handle = false;
break;
}
}
if (!handle)
return;
BMessage* message = window->CurrentMessage();
if (message == NULL)
return;
uint32 buttons;
message->FindInt32("buttons", (int32*)&buttons);
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
BRect r = Bounds();
r.InsetBy(2.0, 2.0);
r.top += 6.0;
if (r.Contains(where)) {
DisplayMenu(where);
} else {
// sends the window to the back
window->Activate(false);
}
} else {
if (system_time() - fClickTime < sActivationDelay) {
window->Minimize(true);
fClickTime = 0;
} else {
window->Activate();
fDragOffset = ConvertToScreen(where) - window->Frame().LeftTop();
fDragging = true;
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
fClickTime = system_time();
}
}
}
示例4: pointer
HyperTextAction*
HyperTextView::_ActionAt(const BPoint& where) const
{
int32 offset = OffsetAt(where);
ActionInfo pointer(offset, offset + 1, NULL);
const ActionInfo* action = fActionInfos->BinarySearch(pointer,
ActionInfo::CompareEqualIfIntersecting);
if (action != NULL) {
// verify that the text region was hit
BRegion textRegion;
GetTextRegion(action->startOffset, action->endOffset, &textRegion);
if (textRegion.Contains(where))
return action->action;
}
return NULL;
}
示例5: MessageReceived
//.........这里部分代码省略.........
{
HandleDroppedMessage( message, point );
}
}
return;
}
switch ( message->what )
{
case kPanelWindowViewTimer:
{
if ( DoIconSmallerWithTime() == 0 )
{
fTimer->SetInterval( 999999999 );
}
break;
}
case T_MENU_CLOSED:
{
DebugCall( 8, "Got T_MENU_CLOSED" );
TAwarePopupMenu *source;
if ( message->FindPointer( "source", (void**)&source ) == B_OK )
{
if ( source == fOpenMenu )
{
DebugCall( 9, "fOpenMenu is now 0" );
fOpenMenu = 0;
BPoint point;
uint32 buttons;
GetMouse( &point, &buttons );
if ( !Bounds().Contains( point ) )
Window()->PostMessage(B_EXITED_VIEW);
}
}
break;
}
case B_SOME_APP_LAUNCHED:
{
team_id tid;
if ( message->FindInt32( "be:team", &tid ) != B_OK )
break;
const char *sig;
if ( message->FindString( "be:signature", &sig ) != B_OK )
break;
entry_ref ref;
if ( message->FindRef( "be:ref", &ref ) != B_OK )
break;
int32 flags;
if ( message->FindInt32( "be:flags", &flags ) != B_OK )
break;
if ( sig && strlen(sig) && ( ( flags & B_BACKGROUND_APP ) == 0 ) )
AddTeam( tid, sig, ref );
break;
}
case B_SOME_APP_QUIT:
{
team_id tid;
if ( message->FindInt32( "be:team", &tid ) != B_OK )
break;
RemoveTeam( tid );