当前位置: 首页>>代码示例>>C++>>正文


C++ View::MouseTrackingPause方法代码示例

本文整理汇总了C++中View::MouseTrackingPause方法的典型用法代码示例。如果您正苦于以下问题:C++ View::MouseTrackingPause方法的具体用法?C++ View::MouseTrackingPause怎么用?C++ View::MouseTrackingPause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在View的用法示例。


在下文中一共展示了View::MouseTrackingPause方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FindSelection

void DisplayDirector::FindSelection()
{
//***	be_app->HideCursor();
	View* view = WindowView();
	BPoint point;
	BPoint lastPoint(-1000000, -1000000);
	bool scrolling = false;
	for (;; lastPoint = point) {
		// get & check mouse state
		int buttons = view->GetMouseButtons();
		if (buttons == 0)
			break;
		point = view->GetMousePoint();
		bool autoscrolling = Autoscroll(point);
		if (point == lastPoint && !autoscrolling && !scrolling) {
			view->MouseTrackingPause();
			continue;
			}

		// move the selection
		StartRefreshCycle();
		BPoint docPoint = ViewToDoc(point);
		FindSelectionContext context(docPoint.x, docPoint.y);
		Selection* newSelection = docDisplayNode->BlockFindSelection(&context);
		SetSelection(newSelection);
		scrolling = DoScrollStep();
		FinishRefreshCycle();
		ClearDeletedSelections();
		}
//***	be_app->ShowCursor();	//*** didn't work
}
开发者ID:HaikuArchives,项目名称:EnglishEditorII,代码行数:31,代码来源:DisplayDirector.cpp

示例2: ExtendSelection

void DisplayDirector::ExtendSelection()
{
	if (selection == NULL)
		return;

	View* view = WindowView();
	BPoint lastPoint;
	Selection* rootSelection = selection;
	bool scrolling = false;
	while (true) {
		// get the mouse point and check if moved/finished
		int buttons = view->GetMouseButtons();
		if (buttons == 0)
			break;
		BPoint point = view->GetMousePoint();
		Autoscroll(point);
		point = ViewToDoc(point);
		if (point == lastPoint && !scrolling) {
			view->MouseTrackingPause();
			continue;
			}

		// change the selection
		Selection* newSelection = rootSelection->ExtendTo(point);
		if (newSelection != selection) {
			StartRefreshCycle();
			RefreshSelection();

			if (selection != rootSelection)
				delete selection;
			selection = newSelection;

			scrolling = DoScrollStep();

			RefreshSelection();
			FinishRefreshCycle();
			}

		lastPoint = point;
		}

	// clean up root selection
	if (selection != rootSelection)
		delete rootSelection;
}
开发者ID:HaikuArchives,项目名称:EnglishEditorII,代码行数:45,代码来源:DisplayDirector.cpp

示例3: DragSelection

void DisplayDirector::DragSelection(BPoint startPoint)
{
	if (selection == NULL)
		return;

	View* view = WindowView();
	BPoint lastPoint = ViewToDoc(startPoint);
	bool scrolling = false;
	bool wasRightButton = false;
	bool optionDown = false;
	while (true) {
		// get the mouse point and check if moved/finished
		BPoint point = view->GetMousePoint();
		int buttons = view->GetMouseButtons();
		if (buttons == 0)
			break;
		wasRightButton = ((buttons & (B_SECONDARY_MOUSE_BUTTON | B_TERTIARY_MOUSE_BUTTON)) != 0);
		optionDown = ((view->CurModifiers() & B_OPTION_KEY) != 0);
		scrolling |= Autoscroll(point);
		point = ViewToDoc(point);
		if (point == lastPoint && !scrolling) {
			view->MouseTrackingPause();
			continue;
			}

		// change the destination
		Destination* newDestination = NULL;
		if (!selection->ContainsPoint(point)) {
			FindDestinationContext destContext(selection, point.x, point.y);
			newDestination = docDisplayNode->BlockFindDestination(&destContext);
			}
		if (newDestination != destination) {
			StartRefreshCycle();

			SetDestination(newDestination);

			scrolling = DoScrollStep();

			FinishRefreshCycle();
			}
		else
			scrolling = DoScrollStep();

		lastPoint = point;
		}

	// do the move/copy
	if (destination) {
		// figure out if it's a move or a copy
		bool doing = true;
		bool copying = false;
/***
		if (wasRightButton) {
			BPopUpMenu* menu = new BPopUpMenu("Move/Copy");
			BMenuItem* moveItem = new BMenuItem("Move", NULL);
			menu->AddItem(moveItem);
			BMenuItem* copyItem = new BMenuItem("Copy", NULL);
			menu->AddItem(copyItem);
			BMenuItem* chosenItem = menu->Go(ConvertToScreen(DocToView(lastPoint)), false, true);
			copying = (chosenItem == copyItem);
			if (chosenItem == NULL)
				doing = false;
			delete menu;
			}
		else if (optionDown)
			copying = true;
***/
		if (optionDown)
			copying = true;

		if (doing) {
			StartRefreshCycle();

			// do the move or copy
			Action* moveAction = NULL;
			if (copying)
				moveAction = destination->GetCopyAction();
			else
				moveAction = destination->GetMoveAction();
			if (moveAction)
				DoAction(moveAction);

			SetDestination(NULL);

			FinishRefreshCycle();
			}
		else
			SetDestination(NULL);
		}
}
开发者ID:HaikuArchives,项目名称:EnglishEditorII,代码行数:90,代码来源:DisplayDirector.cpp


注:本文中的View::MouseTrackingPause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。