void ItemEditorFrame::OnDrawPanelMouse( wxMouseEvent& event ) { static int oldX = 0; static int oldY = 0; int x = event.GetX(); int y = event.GetY(); if (x >= 32767) x -= 65536; if (y >= 32767) y -= 65536; if ( event.LeftDown() ) { oldX = x; oldY = y; } if ( event.Dragging() && event.LeftIsDown() ) { if ( event.ControlDown() ) { int dx = x - oldX; int dy = y - oldY; static CFly::AxisEnum const axis[3] = { CFly::CF_AXIS_X , CFly::CF_AXIS_Y , CFly::CF_AXIS_Z }; if ( mModelObj ) mModelObj->rotate( axis[ rotateAxis ] , 0.01 * ( abs(dx) > abs(dy) ? dx : dy ) , CFly::CFTO_LOCAL ); //m_objCtrl->roateObject( x,y ); m_ModifyButton->Enable(); } else if ( event.ShiftDown() ) { //m_objCtrl->moveObject( x, y , 0 ); m_ModifyButton->Enable(); } else { mCamCtrl.rotateByMouse( x - oldX , y - oldY ); } oldX = x; oldY = y; } if ( event.LeftUp() ) { //m_objCtrl->roateObject( x , y , false ); //m_objCtrl->moveObject( x , y , 0 , false ); } if ( event.Dragging() && event.RightIsDown() ) { //m_objCtrl->moveObject( x ,y , 1 , false ); } if ( event.RightUp() ) { //m_objCtrl->moveObject( x , y , false ); } event.Skip(); }
bool wxStdScrollBarInputHandler::HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar); if ( m_winCapture ) { if ( (m_htLast == wxHT_SCROLLBAR_THUMB) && event.Dragging() ) { // make the thumb follow the mouse by keeping the same offset // between the mouse position and the top/left of the thumb HandleThumbMove(scrollbar, event); return true; } // no other changes are possible while the mouse is captured return false; } bool isArrow = scrollbar->GetArrows().HandleMouseMove(event); if ( event.Dragging() ) { wxHitTest ht = scrollbar->HitTestBar(event.GetPosition()); if ( ht == m_htLast ) { // nothing changed return false; } #ifdef DEBUG_MOUSE wxLogDebug("Scrollbar::OnMouseMove: ht = %d", ht); #endif // DEBUG_MOUSE Highlight(scrollbar, false); m_htLast = ht; if ( !isArrow ) Highlight(scrollbar, true); //else: already done by wxScrollArrows::HandleMouseMove } else if ( event.Leaving() ) { if ( !isArrow ) Highlight(scrollbar, false); m_htLast = wxHT_NOWHERE; } else // event.Entering() { // we don't process this event return false; } // we did something return true; }
void CSelectMode::OnMouse( wxMouseEvent& event ) { bool event_used = false; if(LeftAndRightPressed(event, event_used)) { if(m_doing_a_main_loop){ ExitMainLoop(); } } if(event_used)return; if(event.LeftDown()) OnLeftDown(event); if(event.MiddleDown()) OnMiddleDown(event); bool dragging = event.Dragging() && (m_button_down || m_middle_button_down); bool moving = event.Moving() || (event.Dragging() && (!(m_button_down || m_middle_button_down))); bool left_up = false; if(event.LeftUp()) { if(m_button_down)left_up = true; m_button_down = false; } if(event.MiddleUp())m_middle_button_down = false; if(left_up) { OnLeftUp(event); } else if(event.RightUp()) { MarkedObjectOneOfEach marked_object; wxGetApp().FindMarkedObject(wxPoint(event.GetX(), event.GetY()), &marked_object); wxGetApp().DoDropDownMenu(wxGetApp().m_frame->m_graphics, wxPoint(event.GetX(), event.GetY()), &marked_object, false, event.ControlDown()); } else if(dragging) { OnDragging(event); } else if(moving) { OnMoving(event); } if(event.GetWheelRotation() != 0) { OnWheelRotation(event); } }
void moTimelineRuler::OnMouseEvent( wxMouseEvent & event ) { //wxMessageBox("moTimelineRuler::Mouse event"); if ( event.Entering() ) { //SHINE!!! } if (event.Button(wxMOUSE_BTN_RIGHT )) { SetValue( SlideValue( event.GetX() ) ); Refresh(); } if (event.Button(wxMOUSE_BTN_LEFT )) { SetPlayValue( GetSlideValueToPlayValue( SlideValue( event.GetX() ) ) ); moSetDuration( m_play_value ); moAbstract::MODebug2->Push( IntToStr(m_play_value) ); Refresh(); } if (event.Dragging()) { if (event.RightIsDown()) { if (m_bStartDragging==false) { m_bStartDragging = true; wxWindow::CaptureMouse(); } SetValue( SlideValue( event.GetX() ) ); Refresh(); } if (event.LeftIsDown()) { if (m_bStartDragging==false) { m_bStartDragging = true; wxWindow::CaptureMouse(); } SetPlayValue( GetSlideValueToPlayValue( SlideValue( event.GetX() ) ) ); moSetDuration( m_play_value ); Refresh(); } } if (!event.Dragging()) { if (m_bStartDragging==true) { m_bStartDragging = false; wxWindow::ReleaseMouse(); } } event.Skip(); }
void TrackPanel::OnMouseEvent(wxMouseEvent& event) { if (event.m_x < view->labelWidth) { // Group panel stuff if (event.ButtonDClick()) view->DClickLabel(event); else if (event.ButtonDown()) view->ClickLabel(event); else if (event.ButtonUp()) SetCursor(*mainCursor); } else { if (event.ButtonDown()) { CaptureMouse(); if (event.ControlDown()) SetCursor(*dragCursor); view->ClickTrack(event); } else if (event.Dragging()) view->DragTrack(event); else if (event.ButtonUp()) { ReleaseMouse(); SetCursor(*mainCursor); view->ButtonUpTrack(); } else if (event.Moving()) { view->TrackSetCursor(event); } } }
void MyToolbar::OnDrag(wxMouseEvent &event){ if ( event.LeftDClick()) { parent->Maximize( !(parent->IsMaximized()) ); } static int omx, omy; int mx, my; mx = event.GetX(); my = event.GetY(); if ( event.Dragging() ){ if (!(parent->IsMaximized())) { CaptureMouse(); wxPoint cur=parent->GetPosition(); int dx=mx-omx; int dy=my-omy; cur.x+=dx; cur.y+=dy; omx=mx-dx; omy=my-dy; parent->SetPosition( cur ); } } else { omx=mx; omy=my; ReleaseMouse(); } }
void PreviewLayoutLinesTool::MouseMoveEvent(double x, double y, wxMouseEvent & e) { // Try to find the nearest line to the mouse pointer. // ...Unless there are no lines. if (m_lines.empty()) { return; } if (!(helper->IsMouseOverPano())) { if (m_useNearestLine) { m_useNearestLine = false; helper->GetVisualizationStatePtr()->ForceRequireRedraw(); helper->GetVisualizationStatePtr()->Redraw(); } return; } if (e.Dragging() && !m_holdOnNear) { return; } // Check each line in turn. double minDistance = DBL_MAX; unsigned int nearestLineOld = m_nearestLine; for (unsigned int i = 0; i < m_lines.size(); i++) { if (m_lines[i].dud) continue; double lineDistance = m_lines[i].getDistance(helper->GetMousePanoPosition()); if (lineDistance < minDistance) { // found a new minimum. minDistance = lineDistance; m_nearestLine = i; } } // Work out if it is close enough to highlight it. bool oldUseNearestLine = m_useNearestLine; // The limit is 70 pixels from the line. // Coordinates are panorama pixels squared, so we'll need to scale it. double scale = helper->GetVisualizationStatePtr()->GetScale(); scale *= scale; m_useNearestLine = minDistance < 4900.0 / scale; if (oldUseNearestLine != m_useNearestLine || m_nearestLine != nearestLineOld) { LineDetails & line = m_lines[m_nearestLine]; // get notification of when the connected images are drawn so we can // draw them on top with a highlight. helper->NotifyMeBeforeDrawing(line.image1, this); helper->NotifyMeBeforeDrawing(line.image2, this); // Redraw with new indicators. Since the indicators aren't part of the // panorama, we have to persuade the viewstate that a redraw is required. helper->GetVisualizationStatePtr()->ForceRequireRedraw(); helper->GetVisualizationStatePtr()->Redraw(); } }
void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent ) { m_mousePosition.x = aEvent.GetX(); m_mousePosition.y = aEvent.GetY(); updateCursor(); bool isAutoPanning = false; if( m_autoPanEnabled ) isAutoPanning = handleAutoPanning( aEvent ); if( !isAutoPanning && aEvent.Dragging() ) { if( m_state == DRAG_PANNING ) { VECTOR2D d = m_dragStartPoint - m_mousePosition; VECTOR2D delta = m_view->ToWorld( d, false ); m_view->SetCenter( m_lookStartPoint + delta ); aEvent.StopPropagation(); } else { aEvent.Skip(); } } }
void InstanceCtrl::OnMouseMotion(wxMouseEvent& event) { // Only start DnD if the mouse is over the selected instance. VisualCoord coord; HitTest(event.GetPosition(), coord); InstanceVisual *instVisual = GetItem(coord); if (event.Dragging() && instVisual && m_instList->GetSelectedInstance() == instVisual->GetInstance()) { int flags = 0; if (event.ControlDown()) flags |= wxINST_CTRL_DOWN; if (event.ShiftDown()) flags |= wxINST_SHIFT_DOWN; if (event.AltDown()) flags |= wxINST_ALT_DOWN; InstanceCtrlEvent cmdEvent( wxEVT_COMMAND_INST_DRAG, GetId()); cmdEvent.SetEventObject(this); cmdEvent.SetFlags(flags); GetEventHandler()->ProcessEvent(cmdEvent); } else { event.Skip(); } }
void KeysScaleWidget::onMouse(wxMouseEvent& event) { if (event.LeftDown()) m_parent->setCurrPos(queryGridByPos(event.GetX())); else if (event.Dragging()) m_parent->setCurrPos(queryGridByPos(event.GetX())); }
void Display3D::OnMouseMove(wxMouseEvent& e) { if(e.Dragging() && e.RightIsDown()) { mXTranslate=mXTranslate+(e.GetX()-mMouseX); mYTranslate=mYTranslate-(e.GetY()-mMouseY); } else if(e.Dragging() && e.LeftIsDown()) { mXRotate=mXRotate+(e.GetX()-mMouseX); mYRotate=mYRotate+(e.GetY()-mMouseY); } else { } mMouseX=e.GetX(); mMouseY=e.GetY(); Refresh(); }
void SeqTrack::OnMotion(wxMouseEvent &e) { long z; long h; if (Selected && e.Dragging()) { z = ((e.m_y - m_click.y) / (h = (long) (TRACK_HEIGHT * SeqPanel->VertZoomFactor))); if (z < 0) if (GetPosition().y < 0) { SeqPanel->ScrollTrackList(-1); SeqPanel->ChangeSelectedTrackIndex(-1); } else SeqPanel->ChangeSelectedTrackIndex(z); else if (z > 0) if (GetPosition().y >= SeqPanel->TrackView->GetClientSize().y - h) { SeqPanel->ChangeSelectedTrackIndex(1); SeqPanel->ScrollTrackList(1); } else SeqPanel->ChangeSelectedTrackIndex(z); } }
void ExplainCanvas::OnMouseMotion(wxMouseEvent &ev) { ev.Skip(true); if (ev.Dragging()) return; wxClientDC dc(this); PrepareDC(dc); wxPoint logPos(ev.GetLogicalPosition(dc)); double x, y; x = (double) logPos.x; y = (double) logPos.y; // Find the nearest object int attachment = 0; ExplainShape *nearestObj = dynamic_cast<ExplainShape *>(FindShape(x, y, &attachment)); if (nearestObj) { ShowPopup(nearestObj); } }
void CODListBox::OnMouseEvent(wxMouseEvent& event) { if (event.Dragging()) { if (dragX == -1) { dragX = event.m_x; dragY = event.m_y; } // only start dragging, if we have moved the mouse some pixels if (abs(dragX - event.m_x) > 4 || abs(dragY - event.m_y) > 4) { wxMask *ptMask; bool fOk; ptMask = stdBitmap.GetMask(); fOk = stdBitmap.Ok(); wxCommandEvent eventODLDrag(wxEVT_ODLISTBOX_DRAG_EVENT); wxPostEvent( this, eventODLDrag); dragX = -1; dragY = -1; } } else { dragX = -1; dragY = -1; event.Skip(true); } }
// This implements a tiny doodling program! Drag the mouse using the left // button. void MyCanvas::OnEvent(wxMouseEvent& event) { wxClientDC dc(this); PrepareDC(dc); wxPoint pt(event.GetLogicalPosition(dc)); static long xpos = -1; static long ypos = -1; if (xpos > -1 && ypos > -1 && event.Dragging()) { dc.SetPen(*wxBLACK_PEN); dc.DrawLine(xpos, ypos, pt.x, pt.y); m_dirty = true; } else { event.Skip(); } xpos = pt.x; ypos = pt.y; }
void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent ) { bool isAutoPanning = false; VECTOR2D mousePos( aEvent.GetX(), aEvent.GetY() ); if( m_settings.m_autoPanEnabled && m_settings.m_autoPanSettingEnabled ) isAutoPanning = handleAutoPanning( aEvent ); if( !isAutoPanning && aEvent.Dragging() ) { if( m_state == DRAG_PANNING ) { VECTOR2D d = m_dragStartPoint - mousePos; VECTOR2D delta = m_view->ToWorld( d, false ); m_view->SetCenter( m_lookStartPoint + delta ); aEvent.StopPropagation(); } } if( m_updateCursor ) // do not update the cursor position if it was explicitly set m_cursorPos = m_view->ToWorld( mousePos ); else m_updateCursor = true; aEvent.Skip(); }
void CFCEditorGLWindow::OnMouse(wxMouseEvent& event) { if(event.ButtonDown(wxMOUSE_BTN_RIGHT)) { if (!HasCapture()) { CaptureMouse(); } HideCursor(); SetFocus();//Call this for catch the EVT_MOUSEWHEEL event, in left mouse button down event is not necessary to call this m_startPosition = event.GetPosition(); m_bRightDown = true; } else if(event.ButtonUp(wxMOUSE_BTN_RIGHT)) { if (!m_bLeftDown && HasCapture()) { ReleaseMouse(); } ShowCursor(); m_bRightDown = false; } else if(event.ButtonDown(wxMOUSE_BTN_LEFT)) { if (!HasCapture()) { CaptureMouse(); } HideCursor(); m_startPosition = event.GetPosition(); m_bLeftDown = true; } else if(event.ButtonUp(wxMOUSE_BTN_LEFT)) { if (!m_bRightDown && HasCapture()) { ReleaseMouse(); } ShowCursor(); m_bLeftDown = false; } else if(event.Dragging()) { if (m_bRightDown || m_bLeftDown) { wxPoint curPos = event.GetPosition(); wxPoint pnt = ClientToScreen(m_startPosition); SetCursorPos(pnt.x, pnt.y); if (m_bRightDown) { int nDeltaX = curPos.x - m_startPosition.x; int nDeltaY = curPos.y - m_startPosition.y; wxSize clientSize = GetClientSize(); m_pCamera->Yaw((float)nDeltaX / clientSize.x); m_pCamera->Pitch((float)nDeltaY / clientSize.y); } } } event.Skip(); }
bool GribRequestSetting::MouseEventHook( wxMouseEvent &event ) { if( m_ZoneSelMode == AUTO_SELECTION || m_ZoneSelMode == SAVED_SELECTION || m_ZoneSelMode == START_SELECTION ) return false; if( event.Moving()) return false; //maintain status bar and tracking dialog updated if( event.LeftDown() ) { m_parent.pParent->SetFocus(); m_ZoneSelMode = DRAW_SELECTION; //restart a new drawing m_parent.SetRequestBitmap( m_ZoneSelMode ); if( this->IsShown() ) this->Hide(); //eventually hide diaog in case of mode change m_RenderZoneOverlay = 0; //eventually hide previous drawing } if( event.LeftUp () && m_RenderZoneOverlay == 2 ) { m_ZoneSelMode = COMPLETE_SELECTION; //ask to complete selection m_parent.SetRequestBitmap( m_ZoneSelMode ); SetCoordinatesText(); m_MailImage->SetValue( WriteMail() ); m_RenderZoneOverlay = 1; } if( event.Dragging() ) { if( m_RenderZoneOverlay < 2 ) { m_StartPoint = event.GetPosition(); //starting selection point m_RenderZoneOverlay = 2; } m_IsMaxLong = m_StartPoint.x > event.GetPosition().x? true: false; //find if startpoint is max longitude GetCanvasLLPix( m_Vp, event.GetPosition(), &m_Lat, &m_Lon); //extend selection if( !m_tMouseEventTimer.IsRunning() ) m_tMouseEventTimer.Start( 20, wxTIMER_ONE_SHOT ); } return true; }
void Canvas::OnMouse(wxMouseEvent& evt) { // Capture on button-down, so we can respond even when the mouse // moves off the window if (!m_MouseCaptured && evt.ButtonDown()) { m_MouseCaptured = true; CaptureMouse(); } // Un-capture when all buttons are up else if (m_MouseCaptured && evt.ButtonUp() && ! (evt.ButtonIsDown(wxMOUSE_BTN_LEFT) || evt.ButtonIsDown(wxMOUSE_BTN_MIDDLE) || evt.ButtonIsDown(wxMOUSE_BTN_RIGHT)) ) { m_MouseCaptured = false; ReleaseMouse(); } // Set focus when clicking if (evt.ButtonDown()) SetFocus(); // Reject motion events if the mouse has not actually moved if (evt.Moving() || evt.Dragging()) { if (m_LastMousePos == evt.GetPosition()) return; m_LastMousePos = evt.GetPosition(); } HandleMouseEvent(evt); }
void view::OnMouseMove(wxMouseEvent & event) { if ( m_aircraft_selected && event.Dragging()){ quan::gx::wxwidgets::graphics_info_context ic{ &this->m_drawing, &this->m_drawing_view, &this->m_device_window }; auto mouse_pos = ic.device_to_drawing({event.GetX(),event.GetY()}); auto & app = wxGetApp(); auto doc = app.get_document(); m_last_aircraft_position = doc->get_aircraft_xyz_position(); vect2_mm last_xy {m_last_aircraft_position.x,m_last_aircraft_position.y}; if ( mouse_pos != last_xy){ doc->set_aircraft_xyz_position({mouse_pos.x,mouse_pos.y,m_last_aircraft_position.z}); auto diff = mouse_pos - last_xy; auto angle = quan::atan2(diff.y,diff.x); doc->set_aircraft_heading(quan::angle::deg{90} - angle); // update_aircraft_gps_position(doc->get_aircraft_gps_position< // quan::angle::deg10e7, // quan::length::m // >()); QuanTrackerSimEvent x{wxEvent_AircraftPositionChanged}; app.get_panel()->AddPendingEvent(x); this->Refresh(); } } }
void GraphCanvas::OnMotion(wxMouseEvent& evt) { m_MouseX = evt.GetX() - m_BorderSize; m_MouseY = evt.GetY() - m_BorderSize; MouseToCanvas(m_MouseX, m_MouseY, &m_CanvasX, &m_CanvasY); if (evt.Dragging() && evt.LeftIsDown()) { int dx = m_LeftX - m_MouseX; int dy = m_LeftY - m_MouseY; if (m_HasDragged || abs(dx) > 5 || abs(dy) > 5) { if (!m_HasDragged) { m_HasDragged = true; SetCursor(m_HandCursor); } m_LeftX = m_MouseX; m_LeftY = m_MouseY; int viewx, viewy; GetViewStart(&viewx, &viewy); Scroll(viewx + dx, viewy + dy); } } else { //SetCursor(*wxSTANDARD_CURSOR); } evt.Skip(); }
void MagDragWindow::OnMouse( wxMouseEvent& event ) { if(event.LeftDown()) { window_box.x = event.GetX(); window_box.y = wxGetApp().m_current_viewport->GetViewportSize().GetHeight() - event.GetY(); window_box_exists = false; } else if(event.LeftUp()) { window_box.width = event.GetX() - window_box.x; window_box.height = (wxGetApp().m_current_viewport->GetViewportSize().GetHeight() - event.GetY()) - window_box.y; if(abs(window_box.width)<4){wxGetApp().SetInputMode(save_input_mode); return;} if(abs(window_box.height)<4){wxGetApp().SetInputMode(save_input_mode); return;} wxGetApp().m_frame->m_graphics->WindowMag(window_box); window_box_exists = false; wxGetApp().SetInputMode(save_input_mode); } else if(event.Dragging()) { wxGetApp().m_frame->m_graphics->SetCurrent(); wxGetApp().m_current_viewport->SetXOR(); if(window_box_exists)wxGetApp().m_current_viewport->DrawWindow(window_box, false);// undraw the window window_box.width = event.GetX() - window_box.x; window_box.height = (wxGetApp().m_current_viewport->GetViewportSize().GetHeight() - event.GetY()) - window_box.y; wxGetApp().m_current_viewport->DrawWindow(window_box, false);// draw the window wxGetApp().m_current_viewport->EndXOR(); window_box_exists = true; } }
void ViewZooming::OnMouse( wxMouseEvent& event ) { if(event.LeftDown() || event.MiddleDown()) { button_down_point = wxPoint(event.GetX(), event.GetY()); CurrentPoint = button_down_point; wxGetApp().m_current_viewport->StoreViewPoint(); wxGetApp().m_current_viewport->m_view_point.SetStartMousePoint(button_down_point); } else if(event.Dragging()) { wxPoint dm; dm.x = event.GetX() - CurrentPoint.x; dm.y = event.GetY() - CurrentPoint.y; if(event.LeftIsDown()) { wxGetApp().m_current_viewport->m_view_point.Scale(wxPoint(event.GetX(), event.GetY()), m_reversed); } else if(event.MiddleIsDown()) { wxGetApp().m_current_viewport->m_view_point.Shift(dm, wxPoint(event.GetX(), event.GetY())); } wxGetApp().m_frame->m_graphics->Refresh(); CurrentPoint = wxPoint(event.GetX(), event.GetY()); } else if(event.RightUp()){ // do context menu same as select mode wxGetApp().m_select_mode->OnMouse(event); } if(event.GetWheelRotation() != 0)wxGetApp().m_select_mode->OnMouse(event); }
//--------------------------------------------------------- void CVIEW_Map_3D::On_Mouse_Motion(wxMouseEvent &event) { if( HasCapture() && event.Dragging() ) { if( event.LeftIsDown() ) { m_pImage->m_zRotate = m_xDown - GET_MOUSE_X_RELDIFF * M_PI_180; m_pImage->m_xRotate = m_yDown - GET_MOUSE_Y_RELDIFF * M_PI_180; _Parms_Changed(); } else if( event.RightIsDown() ) { m_pImage->m_xShift = m_xDown - GET_MOUSE_X_RELDIFF * 100.0; m_pImage->m_yShift = m_yDown + GET_MOUSE_Y_RELDIFF * 100.0; _Parms_Changed(); } else if( event.MiddleIsDown() ) { m_pImage->m_yRotate = m_xDown + GET_MOUSE_X_RELDIFF * M_PI_180; m_pImage->m_zShift = m_yDown + GET_MOUSE_Y_RELDIFF * 100.0; _Parms_Changed(); } } }
/* CTextureCanvas::onMouseEvent * Called when and mouse event is generated (movement/clicking/etc) *******************************************************************/ void CTextureCanvas::onMouseEvent(wxMouseEvent& e) { bool refresh = false; // MOUSE MOVEMENT if (e.Moving() || e.Dragging()) { dragging = false; // Pan if middle button is down if (e.MiddleIsDown()) { offset = offset + point2_t(e.GetPosition().x - mouse_prev.x, e.GetPosition().y - mouse_prev.y); refresh = true; dragging = true; } else if (e.LeftIsDown()) dragging = true; // Check if patch hilight changes point2_t pos = screenToTexPosition(e.GetX(), e.GetY()); int patch = patchAt(pos.x, pos.y); if (hilight_patch != patch) { hilight_patch = patch; refresh = true; } } // LEFT BUTTON UP else if (e.LeftUp()) { // If we were dragging, generate end drag event if (dragging) { dragging = false; updateTexturePreview(); refresh = true; wxCommandEvent evt(EVT_DRAG_END, GetId()); evt.SetInt(wxMOUSE_BTN_LEFT); ProcessWindowEvent(evt); } } // LEAVING if (e.Leaving()) { // Set no hilighted patch hilight_patch = -1; refresh = true; } // Refresh is needed if (refresh) Refresh(); // Update 'previous' mouse coordinates mouse_prev.set(e.GetPosition().x, e.GetPosition().y); }
void OnMotion( wxMouseEvent & event ) { // Don't do anything if we're docked or not resizeable if( mBar->IsDocked() || !mBar->IsResizable() ) { return; } // Retrieve the mouse position wxPoint pos = ClientToScreen( event.GetPosition() ); if( HasCapture() && event.Dragging() ) { wxRect rect = GetRect(); rect.SetBottomRight( pos ); if( rect.width < mMinSize.x ) { rect.width = mMinSize.x; } if( rect.height < mMinSize.y ) { rect.height = mMinSize.y; } SetMinSize( rect.GetSize() ); SetSize( rect.GetSize() ); Layout(); Refresh( false ); } else if( HasCapture() && event.LeftUp() ) { ReleaseMouse(); } else if( !HasCapture() ) { wxRect rect = GetRect(); wxRect r; r.x = rect.GetRight() - sizerW - 2, r.y = rect.GetBottom() - sizerW - 2; r.width = sizerW + 2; r.height = sizerW + 2; // Is left click within resize grabber? if( r.Contains( pos ) && !event.Leaving() ) { SetCursor( wxCURSOR_SIZENWSE ); if( event.LeftDown() ) { CaptureMouse(); } } else { SetCursor( wxCURSOR_ARROW ); } } }
void WarkeyDlg::OnMotion(wxMouseEvent &evt) { if (evt.LeftIsDown() && evt.Dragging()) { wxPoint target_pos(evt.GetPosition()); auto delta = target_pos - orig_mouse_pos_; orig_wnd_pos_ += delta; Move(orig_wnd_pos_); } }
virtual void OnMouseMove(wxMouseEvent& event) { if (event.Dragging() && m_handToolActive) { wxPoint currentPos = event.GetPosition(); Scroll(m_viewX - currentPos.x + m_startPos.x, m_viewY - currentPos.y + m_startPos.y); } }
void VIICanvas::mouseEvent(wxMouseEvent& event) { if(event.ButtonDown(wxMOUSE_BTN_LEFT)) { mLeftClicked = true; mStartPoint = event.GetPosition(); } if(event.ButtonUp(wxMOUSE_BTN_LEFT)) { mLeftClicked = false; } if(event.ButtonDown(wxMOUSE_BTN_RIGHT)) { mRightClicked = true; mStartPoint = event.GetPosition(); } if(event.ButtonUp(wxMOUSE_BTN_RIGHT)) { mRightClicked = false; } if(event.Dragging()) { if(mLeftClicked) { wxPoint delta = event.GetPosition() - mStartPoint; mAngleY += delta.x; mAngleX += delta.y; if(mAngleX < 0) { mAngleX = 360 + mAngleX; } if(mAngleY < 0) { mAngleY = 360 + mAngleY; } mAngleX %= 360; mAngleY %= 360; //std::cout << "AngleX: " << mAngleX << " angleY: " << mAngleY << std::endl; mStartPoint = event.GetPosition(); Refresh(); } else if(mRightClicked) { wxPoint delta = event.GetPosition() - mStartPoint; mDistanceOrigin += delta.y; //std::cout << "Distance: "<< mDistanceOrigin <<std::endl; mStartPoint = event.GetPosition(); Refresh(); } } }
void CGradientCtrl::OnMouse(wxMouseEvent& event) { ECursorType eType = eCT_Invalid; wxPoint pos = event.GetPosition(); if (event.ButtonDown(wxMOUSE_BTN_LEFT)) { if (m_pSelectedCursor) { m_pSelectedCursor->Select(false); } m_pSelectedCursor = GetGradientCursor(pos); if (m_pSelectedCursor) { eType = m_pSelectedCursor->GetType(); if (eType == eCT_Color) { m_pColoutPicker->SetColour(m_pSelectedCursor->GetColor()); } else { m_pMaskSlider->SetValue(m_pSelectedCursor->GetColor().Red()); } m_pSelectedCursor->Select(true); } ShowCtrl(m_pSelectedCursor == NULL ? eCT_Invalid : m_pSelectedCursor->GetType()); Refresh(true); UpdateSelectedCursorPos(); } else if (event.Dragging()) { if (event.LeftIsDown()) { if (m_pSelectedCursor) { SetSelectedCursorPos(pos); UpdateSelectedCursorPos(); float fPos = GetNearestCursorPos(m_pSelectedCursor); if (fPos >= 0) { m_pSelectedCursor->SetPos(fPos); } Refresh(true); } } } else if (event.ButtonUp(wxMOUSE_BTN_LEFT)) { if (m_pSelectedCursor) { if (GetNearestCursorPos(m_pSelectedCursor) > 0) { DeleteCursor(m_pSelectedCursor); m_pSelectedCursor = NULL; } } } }