本文整理汇总了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();
}
示例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;
}
示例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);
}
}
示例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();
}
示例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);
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
示例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()));
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}