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


C++ BPoseView::CommitActivePose方法代码示例

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


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

示例1: if

static filter_result
key_down_filter(BMessage* message, BHandler** handler, BMessageFilter* filter)
{
	ASSERT(filter != NULL);
	if (filter == NULL)
		return B_DISPATCH_MESSAGE;

	TFilePanel* panel = dynamic_cast<TFilePanel*>(filter->Looper());
	ASSERT(panel != NULL);

	if (panel == NULL)
		return B_DISPATCH_MESSAGE;

	BPoseView* view = panel->PoseView();
	if (panel->TrackingMenu())
		return B_DISPATCH_MESSAGE;

	uchar key;
	if (message->FindInt8("byte", (int8*)&key) != B_OK)
		return B_DISPATCH_MESSAGE;

	int32 modifier = 0;
	message->FindInt32("modifiers", &modifier);
	if (!modifier && key == B_ESCAPE) {
		if (view->ActivePose())
			view->CommitActivePose(false);
		else if (view->IsFiltering())
			filter->Looper()->PostMessage(B_CANCEL, *handler);
		else
			filter->Looper()->PostMessage(kCancelButton);

		return B_SKIP_MESSAGE;
	}

	if (key == B_RETURN && view->ActivePose()) {
		view->CommitActivePose();

		return B_SKIP_MESSAGE;
	}

	return B_DISPATCH_MESSAGE;
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例2:

static filter_result
TextViewFilter(BMessage* message, BHandler**, BMessageFilter* filter)
{
	uchar key;
	if (message->FindInt8("byte", (int8*)&key) != B_OK)
		return B_DISPATCH_MESSAGE;

	ThrowOnAssert(filter != NULL);

	BContainerWindow* window = dynamic_cast<BContainerWindow*>(
		filter->Looper());
	ThrowOnAssert(window != NULL);

	BPoseView* poseView = window->PoseView();
	ThrowOnAssert(poseView != NULL);

	if (key == B_RETURN || key == B_ESCAPE) {
		poseView->CommitActivePose(key == B_RETURN);
		return B_SKIP_MESSAGE;
	}

	if (key == B_TAB) {
		if (poseView->ActivePose()) {
			if (message->FindInt32("modifiers") & B_SHIFT_KEY)
				poseView->ActivePose()->EditPreviousWidget(poseView);
			else
				poseView->ActivePose()->EditNextWidget(poseView);
		}

		return B_SKIP_MESSAGE;
	}

	// the BTextView doesn't respect window borders when resizing itself;
	// we try to work-around this "bug" here.

	// find the text editing view
	BView* scrollView = poseView->FindView("BorderView");
	if (scrollView != NULL) {
		BTextView* textView = dynamic_cast<BTextView*>(
			scrollView->FindView("WidgetTextView"));
		if (textView != NULL) {
			BRect rect = scrollView->Frame();

			if (rect.right + 3 > poseView->Bounds().right
				|| rect.left - 3 < 0)
				textView->MakeResizable(true, NULL);
		}
	}

	return B_DISPATCH_MESSAGE;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:51,代码来源:TextWidget.cpp


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