本文整理汇总了C++中PointerEvent类的典型用法代码示例。如果您正苦于以下问题:C++ PointerEvent类的具体用法?C++ PointerEvent怎么用?C++ PointerEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PointerEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::shared_ptr<View> WindowView_Impl::get_capture_view(PointerEvent &e, std::shared_ptr<View> &view_above_cursor)
{
if (e.type() == PointerEventType::press || e.type() == PointerEventType::double_click)
{
capture_down_counter++;
if (capture_down_counter == 1)
{
captured_view = view_above_cursor;
if (captured_view)
window.capture_mouse(true);
}
}
std::shared_ptr<View> view = captured_view;
if (e.type() == PointerEventType::release)
{
if (capture_down_counter > 0)
{
capture_down_counter--;
if (capture_down_counter == 0)
{
if (captured_view)
release_capture();
}
}
}
return view;
}
示例2: createAndCheckTouchCancel
PointerEvent* PointerEventFactoryTest::createAndCheckTouchCancel(
WebPointerProperties::PointerType pointerType, int rawId,
int uniqueId, bool isPrimary)
{
PointerEvent* pointerEvent = m_pointerEventFactory.createPointerCancelEvent(
uniqueId, pointerType);
EXPECT_EQ(uniqueId, pointerEvent->pointerId());
EXPECT_EQ(isPrimary, pointerEvent->isPrimary());
return pointerEvent;
}
示例3: createAndCheckMouseEvent
PointerEvent* PointerEventFactoryTest::createAndCheckMouseEvent(
WebPointerProperties::PointerType pointerType,
int rawId, int uniqueId, bool isPrimary,
PlatformEvent::Modifiers modifiers)
{
PointerEvent* pointerEvent = m_pointerEventFactory.create(
EventTypeNames::mousedown, PlatformMouseEventBuilder(pointerType, rawId, modifiers), nullptr, nullptr);
EXPECT_EQ(uniqueId, pointerEvent->pointerId());
EXPECT_EQ(isPrimary, pointerEvent->isPrimary());
return pointerEvent;
}
示例4: createPointerTransitionEvent
void PointerEventFactoryTest::createAndCheckPointerTransitionEvent(
PointerEvent* pointerEvent,
const AtomicString& type)
{
PointerEvent* clonePointerEvent = m_pointerEventFactory.
createPointerTransitionEvent(pointerEvent, type, nullptr);
EXPECT_EQ(clonePointerEvent->pointerType(), pointerEvent->pointerType());
EXPECT_EQ(clonePointerEvent->pointerId(), pointerEvent->pointerId());
EXPECT_EQ(clonePointerEvent->isPrimary(), pointerEvent->isPrimary());
EXPECT_EQ(clonePointerEvent->type(), type);
}
示例5: FloatSize
PointerEvent* PointerEventFactoryTest::createAndCheckTouchEvent(
WebPointerProperties::PointerType pointerType,
int rawId, int uniqueId, bool isPrimary,
PlatformTouchPoint::TouchState state)
{
PointerEvent* pointerEvent = m_pointerEventFactory.create(
EventTypeNames::pointerdown, PointerEventFactoryTest::PlatformTouchPointBuilder(pointerType, rawId, state), PlatformEvent::NoModifiers, FloatSize(), FloatPoint());
EXPECT_EQ(uniqueId, pointerEvent->pointerId());
EXPECT_EQ(isPrimary, pointerEvent->isPrimary());
return pointerEvent;
}
示例6: get_capture_view
void WindowView_Impl::window_pointer_event(PointerEvent &e)
{
std::shared_ptr<View> view_above_cursor = window_view->find_view_at(e.pos(window_view));
auto view = get_capture_view(e, view_above_cursor);
if (!view)
view = view_above_cursor;
dispatch_hot_event(view, e);
if (e.type() == PointerEventType::enter || e.type() == PointerEventType::leave) // Ignore window enter/leave events
return;
if (view)
view->dispatch_event(&e);
else
window_view->dispatch_event(&e);
}
示例7: onPointerPressed
void ScriptEditorInput::onPointerPressed(const PointerEvent& ev)
{
MonoObject* screenPos = ScriptVector2I::box(ev.screenPos);
MonoObject* delta = ScriptVector2I::box(ev.delta);
MonoUtil::invokeThunk(OnPointerPressedThunk, screenPos, delta,
ev.button, ev.shift, ev.control, ev.alt, ev.mouseWheelScrollAmount, ev.isUsed());
}
示例8: on_pointer_release
void ListBoxViewImpl::on_pointer_release(PointerEvent &e)
{
if (e.phase() != EventUIPhase::bubbling || e.button() != PointerButton::left)
return;
int index = get_selection_index(e);
// Only allow click when mouse released over component
if (index == selected_item)
{
if (func_selection_changed)
func_selection_changed();
}
else
{
listbox->set_selected_item(last_selected_item);
}
}
示例9: on_pointer_press
void ListBoxViewImpl::on_pointer_press(PointerEvent &e)
{
if (e.button() != PointerButton::left)
return;
last_selected_item = selected_item;
int index = get_selection_index(e);
listbox->set_selected_item(index);
}
示例10: on_pointer_thumb_press
void SliderViewImpl::on_pointer_thumb_press(PointerEvent &e)
{
if (_state_disabled)
return;
_state_pressed = true;
update_state();
mouse_down_mode = mouse_down_thumb_drag;
thumb_move_start_position = _position;
mouse_drag_start_pos = e.pos(track.get());
}
示例11: onPointerDoubleClick
void ScriptInput::onPointerDoubleClick(const PointerEvent& ev)
{
if (PlayInEditorManager::instance().getState() != PlayInEditorState::Playing)
return;
MonoObject* screenPos = ScriptVector2I::box(ev.screenPos);
MonoObject* delta = ScriptVector2I::box(ev.delta);
MonoUtil::invokeThunk(OnPointerDoubleClickThunk, screenPos, delta,
ev.button, ev.shift, ev.control, ev.alt, ev.mouseWheelScrollAmount, ev.isUsed());
}
示例12: get_selection_index
int ListBoxViewImpl::get_selection_index(PointerEvent &e)
{
int index = 0;
for (auto &view : listbox->content_view()->children())
{
if (view->geometry().border_box().contains(e.pos(listbox->content_view())))
return index;
index++;
}
return -1;
}
示例13: on_pointer_release
void ButtonViewImpl::on_pointer_release(PointerEvent &e)
{
_state_pressed = false;
if (_state_disabled)
return;
update_state();
if (_func_clicked)
{
if (button->geometry().border_box().contains(e.local_pos())) // Only allow click when mouse released over component
_func_clicked();
}
}
示例14: on_pointer_release
void CheckBoxView_Impl::on_pointer_release(PointerEvent &e)
{
_state_pressed = false;
if (_state_disabled)
return;
if (checkbox->geometry().border_box().contains(e.local_pos())) // Only allow click when mouse released over component
{
_checked_state = !_checked_state;
if (_func_state_changed)
_func_state_changed();
}
update_state();
}
示例15: e_exit
void WindowView_Impl::dispatch_hot_event(std::shared_ptr<View> &view, PointerEvent &e)
{
if (view != hot_view)
{
if (hot_view)
{
PointerEvent e_exit(PointerEventType::leave, PointerButton::none, e.pos(window_view->root_view()), e.alt_down(), e.shift_down(), e.ctrl_down(), e.cmd_down());
hot_view->dispatch_event(&e_exit, true);
}
hot_view = view;
if (hot_view)
{
PointerEvent e_enter(PointerEventType::enter, PointerButton::none, e.pos(window_view->root_view()), e.alt_down(), e.shift_down(), e.ctrl_down(), e.cmd_down());
hot_view->dispatch_event(&e_enter, true);
}
}
if (hot_view)
hot_view->update_cursor(window);
}