当前位置: 首页>>代码示例>>C++>>正文


C++ wxMouseEvent::Dragging方法代码示例

本文整理汇总了C++中wxMouseEvent::Dragging方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMouseEvent::Dragging方法的具体用法?C++ wxMouseEvent::Dragging怎么用?C++ wxMouseEvent::Dragging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxMouseEvent的用法示例。


在下文中一共展示了wxMouseEvent::Dragging方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnDrawPanelMouse

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();
}
开发者ID:uvbs,项目名称:GameProject,代码行数:59,代码来源:ItemEditorFrame.cpp

示例2: HandleMouseMove

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;
}
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:58,代码来源:scrolbar.cpp

示例3: OnMouse

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);
	}
}
开发者ID:CassieMarie,项目名称:heekscad,代码行数:54,代码来源:SelectMode.cpp

示例4: OnMouseEvent

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();
}
开发者ID:inaes-tic,项目名称:tv-moldeo,代码行数:50,代码来源:moTimelineRuler.cpp

示例5: OnMouseEvent

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);
	}
  }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:31,代码来源:AudioView.cpp

示例6: OnDrag

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();
  }
}
开发者ID:zulman,项目名称:qutemol,代码行数:28,代码来源:main.cpp

示例7: MouseMoveEvent

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();
    }
}
开发者ID:ndevenish,项目名称:Hugin,代码行数:60,代码来源:PreviewLayoutLinesTool.cpp

示例8: onMotion

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();
        }
    }
}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:28,代码来源:wx_view_controls.cpp

示例9: OnMouseMotion

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();
	}
}
开发者ID:Glought,项目名称:MultiMC4,代码行数:29,代码来源:instancectrl.cpp

示例10: onMouse

void KeysScaleWidget::onMouse(wxMouseEvent& event)
{
	if (event.LeftDown())
		m_parent->setCurrPos(queryGridByPos(event.GetX()));
	else if (event.Dragging())
		m_parent->setCurrPos(queryGridByPos(event.GetX()));
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:7,代码来源:KeysScaleWidget.cpp

示例11: if

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();
}
开发者ID:airvine,项目名称:spinachgui,代码行数:16,代码来源:Display3D.cpp

示例12:

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);
    }
}
开发者ID:eriser,项目名称:wired,代码行数:27,代码来源:SeqTrack.cpp

示例13: OnMouseMotion

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);
	}
}
开发者ID:Joe-xXx,项目名称:pgadmin3,代码行数:25,代码来源:explainCanvas.cpp

示例14: OnMouseEvent

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);
	}
}
开发者ID:BackupTheBerlios,项目名称:rrtools-svn,代码行数:30,代码来源:odlistbox.cpp

示例15: OnEvent

// 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;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:27,代码来源:mdi.cpp


注:本文中的wxMouseEvent::Dragging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。