本文整理汇总了C++中HasCapture函数的典型用法代码示例。如果您正苦于以下问题:C++ HasCapture函数的具体用法?C++ HasCapture怎么用?C++ HasCapture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HasCapture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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();
}
示例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 );
}
}
}
示例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;
}
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例9: OnCaptureLost
void ToolBar::OnCaptureLost( wxMouseCaptureLostEvent & event )
{
if( HasCapture() )
{
ReleaseMouse();
}
}
示例10:
MainMenuButton::~MainMenuButton()
{
if (HasCapture())
ReleaseMouse();
safe_delete(m_mainMenu);
}
示例11: WXUNUSED
void ToolBarResizer::OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) )
{
if( HasCapture() )
{
ReleaseMouse();
}
}
示例12: OnCaptureLost
void OnCaptureLost( wxMouseCaptureLostEvent & WXUNUSED(event) )
{
if( HasCapture() )
{
ReleaseMouse();
}
}
示例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();
}
示例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();
}
示例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;
}
}