这篇教程C++ wxGetMousePosition函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wxGetMousePosition函数的典型用法代码示例。如果您正苦于以下问题:C++ wxGetMousePosition函数的具体用法?C++ wxGetMousePosition怎么用?C++ wxGetMousePosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wxGetMousePosition函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ScreenToClientvoid wxJigsawEditorCanvas::OnIdle( wxIdleEvent& event ){ do { if(!HasCapture()) break; // get mouse in client coordinates wxPoint currentPos = ScreenToClient(wxGetMousePosition()); //Update the offset to the next mouse down event if(m_View->GetSelectedObject()) { wxPoint diagramPoint = PointToViewPoint(currentPos); wxPoint groupPosition = m_View->GetRealGroupPosition(m_View->GetSelectedObject()); m_SelectedObjectOffset = wxSize( diagramPoint.x - groupPosition.x, diagramPoint.y - groupPosition.y); } // get scroll position wxPoint scrollPos = GetScrollPosition(); // auto scroll // check current drag position and update scroll regularly if(AutoScroll(currentPos, scrollPos)) { event.RequestMore(); } FixViewOffset(); } while(false);}
开发者ID:cubemoon,项目名称:game-editor,代码行数:33,
示例2: GetScreenRectvoid tabButton::updateMouse(wxMouseEvent& event){ if (m_bSelected) return; wxRect panelRec = GetScreenRect(); panelRec.x += 2; panelRec.y += 2; panelRec.width -= 4; panelRec.height -= 4; wxPoint mousePoint = wxGetMousePosition(); bool t1 = panelRec.x <= mousePoint.x; bool t2 = panelRec.y <= mousePoint.y; bool t3 = (panelRec.x + panelRec.width ) >= mousePoint.x; bool t4 = (panelRec.y + panelRec.height) >= mousePoint.y; if (t1 && t2 && t3 && t4) { this->SetBackgroundColour( MOUSEOVER ); } else { this->SetBackgroundColour( NORMAL ); } this->Refresh();}
开发者ID:EasyCoding,项目名称:desura-app,代码行数:29,
示例3: wxMenu/**< context menu */void ImagePanel::OnContextMenu(wxContextMenuEvent& event){ if (m_stMP.iState != 0) return; wxMenu* pMenu = new wxMenu(); wxASSERT_MSG(pMenu != nullptr, _T("Create Popup Menu failed.")); wxMenuItem* pMenuItem = nullptr; // group 1 if (m_img.IsOk()) { pMenuItem = new wxMenuItem(pMenu, ID_CMENU_SAVE, _("&Save Image"), _("Save the Image")); pMenu->Append(pMenuItem); } // popup if (pMenuItem != nullptr) { wxPoint pt = event.GetPosition(); if (pt == wxDefaultPosition) { // position invalide, get the mouse position pt = wxGetMousePosition(); wxRect rc = GetScreenRect(); if (!rc.Contains(pt)) { // mouse is't in the panel, get the panel center pt.x = rc.x + rc.width/2; pt.y = rc.y + rc.height/2; } } pt = ScreenToClient(pt); PopupMenu(pMenu, pt); } delete pMenu;}
开发者ID:gxcast,项目名称:GEIM,代码行数:36,
示例4: wxFillOtherKeyEventFieldsstatic void wxFillOtherKeyEventFields(wxKeyEvent& event, wxWindowGTK *win, GdkEventKey *gdk_event){ int x = 0; int y = 0; GdkModifierType state; if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state); event.SetTimestamp( gdk_event->time ); event.SetId(win->GetId()); event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0; event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0; event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0; event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK) != 0;#if wxMAJOR_VERSION == 2 event.m_scanCode = gdk_event->keyval;#endif event.m_rawCode = (wxUint32) gdk_event->keyval; event.m_rawFlags = 0;#if wxUSE_UNICODE event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval);#endif wxGetMousePosition( &x, &y ); win->ScreenToClient( &x, &y ); event.m_x = x; event.m_y = y; event.SetEventObject( win );}
开发者ID:JamesWCCheng,项目名称:wxMEdit,代码行数:30,
示例5: wxGetMouseStatewxMouseState wxGetMouseState(){ wxMouseState ms; wxPoint pt = wxGetMousePosition(); ms.SetX(pt.x); ms.SetY(pt.y);#if TARGET_API_MAC_OSX UInt32 buttons = GetCurrentButtonState(); ms.SetLeftDown( (buttons & 0x01) != 0 ); ms.SetMiddleDown( (buttons & 0x04) != 0 ); ms.SetRightDown( (buttons & 0x02) != 0 );#else ms.SetLeftDown( Button() ); ms.SetMiddleDown( 0 ); ms.SetRightDown( 0 );#endif UInt32 modifiers = GetCurrentKeyModifiers(); ms.SetControlDown(modifiers & controlKey); ms.SetShiftDown(modifiers & shiftKey); ms.SetAltDown(modifiers & optionKey); ms.SetMetaDown(modifiers & cmdKey); return ms;}
开发者ID:hgwells,项目名称:tive,代码行数:27,
示例6: wxGetMousePositionvoid wxPopupTransientWindow::OnIdle(wxIdleEvent& event){ event.Skip(); if (IsShown() && m_child) { // Store the last mouse position to minimize the number of calls to // wxFindWindowAtPoint() which are quite expensive. static wxPoint s_posLast; const wxPoint pos = wxGetMousePosition(); if ( pos != s_posLast ) { s_posLast = pos; wxWindow* const winUnderMouse = wxFindWindowAtPoint(pos); // We release the mouse capture while the mouse is inside the popup // itself to allow using it normally with the controls inside it. if ( wxGetTopLevelParent(winUnderMouse) == this ) { if ( m_child->HasCapture() ) { m_child->ReleaseMouse(); } } else // And we reacquire it as soon as the mouse goes outside. { if ( !m_child->HasCapture() ) { m_child->CaptureMouse(); } } } }}
开发者ID:lanurmi,项目名称:wxWidgets,代码行数:35,
示例7: Paint virtual void Paint( wxDC &dc ) { wxCustomButton *dropBut = ((wxMenuButton*)GetParent())->GetDropDownButton(); // pretend that both buttons have focus (for flat style) if (dropBut) { wxPoint p = GetParent()->ScreenToClient(wxGetMousePosition()); if (GetRect().Contains(p) || dropBut->GetRect().Contains(p)) { m_focused = true; if (!dropBut->GetFocused()) dropBut->SetFocused(true); } else { m_focused = false; if (dropBut->GetFocused()) dropBut->SetFocused(false); } } wxCustomButton::Paint(dc); }
开发者ID:DowerChest,项目名称:codeblocks,代码行数:27,
示例8: Paint virtual void Paint( wxDC &dc ) { wxCustomButton *labelBut = ((wxMenuButton*)GetParent())->GetLabelButton(); // pretend that both buttons have focus (for flat style) if (labelBut) { wxPoint p = GetParent()->ScreenToClient(wxGetMousePosition()); if (GetRect().Inside(p) || labelBut->GetRect().Inside(p)) { m_focused = true; if (!labelBut->GetFocused()) labelBut->SetFocused(true); } else { m_focused = false; if (labelBut->GetFocused()) labelBut->SetFocused(false); } } wxCustomButton::Paint(dc); }
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:27,
示例9: GetScreenRectvoid StripMenuButton::updateMouse(){ wxRect panelRec = GetScreenRect(); panelRec.x += 2; panelRec.y += 2; panelRec.width -= 4; panelRec.height -= 4; wxPoint mousePoint = wxGetMousePosition(); bool t1 = panelRec.x <= mousePoint.x; bool t2 = panelRec.y <= mousePoint.y; bool t3 = (panelRec.x + panelRec.width ) >= mousePoint.x; bool t4 = (panelRec.y + panelRec.height) >= mousePoint.y; if (t1 && t2 && t3 && t4) { if (!m_bHovering) { SetForegroundColour( m_colHover ); m_bHovering = true; invalidatePaint(); this->Refresh(); } } else if (m_bHovering) { SetForegroundColour( m_colNormal ); m_bHovering = false; invalidatePaint(); this->Refresh(); }}
开发者ID:CSRedRat,项目名称:desura-app,代码行数:33,
示例10: switchvoid ActorSceneCanvas::OnMouseCaptureChanged(wxMouseCaptureChangedEvent& e){ if (e.GetEventObject() == this && e.GetCapturedWindow() != this) { switch (mDragButton) { case wxMOUSE_BTN_MIDDLE: { wxASSERT(m_pCameraManip); wxPoint pt = wxGetMousePosition(); pt = ScreenToClient(pt); m_pCameraManip->onEnd(pt.x, pt.y, true); m_pCameraManip = NULL; break; } case wxMOUSE_BTN_LEFT: { //wxASSERT(GetActiveAction()); //wxPoint pt = wxGetMousePosition(); //pt = ScreenToClient(pt); //GetActiveAction()->onEnd(pt.x, pt.y, true); m_pUpdateListener->disable(); } break; } mDragButton = wxMOUSE_BTN_NONE; }}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:30,
示例11: wxGetMousePositionvoid GraphicsWindowWX::grabFocusIfPointerInWindow(){ // focus this window, if the pointer is in the window wxPoint pos = wxGetMousePosition(); if( wxFindWindowAtPoint( pos ) == _canvas ) _canvas->SetFocus();}
开发者ID:yaroslav-tarasov,项目名称:backdropfx,代码行数:7,
|