本文整理汇总了C++中webcore::Frame::eventHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ Frame::eventHandler方法的具体用法?C++ Frame::eventHandler怎么用?C++ Frame::eventHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Frame
的用法示例。
在下文中一共展示了Frame::eventHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseEvents
void wxWebView::OnMouseEvents(wxMouseEvent& event)
{
event.Skip();
if (!m_mainFrame)
return;
WebCore::Frame* frame = m_mainFrame->GetFrame();
if (!frame || !frame->view())
return;
wxPoint globalPoint = ClientToScreen(event.GetPosition());
wxEventType type = event.GetEventType();
if (type == wxEVT_MOUSEWHEEL) {
WebCore::PlatformWheelEvent wkEvent(event, globalPoint);
frame->eventHandler()->handleWheelEvent(wkEvent);
return;
}
WebCore::PlatformMouseEvent wkEvent(event, globalPoint);
if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN ||
type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK)
frame->eventHandler()->handleMousePressEvent(wkEvent);
else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP)
frame->eventHandler()->handleMouseReleaseEvent(wkEvent);
else if (type == wxEVT_MOTION)
frame->eventHandler()->mouseMoved(wkEvent);
}
示例2: OnMouseEvents
void wxWebView::OnMouseEvents(wxMouseEvent& event)
{
event.Skip();
if (!m_impl->page)
return;
WebCore::Frame* frame = m_mainFrame->GetFrame();
if (!frame || !frame->view())
return;
wxPoint globalPoint = ClientToScreen(event.GetPosition());
wxEventType type = event.GetEventType();
if (type == wxEVT_MOUSEWHEEL) {
if (m_mouseWheelZooms && event.ControlDown() && !event.AltDown() && !event.ShiftDown()) {
if (event.GetWheelRotation() < 0)
DecreaseTextSize();
else if (event.GetWheelRotation() > 0)
IncreaseTextSize();
} else {
WebCore::PlatformWheelEvent wkEvent(event, globalPoint);
frame->eventHandler()->handleWheelEvent(wkEvent);
}
return;
}
int clickCount = event.ButtonDClick() ? 2 : 1;
if (clickCount == 1 && m_impl->tripleClickTimer.IsRunning()) {
wxPoint diff(event.GetPosition() - m_impl->tripleClickPos);
if (abs(diff.x) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_X) &&
abs(diff.y) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_Y)) {
clickCount = 3;
}
} else if (clickCount == 2) {
m_impl->tripleClickTimer.Start(getDoubleClickTime(), false);
m_impl->tripleClickPos = event.GetPosition();
}
WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount);
if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN ||
type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) {
frame->eventHandler()->handleMousePressEvent(wkEvent);
if (!HasCapture())
CaptureMouse();
} else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) {
frame->eventHandler()->handleMouseReleaseEvent(wkEvent);
while (HasCapture())
ReleaseMouse();
} else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW)
frame->eventHandler()->mouseMoved(wkEvent);
}
示例3: handleKeyEvent
void BWebPage::handleKeyEvent(BMessage* message)
{
WebCore::Frame* frame = fPage->focusController()->focusedOrMainFrame();
if (!frame->view() || !frame->document())
return;
PlatformKeyboardEvent event(message);
// Try to let WebCore handle this event
if (!frame->eventHandler()->keyEvent(event) && message->what == B_KEY_DOWN) {
// Handle keyboard scrolling (probably should be extracted to a method.)
ScrollDirection direction;
ScrollGranularity granularity;
BString bytes = message->FindString("bytes");
switch (bytes.ByteAt(0)) {
case B_UP_ARROW:
granularity = ScrollByLine;
direction = ScrollUp;
break;
case B_DOWN_ARROW:
granularity = ScrollByLine;
direction = ScrollDown;
break;
case B_LEFT_ARROW:
granularity = ScrollByLine;
direction = ScrollLeft;
break;
case B_RIGHT_ARROW:
granularity = ScrollByLine;
direction = ScrollRight;
break;
case B_HOME:
granularity = ScrollByDocument;
direction = ScrollUp;
break;
case B_END:
granularity = ScrollByDocument;
direction = ScrollDown;
break;
case B_PAGE_UP:
granularity = ScrollByPage;
direction = ScrollUp;
break;
case B_PAGE_DOWN:
granularity = ScrollByPage;
direction = ScrollDown;
break;
default:
return;
}
frame->eventHandler()->scrollRecursively(direction, granularity);
}
}
示例4: handleMouseEvent
void BWebPage::handleMouseEvent(const BMessage* message)
{
WebCore::Frame* frame = fMainFrame->Frame();
if (!frame->view() || !frame->document())
return;
PlatformMouseEvent event(message);
switch (message->what) {
case B_MOUSE_DOWN:
// Handle context menus, if necessary.
if (event.button() == RightButton) {
fPage->contextMenuController()->clearContextMenu();
WebCore::Frame* focusedFrame = fPage->focusController()->focusedOrMainFrame();
focusedFrame->eventHandler()->sendContextMenuEvent(event);
// If the web page implements it's own context menu handling, then
// the contextMenu() pointer will be zero. In this case, we should
// also swallow the event.
ContextMenu* contextMenu = fPage->contextMenuController()->contextMenu();
if (contextMenu) {
BMenu* platformMenu = contextMenu->releasePlatformDescription();
if (platformMenu) {
// Need to convert the BMenu into BPopUpMenu.
BPopUpMenu* popupMenu = new BPopUpMenu("context menu");
for (int32 i = platformMenu->CountItems() - 1; i >= 0; i--) {
BMenuItem* item = platformMenu->RemoveItem(i);
popupMenu->AddItem(item, 0);
}
BPoint screenLocation(event.globalPosition().x() + 2,
event.globalPosition().y() + 2);
popupMenu->Go(screenLocation, true, true, true);
delete platformMenu;
}
}
break;
}
// Handle regular mouse events.
frame->eventHandler()->handleMousePressEvent(event);
break;
case B_MOUSE_UP:
frame->eventHandler()->handleMouseReleaseEvent(event);
break;
case B_MOUSE_MOVED:
default:
frame->eventHandler()->mouseMoved(event);
break;
}
}
示例5: webkit_web_view_motion_event
static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion* event)
{
//WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
WebCore::Frame* frame = core(webView_s->mainFrame());
return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event));
}
示例6: OnContextMenuEvents
void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event)
{
m_impl->page->contextMenuController()->clearContextMenu();
wxPoint localEventPoint = ScreenToClient(event.GetPosition());
if (!m_mainFrame)
return;
WebCore::Frame* focusedFrame = m_mainFrame->GetFrame();
if (!focusedFrame->view())
return;
//Create WebCore mouse event from the wxContextMenuEvent
wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN);
mouseEvent.m_x = localEventPoint.x;
mouseEvent.m_y = localEventPoint.y;
WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition());
bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent);
if (!handledEvent)
return;
WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu();
if (!coreMenu)
return;
WebCore::PlatformMenuDescription menuWx = coreMenu->platformDescription();
if (!menuWx)
return;
PopupMenu(menuWx, localEventPoint);
}
示例7: OnContextMenuEvents
void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event)
{
Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this);
m_impl->page->contextMenuController()->clearContextMenu();
wxPoint localEventPoint = ScreenToClient(event.GetPosition());
if (!m_impl->page)
return;
WebCore::Frame* focusedFrame = m_impl->page->focusController()->focusedOrMainFrame();
if (!focusedFrame->view())
return;
//Create WebCore mouse event from the wxContextMenuEvent
wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN);
mouseEvent.m_x = localEventPoint.x;
mouseEvent.m_y = localEventPoint.y;
WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition(), 1);
bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent);
if (!handledEvent)
return;
WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu();
if (!coreMenu)
return;
WebCore::PlatformMenuDescription menuWx = coreMenu->platformDescription();
if (!menuWx)
return;
PopupMenu(menuWx, localEventPoint);
Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this);
}
示例8: webkit_web_view_scroll_event
static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event)
{
//WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
WebCore::Frame* frame = core(webView_s->mainFrame());
PlatformWheelEvent wheelEvent(event);
return frame->eventHandler()->handleWheelEvent(wheelEvent);
}
示例9: handleMouseWheelChanged
void BWebPage::handleMouseWheelChanged(BMessage* message)
{
WebCore::Frame* frame = fMainFrame->Frame();
if (!frame->view() || !frame->document())
return;
PlatformWheelEvent event(message);
frame->eventHandler()->handleWheelEvent(event);
}
示例10: OnSize
void wxWebView::OnSize(wxSizeEvent& event)
{
if (m_isInitialized && m_mainFrame) {
WebCore::Frame* frame = m_mainFrame->GetFrame();
frame->eventHandler()->sendResizeEvent();
frame->view()->layout();
frame->view()->adjustScrollbars();
}
event.Skip();
}
示例11: OnKeyEvents
void wxWebView::OnKeyEvents(wxKeyEvent& event)
{
WebCore::Frame* frame = 0;
if (m_mainFrame)
frame = m_mainFrame->GetFrame();
if (frame && frame->view()) {
// WebCore doesn't handle these events itself, so we need to do
// it and not send the event down or else CTRL+C will erase the text
// and replace it with c.
if (event.CmdDown() && event.GetEventType() == wxEVT_KEY_UP) {
if (event.GetKeyCode() == static_cast<int>('C'))
Copy();
else if (event.GetKeyCode() == static_cast<int>('X'))
Cut();
else if (event.GetKeyCode() == static_cast<int>('V'))
Paste();
else if (event.GetKeyCode() == static_cast<int>('Z')) {
if (event.ShiftDown()) {
if (m_mainFrame->CanRedo())
m_mainFrame->Redo();
}
else {
if (m_mainFrame->CanUndo())
m_mainFrame->Undo();
}
}
} else {
WebCore::PlatformKeyboardEvent wkEvent(event);
if (wkEvent.type() == WebCore::PlatformKeyboardEvent::Char && wkEvent.altKey())
frame->eventHandler()->handleAccessKey(wkEvent);
else
frame->eventHandler()->keyEvent(wkEvent);
}
}
// make sure we get the character event.
if (event.GetEventType() != wxEVT_CHAR)
event.Skip();
}
示例12: webkit_web_view_key_release_event
static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey* event)
{
//WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
WebCore::Frame* frame = core(webView_s)->focusController()->focusedOrMainFrame();
PlatformKeyboardEvent keyboardEvent(event);
if (frame->eventHandler()->keyEvent(keyboardEvent))
return TRUE;
/* Chain up to our parent class for binding activation */
return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_release_event(widget, event);
}
示例13: webkit_web_view_button_press_event
static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event)
{
//WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
WebCore::Frame* frame = core(webView_s->mainFrame());
// FIXME: need to keep track of subframe focus for key events
gtk_widget_grab_focus(widget);
if (event->button == 3)
return false;//webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event));
return frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event));
}
示例14: webkit_web_view_button_release_event
static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEventButton* event)
{
//WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
////WebKitWebViewPrivate* priv = webView->priv;
WebCore::Frame* focusedFrame = core(webView_s)->focusController()->focusedFrame();
if (focusedFrame && focusedFrame->editor()->canEdit()) {
GdkWindow* window = gtk_widget_get_parent_window(widget);
gtk_im_context_set_client_window(imContext, window);
#ifdef MAEMO_CHANGES
hildon_gtk_im_context_filter_event(imContext, (GdkEvent*)event);
hildon_gtk_im_context_show(imContext);
#endif
}
return focusedFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
}
示例15: OnMouseEvents
void wxWebView::OnMouseEvents(wxMouseEvent& event)
{
event.Skip();
if (!m_impl->page)
return;
WebCore::Frame* frame = m_mainFrame->GetFrame();
if (!frame || !frame->view())
return;
wxPoint globalPoint = ClientToScreen(event.GetPosition());
wxEventType type = event.GetEventType();
if (type == wxEVT_MOUSEWHEEL) {
if (m_mouseWheelZooms && event.ControlDown() && !event.AltDown() && !event.ShiftDown()) {
if (event.GetWheelRotation() < 0)
DecreaseTextSize();
else if (event.GetWheelRotation() > 0)
IncreaseTextSize();
} else {
WebCore::PlatformWheelEvent wkEvent(event, globalPoint);
frame->eventHandler()->handleWheelEvent(wkEvent);
}
return;
}
// If an event, such as a right-click event, leads to a focus change (e.g. it
// raises a dialog), WebKit never gets the mouse up event and never relinquishes
// mouse capture. This leads to WebKit handling mouse events, such as modifying
// the selection, while other controls or top level windows have the focus.
// I'm not sure if this is the right place to handle this, but I can't seem to
// find a precedent on how to handle this in other ports.
if (wxWindow::FindFocus() != this) {
while (HasCapture())
ReleaseMouse();
frame->eventHandler()->setMousePressed(false);
return;
}
int clickCount = event.ButtonDClick() ? 2 : 1;
if (clickCount == 1 && m_impl->tripleClickTimer.IsRunning()) {
wxPoint diff(event.GetPosition() - m_impl->tripleClickPos);
if (abs(diff.x) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_X) &&
abs(diff.y) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_Y)) {
clickCount = 3;
}
} else if (clickCount == 2) {
m_impl->tripleClickTimer.Start(getDoubleClickTime(), false);
m_impl->tripleClickPos = event.GetPosition();
}
WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount);
if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN ||
type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) {
frame->eventHandler()->handleMousePressEvent(wkEvent);
if (!HasCapture())
CaptureMouse();
} else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) {
frame->eventHandler()->handleMouseReleaseEvent(wkEvent);
while (HasCapture())
ReleaseMouse();
} else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW)
frame->eventHandler()->mouseMoved(wkEvent);
}