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(); }
Image RichEdit::CursorImage(Point p, dword flags) { if(tablesel) return Image::Arrow(); switch(GetHotSpot(p)) { case 0: return Image::SizeBottomRight(); case 1: return Image::SizeVert(); case 2: return Image::SizeHorz(); default: if(text.GetRichPos(GetMousePos(p)).object) { return Image::Arrow(); } else if(HasCapture() && tabmove.table && tabmove.column >= -2) return Image::SizeHorz(); else { RichHotPos hp = GetHotPos(p); if(hp.table > 0) return Image::SizeHorz(); else { int c = GetMousePos(p); return InSelection(c) && !HasCapture() ? Image::Arrow() : Image::IBeam(); } } } return Image::Arrow(); }
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 LineEdit::MouseMove(Point p, dword flags) { if((flags & K_MOUSELEFT) && HasFocus() && HasCapture()) { int c = GetMousePos(p); dorectsel = flags & K_ALT; PlaceCaret(c, mpos != c || HasCapture()); dorectsel = false; } }
void AudioDisplay::SetDraggedObject(AudioDisplayInteractionObject *new_obj) { dragged_object = new_obj; if (dragged_object && !HasCapture()) CaptureMouse(); else if (!dragged_object && HasCapture()) ReleaseMouse(); if (!dragged_object) audio_marker.reset(); }
void IconDes::LeftUp(Point p, dword keyflags) { if(!IsCurrent()) return; if(IsPasting() && HasCapture()) Refresh(); else if(HasCapture() && selectrect) Move(); else Current().base_image.Clear(); SetBar(); SyncShow(); }
void wxSkinSlider::OnMouseMotion(wxMouseEvent& event) { wxPoint pt = event.GetPosition(); if( HasCapture() && event.Dragging()) { m_bOver = true; int w,h; GetClientSize(&w,&h); int scale; if (m_isvertical) { scale = (int)(((float)m_maxvalue/(float)h)*pt.y); } else { scale = (int)(((float)m_maxvalue/(float)w)*pt.x); } if(scale > m_maxvalue) scale = m_maxvalue; if(scale < 0) scale = 0; m_currentvalue = scale; wxCommandEvent evt(wxEVT_COMMAND_SLIDER_UPDATED,GetId()); evt.SetInt(m_currentvalue); evt.SetEventObject(this); GetEventHandler()->ProcessEvent(evt); } #if wxCHECK_VERSION(2, 7, 0) else if(m_sliderRect.Contains(pt)) #else else if(m_sliderRect.Inside(pt)) #endif { m_bOver = true; CaptureMouse(); } else { m_bOver = false; if(HasCapture()) ReleaseMouse(); } Refresh(); }
void 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); }
void ToolBar::OnCaptureLost( wxMouseCaptureLostEvent & event ) { if( HasCapture() ) { ReleaseMouse(); } }
MainMenuButton::~MainMenuButton() { if (HasCapture()) ReleaseMouse(); safe_delete(m_mainMenu); }
void ToolBarResizer::OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) ) { if( HasCapture() ) { ReleaseMouse(); } }
void OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) ) { if( HasCapture() ) { ReleaseMouse(); } }
void ActorSceneCanvas::OnLeftDown(wxMouseEvent& e) { SetFocus(); mDragStarted = true; mDragOrigin = Ogre::Vector2(e.GetX(),e.GetY()); mDragDelta = Ogre::Vector2(0.0f,0.0f); if (!GetSceneManipulator()) return; if (HasCapture()) return; wxASSERT(!m_pCameraManip); wxASSERT(mDragButton == wxMOUSE_BTN_NONE); if (!GetActiveAction()) return; //GetSceneManipulator()->setActiveAction("ManipObjectAction"); //GetActiveAction()->setParameter("%CurrentMode", ""); m_pUpdateListener->enable(); mDragButton = e.GetButton(); GetActiveAction()->onBegin(e.GetX(), e.GetY()); CaptureMouse(); }
//--------------------------------------------------------- void CPoints_View_Extent::On_Mouse_LUp(wxMouseEvent &event) { if( HasCapture() ) { ReleaseMouse(); } _Draw_Inverse(m_Mouse_Down, m_Mouse_Move); wxPoint p; p.x = event.GetX() < 0 ? 0 : event.GetX() >= GetClientSize().x ? GetClientSize().x - 1 : event.GetX(); p.y = event.GetY() < 0 ? 0 : event.GetY() >= GetClientSize().y ? GetClientSize().y - 1 : event.GetY(); if( m_Mouse_Down.x != p.x || m_Mouse_Down.y != p.y ) { m_Select = wxRect(wxPoint(m_Mouse_Down.x, m_Mouse_Down.y), p); } else { m_Select.SetX(p.x - m_Select.GetWidth () / 2); m_Select.SetY(p.y - m_Select.GetHeight() / 2); } Refresh(false); ((CPoints_View_Dialog *)GetParent())->Update_Extent(); }
//--------------------------------------------------------- void CVIEW_Map_Control::On_Mouse_MUp(wxMouseEvent &event) { if( HasCapture() ) { ReleaseMouse(); } _Draw_Inverse(m_Mouse_Down, event.GetPosition()); m_Drag_Mode = TOOL_INTERACTIVE_DRAG_NONE; switch( m_Mode ) { //----------------------------------------------------- case MAP_MODE_SELECT: break; //----------------------------------------------------- case MAP_MODE_DISTANCE: break; //----------------------------------------------------- case MAP_MODE_ZOOM: break; //----------------------------------------------------- case MAP_MODE_PAN: break; //----------------------------------------------------- case MAP_MODE_PAN_DOWN: Set_Mode(MAP_MODE_ZOOM); _Move(m_Mouse_Down, event.GetPosition()); break; } }
void LineEdit::LeftRepeat(Point p, dword flags) { if(HasCapture()) { int c = GetMousePos(p); if(mpos != c) PlaceCaret(c, true); } }
void wxSkinWindow::OnLeaveWindow(wxMouseEvent& WXUNUSED(event)) { m_bInside = false; if(HasCapture()) ReleaseMouse(); Refresh(); }
void SongCanvas::OnMouseMove(wxMouseEvent& event) { if (!event.m_leftDown || !HasCapture()) { event.Skip(); return; } /* int w, h; GetClientSize(&w, &h); float x1 = (float) event.m_x / (float) w; float y1 = (float) event.m_y / (float) h; int x = x1 * 16; int y = 15 - (int)(y1 * 16); if (x < 0) x = 0; if (x > 15) x = 15; if (y < 0) y = 0; if (y > 15) y = 15; tonematrix[x][y] = fill; Refresh(); */ //event.Skip(); }
//--------------------------------------------------------- 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(); } } }
void ScrollBar::MouseMove(Point p, dword) { if(HasCapture() && push == 2) Drag(p); else if(light != GetMousePart()) Refresh(); }
void wxSkinSlider::OnLeftUp(wxMouseEvent& evt) { if (HasCapture()) { ReleaseMouse(); } }
void DraggableListCtrl::OnChar(wxKeyEvent& event) { // Don't respond to the keyboard if the user is dragging things (else // the undo system might get slightly confused) if (HasCapture()) return; if (event.GetKeyCode() == WXK_DELETE) { long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item != -1) { AtlasWindowCommandProc::GetFromParentFrame(this)->Submit( new DeleteCommand(this, item) ); UpdateDisplay(); } } else { event.Skip(); } }
void wxSkinSlider::SetValue(int value) { if(!HasCapture()) { m_currentvalue = value; Refresh(); } }
void SongCanvas::OnLeftMouseDown(wxMouseEvent& event) { if (!HasCapture()) { CaptureMouse(); } /* int w, h; GetClientSize(&w, &h); float x1 = (float) event.m_x / (float) w; float y1 = (float) event.m_y / (float) h; int x = x1 * 16; int y = 15 - (int)(y1 * 16); if (x < 0) x = 0; if (x > 15) x = 15; if (y < 0) y = 0; if (y > 15) y = 15; fill = !tonematrix[x][y]; OnMouseMove(event); */ //Refresh(); //event.Skip(); }
void AButton::Disable() { mEnabled = false; mButtonState = AButtonDis; if (HasCapture()) ReleaseMouse(); this->Refresh(false); }
TemplateFrame::~TemplateFrame() { LOG_MSG("Called TemplateFrame::~TemplateFrame()"); if (HasCapture()) ReleaseMouse(); frames_manager->removeObserver(this); table_state->removeObserver(this); time_state->removeObserver(this); }
void ToolFrame::OnKeyDown( wxKeyEvent &event ) { event.Skip(); if( HasCapture() && event.GetKeyCode() == WXK_ESCAPE ) { Resize( mOrigSize ); ReleaseMouse(); } }
void IconDes::SetTool(void (IconDes::*_tool)(Point p, dword flags)) { FinishPaste(); if(HasCapture()) ReleaseCapture(); tool = _tool; SetBar(); }
void EffectCanvas::OnLeftMouseUp(wxMouseEvent& event) { if (HasCapture()) { effect->inst->song->history.record(change); change = 0; ReleaseMouse(); } //event.Skip(); }
//------------------------------------------------------------------------------ void CIwUIEdFrame::OnMouse(wxMouseEvent& event) { if (CIwTheHost.m_Link==NULL) return; int mode=128; if (!m_OnDrag) { if (event.LeftIsDown()) mode|=1; if (event.MiddleIsDown()) mode|=2; if (event.RightIsDown()) mode|=4; if (event.ShiftDown()) mode|=8; if (event.ControlDown()) mode|=16; if (event.MetaDown()) mode|=32; } int x = event.m_x; int y = event.m_y; int mouse[]={mode,x,y,0}; //CIwTheHost.m_Link->SetData(CIwViewerUI::MOUSE_POS,(void*)mouse); if (mode!=128 || m_OldMode!=128) { if ( AcceptsFocus() ) SetFocus(); if (!mCapturingMouse) { CaptureMouse(); mCapturingMouse = true; } } else { if (mCapturingMouse) { mCapturingMouse = false; if (HasCapture()) ReleaseMouse(); } } m_OldMode=mode; }