本文整理汇总了C++中ImageView::getMagScale方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageView::getMagScale方法的具体用法?C++ ImageView::getMagScale怎么用?C++ ImageView::getMagScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageView
的用法示例。
在下文中一共展示了ImageView::getMagScale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bounds
filter_result
MouseDownFilter(BMessage* message, BHandler** handlers, BMessageFilter* filter)
{
BWindow* window = dynamic_cast<BWindow*> (filter->Looper());
if (window == NULL)
return B_DISPATCH_MESSAGE;
MagStringView* magStringView = dynamic_cast<MagStringView*> (handlers[0]);
if (magStringView == NULL)
return B_DISPATCH_MESSAGE;
BPoint point;
message->FindPoint("be:view_where", &point);
BRect bounds(magStringView->Bounds());
if (!bounds.Contains(point))
return B_DISPATCH_MESSAGE;
ImageView* imageView = dynamic_cast<ImageView*>(window->FindView("image_view"));
if (imageView == NULL)
return B_DISPATCH_MESSAGE;
magStringView->SetEventMask(B_POINTER_EVENTS);
gPopUpSlider = PopUpSlider::Instantiate(BMessenger(imageView, window),
new BMessage(HS_SET_MAGNIFYING_SCALE), 10, 1600);
// Convert nonlinear from [0.1,16] -> [10,1600]
float value = 1590.0 * log10((9.0 * (imageView->getMagScale() - 0.1) / 15.9)
+ 1.0) + 10.0;
BSlider* slider = gPopUpSlider->Slider();
slider->SetValue(int32(value));
slider->SetModificationMessage(new BMessage(HS_SET_MAGNIFYING_SCALE));
BRect rect(slider->BarFrame());
float offset = (slider->Position() * (rect.Width() - 1.0)) + 8.0;
rect = gPopUpSlider->Bounds();
bounds = magStringView->ConvertToScreen(bounds);
message->FindPoint("screen_where", &point);
gPopUpSlider->MoveTo(point.x - offset, bounds.top - rect.Height());
gPopUpSlider->Go();
return B_SKIP_MESSAGE;
}