• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ HasCapture函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HasCapture函数的典型用法代码示例。如果您正苦于以下问题:C++ HasCapture函数的具体用法?C++ HasCapture怎么用?C++ HasCapture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: CaptureMouse

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


示例2: switch

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


示例3: OnMotion

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


示例4: GetMousePos

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;
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:8,代码来源:LineEdit.cpp


示例5: CaptureMouse

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();
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:12,代码来源:audio_display.cpp


示例6: Refresh

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();
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:14,代码来源:Event.cpp


示例7: GetClientSize

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();
}
开发者ID:EEmmanuel7,项目名称:wxskintoy,代码行数:49,代码来源:wxSkinSlider.cpp


示例8: OnIdle

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);
}
开发者ID:cubemoon,项目名称:game-editor,代码行数:33,代码来源:wxJigsawEditorCanvas.cpp


示例9: OnCaptureLost

void ToolBar::OnCaptureLost( wxMouseCaptureLostEvent & event )
{
   if( HasCapture() )
   {
      ReleaseMouse();
   }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:7,代码来源:ToolBar.cpp


示例10:

MainMenuButton::~MainMenuButton()
{
	if (HasCapture())
		ReleaseMouse();

	safe_delete(m_mainMenu);
}
开发者ID:boskee,项目名称:Desurium-1,代码行数:7,代码来源:MainMenuButton.cpp


示例11: WXUNUSED

void ToolBarResizer::OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) )
{
   if( HasCapture() )
   {
      ReleaseMouse();
   }
}
开发者ID:jengelh,项目名称:audacity,代码行数:7,代码来源:ToolBar.cpp


示例12: OnCaptureLost

 void OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) )
 {
    if( HasCapture() )
    {
       ReleaseMouse();
    }
 }
开发者ID:GYGit,项目名称:Audacity,代码行数:7,代码来源:ToolManager.cpp


示例13: SetFocus

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();


}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:30,代码来源:WXSceneCanvas.cpp


示例14: On_Mouse_LUp

//---------------------------------------------------------
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();
}
开发者ID:Fooway,项目名称:SAGA-GIS-git-mirror,代码行数:29,代码来源:points_view_extent.cpp


示例15: On_Mouse_MUp

//---------------------------------------------------------
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;
	}
}
开发者ID:johanvdw,项目名称:SAGA-GIS-git-mirror,代码行数:36,代码来源:view_map_control.cpp


示例16: LeftRepeat

void LineEdit::LeftRepeat(Point p, dword flags) {
	if(HasCapture()) {
		int c = GetMousePos(p);
		if(mpos != c)
			PlaceCaret(c, true);
	}
}
开发者ID:pedia,项目名称:raidget,代码行数:7,代码来源:LineEdit.cpp


示例17: WXUNUSED

void wxSkinWindow::OnLeaveWindow(wxMouseEvent& WXUNUSED(event))
{
	m_bInside = false;
	if(HasCapture())
		ReleaseMouse();	
	Refresh();
}
开发者ID:EEmmanuel7,项目名称:wxskintoy,代码行数:7,代码来源:wxSkinWindow.cpp


示例18: OnMouseMove

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();
}
开发者ID:sanyaade-g2g-repos,项目名称:nuzynth,代码行数:26,代码来源:SongCanvas.cpp


示例19: if

//---------------------------------------------------------
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();
		}
	}
}
开发者ID:am2222,项目名称:SAGA-GIS,代码行数:28,代码来源:view_map_3d.cpp


示例20: MouseMove

void ScrollBar::MouseMove(Point p, dword) {
	if(HasCapture() && push == 2)
		Drag(p);
	else
	if(light != GetMousePart())
		Refresh();
}
开发者ID:pedia,项目名称:raidget,代码行数:7,代码来源:ScrollBar.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HasClientObjectData函数代码示例发布时间:2022-05-30
下一篇:
C++ HasAttr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap