void
TBarView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
{
	if (fDragRegion->IsDragging()) {
		fDragRegion->MouseMoved(where, transit, dragMessage);
		return;
	}

	if (transit == B_ENTERED_VIEW && EventMask() == 0)
		SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);

	desk_settings* settings = ((TBarApp*)be_app)->Settings();
	bool alwaysOnTop = settings->alwaysOnTop;
	bool autoRaise = settings->autoRaise;
	bool autoHide = settings->autoHide;

	if (!autoRaise && !autoHide) {
		if (transit == B_EXITED_VIEW || transit == B_OUTSIDE_VIEW)
			SetEventMask(0);
		return;
	}

	bool isTopMost = Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL;

	// Auto-Raise
	where = ConvertToScreen(where);
	BRect screenFrame = (BScreen(Window())).Frame();
	if ((where.x == screenFrame.left || where.x == screenFrame.right
			|| where.y == screenFrame.top || where.y == screenFrame.bottom)
		&& Window()->Frame().Contains(where)) {
		// cursor is on a screen edge within the window frame

		if (!alwaysOnTop && autoRaise && !isTopMost)
			RaiseDeskbar(true);

		if (autoHide && IsHidden())
			HideDeskbar(false);

	} else {
		TBarWindow* window = (TBarWindow*)Window();
		if (window->IsShowingMenu())
			return;

		// cursor is not on screen edge
		BRect preventHideArea = Window()->Frame().InsetByCopy(
			-kMaxPreventHidingDist, -kMaxPreventHidingDist);

		if (preventHideArea.Contains(where))
			return;

		// cursor to bar distance above threshold
		if (!alwaysOnTop && autoRaise && isTopMost) {
			RaiseDeskbar(false);
			SetEventMask(0);
		}

		if (autoHide && !IsHidden())
			HideDeskbar(true);
	}
}
示例#2
0
bool
TExpandoMenuBar::InBeMenu(BPoint loc) const
{
	if (!fVertical) {
		if (fBeMenuItem && fBeMenuItem->Frame().Contains(loc))
			return true;
	} else {
		TBarWindow *window = dynamic_cast<TBarWindow*>(Window());
		if (window) {
			TBeMenu *bemenu = window->BeMenu();
			if (bemenu && bemenu->Frame().Contains(loc))
				return true;
		}					
	}
	
	return false;
}
示例#3
0
bool
TExpandoMenuBar::InDeskbarMenu(BPoint loc) const
{
	TBarWindow* window = dynamic_cast<TBarWindow*>(Window());
	if (window != NULL) {
		if (TDeskbarMenu* bemenu = window->DeskbarMenu()) {
			bool inDeskbarMenu = false;
			if (bemenu->LockLooper()) {
				inDeskbarMenu = bemenu->Frame().Contains(loc);
				bemenu->UnlockLooper();
			}
			return inDeskbarMenu;
		}
	}

	return false;
}
示例#4
0
bool
TExpandoMenuBar::InBeMenu(BPoint loc) const
{
	if (!fVertical) {
		if (fBeMenuItem && fBeMenuItem->Frame().Contains(loc))
			return true;
	} else {
		TBarWindow* window = dynamic_cast<TBarWindow*>(Window());
		if (window) {
			if (TBeMenu* bemenu = window->BeMenu()) {
				bool inBeMenu = false;
				if (bemenu->LockLooper()) {
					inBeMenu = bemenu->Frame().Contains(loc);
					bemenu->UnlockLooper();
				}
				return inBeMenu;
			}
		}
	}

	return false;
}