Beispiel #1
0
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);
	}
  }
}
Beispiel #2
0
void Canvas::OnMouse(wxMouseEvent& evt)
{
	// Capture on button-down, so we can respond even when the mouse
	// moves off the window
	if (!m_MouseCaptured && evt.ButtonDown())
	{
		m_MouseCaptured = true;
		CaptureMouse();
	}
	// Un-capture when all buttons are up
	else if (m_MouseCaptured && evt.ButtonUp() &&
		! (evt.ButtonIsDown(wxMOUSE_BTN_LEFT) || evt.ButtonIsDown(wxMOUSE_BTN_MIDDLE) || evt.ButtonIsDown(wxMOUSE_BTN_RIGHT))
		)
	{
		m_MouseCaptured = false;
		ReleaseMouse();
	}

	// Set focus when clicking
	if (evt.ButtonDown())
		SetFocus();

	// Reject motion events if the mouse has not actually moved
	if (evt.Moving() || evt.Dragging())
	{
		if (m_LastMousePos == evt.GetPosition())
			return;
		m_LastMousePos = evt.GetPosition();
	}

	HandleMouseEvent(evt);
}
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();
}
Beispiel #4
0
void VIICanvas::mouseEvent(wxMouseEvent& event)
{
	if(event.ButtonDown(wxMOUSE_BTN_LEFT))
	{
		mLeftClicked = true;
		mStartPoint = event.GetPosition();
	}
	if(event.ButtonUp(wxMOUSE_BTN_LEFT))
	{
		mLeftClicked = false;
	}
	if(event.ButtonDown(wxMOUSE_BTN_RIGHT))
	{
		mRightClicked = true;
		mStartPoint = event.GetPosition();
	}
	if(event.ButtonUp(wxMOUSE_BTN_RIGHT))
	{
		mRightClicked = false;
	}

	if(event.Dragging())
	{
		if(mLeftClicked)
		{
			wxPoint delta = event.GetPosition() - mStartPoint;
			mAngleY += delta.x;
			mAngleX += delta.y;
			
			if(mAngleX < 0)
			{
				mAngleX = 360 + mAngleX;
			}
			
			if(mAngleY < 0)
			{
				mAngleY = 360 + mAngleY;
			}
			
			mAngleX %= 360;
			mAngleY %= 360;
			
			
			//std::cout << "AngleX: " << mAngleX << " angleY: " << mAngleY << std::endl;
			mStartPoint = event.GetPosition();
			Refresh();
		}
		else if(mRightClicked)
		{
			wxPoint delta = event.GetPosition() - mStartPoint;
			mDistanceOrigin += delta.y;
			//std::cout << "Distance: "<< mDistanceOrigin <<std::endl;
			mStartPoint = event.GetPosition();
			Refresh();
		}
	}
	
}
Beispiel #5
0
void VideoSlider::OnMouse(wxMouseEvent &event) {
	int x = event.GetX();

	if (event.ButtonIsDown(wxMOUSE_BTN_LEFT)) {
		// If the slider didn't already have focus, don't seek if the user
		// clicked very close to the current location as they were probably
		// just trying to focus the slider
		if (wxWindow::FindFocus() != this && abs(x - GetXAtValue(val)) < 4) {
			SetFocus();
			return;
		}

		// Shift click to snap to keyframe
		if (event.m_shiftDown) {
			int clickedFrame = GetValueAtX(x);
			std::vector<int>::const_iterator pos = lower_bound(keyframes.begin(), keyframes.end(), clickedFrame);
			if (pos == keyframes.end())
				--pos;
			else if (pos + 1 != keyframes.end() && clickedFrame - *pos > (*pos + 1) - clickedFrame)
				++pos;

			if (*pos == val) return;
			SetValue(*pos);
		}

		// Normal click
		else {
			int go = GetValueAtX(x);
			if (go == val) return;
			SetValue(go);
		}

		if (c->videoController->IsPlaying()) {
			c->videoController->Stop();
			c->videoController->JumpToFrame(val);
			c->videoController->Play();
		}
		else
			c->videoController->JumpToFrame(val);
		SetFocus();
		return;
	}

	if (event.ButtonDown(wxMOUSE_BTN_RIGHT) || event.ButtonDown(wxMOUSE_BTN_MIDDLE)) {
		SetFocus();
	}

	else if (!c->videoController->IsPlaying())
		event.Skip();
}
Beispiel #6
0
// Internal functions
void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event)
{
  if (event.ButtonDown(wxMOUSE_BTN_LEFT))
  {
    int x = (int)event.GetX();
    int y = (int)event.GetY();

    if ((x >= m_standardColoursRect.x && x <= (m_standardColoursRect.x + m_standardColoursRect.width)) &&
        (y >= m_standardColoursRect.y && y <= (m_standardColoursRect.y + m_standardColoursRect.height)))
    {
      int selX = (int)(x - m_standardColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing);
      int selY = (int)(y - m_standardColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing);
      int ptr = (int)(selX + selY*8);
      OnBasicColourClick(ptr);
    }
    // wxStaticBitmap (used to ARGB preview) events are handled in the dedicated handler.
#if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
    else if ((x >= m_customColoursRect.x && x <= (m_customColoursRect.x + m_customColoursRect.width)) &&
        (y >= m_customColoursRect.y && y <= (m_customColoursRect.y + m_customColoursRect.height)))
    {
      int selX = (int)(x - m_customColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing);
      int selY = (int)(y - m_customColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing);
      int ptr = (int)(selX + selY*8);
      OnCustomColourClick(ptr);
    }
#endif
    else
        event.Skip();
  }
  else
      event.Skip();
}
Beispiel #7
0
// Internal functions
void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event)
{
  if (event.ButtonDown(1))
  {
    int x = (int)event.GetX();
    int y = (int)event.GetY();

    if ((x >= m_standardColoursRect.x && x <= (m_standardColoursRect.x + m_standardColoursRect.width)) &&
        (y >= m_standardColoursRect.y && y <= (m_standardColoursRect.y + m_standardColoursRect.height)))
    {
      int selX = (int)(x - m_standardColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing);
      int selY = (int)(y - m_standardColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing);
      int ptr = (int)(selX + selY*8);
      OnBasicColourClick(ptr);
    }
    else if ((x >= m_customColoursRect.x && x <= (m_customColoursRect.x + m_customColoursRect.width)) &&
        (y >= m_customColoursRect.y && y <= (m_customColoursRect.y + m_customColoursRect.height)))
    {
      int selX = (int)(x - m_customColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing);
      int selY = (int)(y - m_customColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing);
      int ptr = (int)(selX + selY*8);
      OnCustomColourClick(ptr);
    }
    else
        event.Skip();
  }
  else
      event.Skip();
}
Beispiel #8
0
void TestGLCanvas::OnMouse( wxMouseEvent& event )
{
    
    static bool useLightTrack=false;

    if ( event.m_rightDown || event.m_leftDown || event.m_middleDown ) {
      if (!HasCapture()) CaptureMouse();
    }
    else if (HasCapture()) ReleaseMouse();
    
    useLightTrack=event.m_rightDown;

    bool consumed=false;
    if (useLightTrack) {
      MovingLightMode=true;
      if (wxConsumeTrackBallEvent( event, lightTrack)) {
        SetFocus();
        consumed=true;
      }
    } else {
      MovingLightMode=false;
      if (wxConsumeTrackBallEvent( event, track)) {
        SetFocus();
        consumed=true;
      }
    }
    
    if ((consumed) && (!event.ButtonUp()) && (!event.ButtonDown())) SceneChanged();
    
/*   if ( event.m_rightUp ) {
      useLightTrack=false;
    }*/

}
void wxsItemEditorContent::OnMouse(wxMouseEvent& event)
{
    // Anti-recursion lock
    static bool IsRunning = false;
    if ( IsRunning ) return;
    IsRunning = true;

    if ( event.ButtonDown() )
    {
        SetFocus();
    }
    else if ( m_MouseState == msWaitForIdle )
    {
        m_MouseState = msIdle;
    }

    int NewX = event.m_x;
    int NewY = event.m_y;
    CalcUnscrolledPosition(NewX,NewY,&NewX,&NewY);
    event.m_x = NewX;
    event.m_y = NewY;
    switch ( m_MouseState )
    {
        case msDraggingPointInit: OnMouseDraggingPointInit (event); break;
        case msDraggingPoint:     OnMouseDraggingPoint     (event); break;
        case msDraggingItemInit:  OnMouseDraggingItemInit  (event); break;
        case msDraggingItem:      OnMouseDraggingItem      (event); break;
        case msTargetSearch:      OnMouseTargetSearch      (event); break;
        case msWaitForIdle:                                         break;
        default:                  OnMouseIdle              (event); break;
    }

    IsRunning = false;
}
void ToolBarGrabber::OnMouse(wxMouseEvent &event)
{
   int prevState = mState;

   // Handle hilighting the image if the mouse is over it

   if (event.Entering())
      mState = 1;
   else if (event.Leaving())
      mState = 0;
   else {
      wxSize clientSize = GetClientSize();

      if (event.m_x >= 0 && event.m_y >= 0 &&
          event.m_x < clientSize.x && event.m_y < clientSize.y)
         mState = 1;
      else
         mState = 0;
   }

   if (event.ButtonDown())
      mOwnerToolBar->StartMoving();

   if (mState != prevState)
      Refresh(false);
}
Beispiel #11
0
void MiniStyledTextCtrl::OnMouseUpOrDown(wxMouseEvent& event)
{
    if( event.ButtonDown(wxMOUSE_BTN_LEFT) )
    {
        SetFocus();
        int line = GetLineFromPosition(event.GetPosition());
        MiniStyledTextCtrlLineClickedEvent evt(MiniStyledTextCtrlCommandEvent, GetId());
        evt.SetLine(line);
        wxPostEvent(this, evt);
    }
    if ( event.ButtonDown(wxMOUSE_BTN_RIGHT) )
    {
        SetFocus();
    }
    event.Skip(false);
}
Beispiel #12
0
void wxsToolSpace::OnMouse(wxMouseEvent& event)
{
    if ( event.ButtonDown() )
    {
        SetFocus();
    }
    event.Skip();
}
Beispiel #13
0
void CGradientCtrl::OnMouse(wxMouseEvent& event)
{
    ECursorType eType = eCT_Invalid;
    wxPoint pos = event.GetPosition();
    if (event.ButtonDown(wxMOUSE_BTN_LEFT))
    {
        if (m_pSelectedCursor)
        {
            m_pSelectedCursor->Select(false);
        }
        m_pSelectedCursor = GetGradientCursor(pos);
        if (m_pSelectedCursor)
        {
            eType = m_pSelectedCursor->GetType();
            if (eType == eCT_Color)
            {
                m_pColoutPicker->SetColour(m_pSelectedCursor->GetColor());
            }
            else
            {
                m_pMaskSlider->SetValue(m_pSelectedCursor->GetColor().Red());
            }
            m_pSelectedCursor->Select(true);
        }
        ShowCtrl(m_pSelectedCursor == NULL ? eCT_Invalid : m_pSelectedCursor->GetType());
        Refresh(true);
        UpdateSelectedCursorPos();
    }
    else if (event.Dragging())
    {
        if (event.LeftIsDown())
        {
            if (m_pSelectedCursor)
            {
                SetSelectedCursorPos(pos);
                UpdateSelectedCursorPos();
                float fPos = GetNearestCursorPos(m_pSelectedCursor);
                if (fPos >= 0)
                {
                    m_pSelectedCursor->SetPos(fPos);
                }
                Refresh(true);
            }
        }
    }
    else if (event.ButtonUp(wxMOUSE_BTN_LEFT))
    {
        if (m_pSelectedCursor)
        {
            if (GetNearestCursorPos(m_pSelectedCursor) > 0)
            {
                DeleteCursor(m_pSelectedCursor);
                m_pSelectedCursor = NULL;
            }
        }
    }
    
}
Beispiel #14
0
void LWSlider::OnMouseEvent(wxMouseEvent & event)
{
   if (event.Entering()) {
      // Display the tooltip in the status bar
      if (mParent->GetToolTip()) {
         wxString tip = mParent->GetToolTip()->GetTip();
         GetActiveProject()->TP_DisplayStatusMessage(tip, 0);
         Refresh();
      }
   }
   else if (event.Leaving()) {
      GetActiveProject()->TP_DisplayStatusMessage("",0);
      Refresh();
   }
   
   float prevValue = mCurrentValue;

   if (event.ButtonDown()) {

      //This jumps the thumb to clicked position
      if (!mIsDragging) {
         mCurrentValue = PositionToValue(event.m_x, event.ShiftDown());

         mIsDragging = true;
         mParent->CaptureMouse();

         FormatPopWin();
         SetPopWinPosition();
         mPopWin->Show();
      }

      // Don't generate notification yet
      return;

   } else if (event.ButtonUp() && mIsDragging) {
      mIsDragging = false;
      mParent->ReleaseMouse();
      mPopWin->Hide();
      ((TipPanel *)mPopWin)->SetPos(wxPoint(-1000, -1000));
   } else if (event.Dragging() && mIsDragging) {
      mCurrentValue = PositionToValue(event.m_x, event.ShiftDown());
   }

   if (prevValue != mCurrentValue) {
      FormatPopWin();
      mPopWin->Refresh();
      Refresh();

      wxCommandEvent *e =
         new wxCommandEvent(wxEVT_COMMAND_SLIDER_UPDATED, mID);
      int intValue =
         (int)((mCurrentValue - mMinValue) * 1000.0f
         / (mMaxValue - mMinValue));
      e->SetInt( intValue );
      mParent->ProcessEvent(*e);
      delete e;
   }
}
void wxCustomHeightListCtrl::OnMouseEvent(wxMouseEvent& event)
{
	bool changed = false;
	if (event.ButtonDown() && m_allow_selection) {
		wxPoint pos = event.GetPosition();
		int x, y;
		CalcUnscrolledPosition(pos.x, pos.y, &x, &y);
		if (y < 0 || y > static_cast<int>(m_lineHeight * m_rows.size())) {
			m_focusedLine = npos;
			m_selectedLines.clear();
			changed = true;
		}
		else {
			size_t line = static_cast<size_t>(y / m_lineHeight);

			if (event.ShiftDown()) {
				if (m_focusedLine == npos) {
					changed |= m_selectedLines.insert(line).second;
				}
				else if (line < m_focusedLine) {
					for (size_t i = line; i <= m_focusedLine; ++i) {
						changed |= m_selectedLines.insert(i).second;
					}
				}
				else {
					for (size_t i = line; i >= m_focusedLine && i != npos; --i) {
						changed |= m_selectedLines.insert(i).second;
					}
				}
			}
			else if (event.ControlDown()) {
				if (m_selectedLines.find(line) == m_selectedLines.end()) {
					m_selectedLines.insert(line);
				}
				else {
					m_selectedLines.erase(line);
				}
				changed = true;
			}
			else {
				m_selectedLines.clear();
				m_selectedLines.insert(line);
				changed = true;
			}

			m_focusedLine = line;
		}
		Refresh();
	}

	event.Skip();

	if (changed) {
		wxCommandEvent evt(wxEVT_COMMAND_LISTBOX_SELECTED, GetId());
		ProcessEvent(evt);
	}
}
Beispiel #16
0
void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
	if (event.ButtonDown())
		SetFocus();

	last_mouse_pos = mouse_pos = event.GetPosition();

	if (tool)
		tool->OnMouseEvent(event);
}
Beispiel #17
0
void GSPanel::OnMouseEvent( wxMouseEvent& evt )
{
	if( IsBeingDeleted() ) return;

	// Do nothing for left-button event
	if (!evt.Button(wxMOUSE_BTN_LEFT)) {
		evt.Skip();
		DoShowMouse();
	}

#if defined(__unix__)
	// HACK2: In gsopen2 there is one event buffer read by both wx/gui and pad plugin. Wx deletes
	// the event before the pad see it. So you send key event directly to the pad.
	if( (PADWriteEvent != NULL) && (GSopen2 != NULL) ) {
		keyEvent event;
		// FIXME how to handle double click ???
		if (evt.ButtonDown()) {
			event.evt = 4; // X equivalent of ButtonPress
			event.key = evt.GetButton();
		} else if (evt.ButtonUp()) {
			event.evt = 5; // X equivalent of ButtonRelease
			event.key = evt.GetButton();
		} else if (evt.Moving() || evt.Dragging()) {
			event.evt = 6; // X equivalent of MotionNotify
			long x,y;
			evt.GetPosition(&x, &y);

			wxCoord w, h;
			wxWindowDC dc( this );
			dc.GetSize(&w, &h);

			// Special case to allow continuous mouvement near the border
			if (x < 10)
				x = 0;
			else if (x > (w-10))
				x = 0xFFFF;

			if (y < 10)
				y = 0;
			else if (y > (w-10))
				y = 0xFFFF;

			// For compatibility purpose with the existing structure. I decide to reduce
			// the position to 16 bits.
			event.key = ((y & 0xFFFF) << 16) | (x & 0xFFFF);

		} else {
			event.key = 0;
			event.evt = 0;
		}

		PADWriteEvent(event);
	}
#endif
}
void moLayerEffectCtrl::OnMouseEvent( wxMouseEvent& event ) {

    if ( event.Button(wxMOUSE_BTN_LEFT) || event.ButtonDown() ) {

        ///GetParent()->ProcessEvent(event);

        ///OpenMob( m_MobDescriptor );
    }
    event.Skip();

}
Beispiel #19
0
/**
 * @function OnMouse
 */
void Viewer::OnMouse(wxMouseEvent& evt){
	if(!handleEvents) return;
	evt.GetPosition(&x,&y);

	if(evt.ButtonUp() && mouseCaptured){
		ReleaseMouse();
		mouseCaptured = false;
	}

	if(evt.ButtonDown() && !mouseCaptured){
		prevCamT = camT;
		prevWorldV = worldV;
		xInit = x;
		yInit = y;
		SetFocus();
		CaptureMouse();
		mouseCaptured = true;
		return;
	}
	double dx = (double)(x-xInit);
	double dy = (double)(y-yInit);

	if (evt.LeftIsDown() && evt.RightIsDown()){
		xInit = x;
		yInit = y;
		double camR = camRadius + dy *CAMERASPEED* 2.0f;
		if(camR > .05)
			camRadius = camR;
		UpdateCamera();
		DrawGLScene();
	}else if(evt.LeftIsDown()){
		double theta,phi;
		theta = -(dx/90.f);
		phi = -(dy/90.f);

		Matrix3d tm,pm;
		tm = AngleAxisd(theta, Vector3d::UnitZ());
		pm = AngleAxisd(phi, Vector3d::UnitY());

		Matrix3d drot = prevCamT.rotation();
		drot *= tm;
		drot *= pm;
		camRotT = drot;

		UpdateCamera();
		DrawGLScene();
	}else if(evt.MiddleIsDown() || evt.RightIsDown()){

		Vector3d dispV = camRotT*Vector3d(0,(double)dx * CAMERASPEED , -(double)dy * CAMERASPEED);
		worldV = prevWorldV+dispV;
		UpdateCamera();
		DrawGLScene();
	}
}
void moEffectLayerTimelineCtrl::OnMouseEvent( wxMouseEvent& event ) {

    if ( event.Button(wxMOUSE_BTN_LEFT) || event.ButtonDown() ) {

        GetParent()->ProcessEvent(event);

        OpenMob( m_MobDescriptor );

    }
    event.Skip();

}
	virtual void OnMouseKey(wxMouseEvent& event)
	{
		event.Skip();
#ifndef _MAC
		if(!HasCapture())
		{
			if(event.Button(wxMOUSE_BTN_LEFT) && event.ButtonDown())
			{
				wxImage image_blank(1, 1);
				image_blank.SetMask();
				image_blank.SetMaskColour(0, 0, 0);
				SetCursor(image_blank);
				mouse_pos = event.GetPosition();
				CaptureMouse();
				wxCommandEvent ev(evtMouseCapture, evID_MOUSE_CAPTURED);
				wxPostEvent(this, ev);
			}
		}
		else
			Handler()->OnMouse(MA_BUTTON, event.Button(wxMOUSE_BTN_LEFT) ? 0 : 1, event.ButtonDown());
#endif//_MAC
	}
Beispiel #22
0
void FilterPanel::OnMouseEvent(wxMouseEvent & event)
{
   if (event.ButtonDown()) {
      CaptureMouse();
   }

   if (mEnvelope->MouseEvent(event, mEnvRect, 0.0, mWidth, false))
      Refresh(false);

   if (event.ButtonUp()) {
      ReleaseMouse();
   }
}
Beispiel #23
0
void EqualizationPanel::OnMouseEvent(wxMouseEvent & event)
{
   if (event.ButtonDown()) {
      CaptureMouse();
   }

   if (mEnvelope->MouseEvent(event, mEnvRect, 0.0, mEnvRect.width, false,
                             0.0, 1.0))
      Refresh(false);

   if (event.ButtonUp()) {
      ReleaseMouse();
   }
}
Beispiel #24
0
void AButton::OnMouseEvent(wxMouseEvent & event)
{
   if (mButtonIsDown || !mEnabled)
      return;

   if (event.ButtonUp()) {
      mIsClicking = false;

      ReleaseMouse();

      if (event.m_x >= 0 && event.m_y >= 0 &&
          event.m_x < mWidth && event.m_y < mHeight) {
         mButtonState = AButtonDown;
         mButtonIsDown = true;

         wxCommandEvent *e =
             new wxCommandEvent(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
         GetParent()->ProcessEvent(*e);
         delete e;
      }

      this->Refresh(false);
      return;
   }

   if (event.ButtonDown()) {
      mIsClicking = true;
      CaptureMouse();
   }

   if (mIsClicking) {
      if (event.m_x >= 0 && event.m_y >= 0 &&
          event.m_x < mWidth && event.m_y < mHeight) {
         mButtonState = AButtonDown;
      } else
         mButtonState = AButtonUp;
      this->Refresh(false);
   } else {
      if (event.Entering()) {
         mButtonState = AButtonOver;
         this->Refresh(false);
      }

      if (event.Leaving()) {
         mButtonState = AButtonUp;
         this->Refresh(false);
      }
   }
}
Beispiel #25
0
// Returns true if parent needs to be redrawn
bool Envelope::MouseEvent(wxMouseEvent & event, wxRect & r,
                          double h, double pps, bool dB,
                          float zoomMin, float zoomMax)
{
   if (event.ButtonDown() && mButton == wxMOUSE_BTN_NONE)
      return HandleMouseButtonDown( event, r, h, pps,dB,
                                    zoomMin, zoomMax);
   if (event.Dragging() && mDragPoint >= 0)
      return HandleDragging( event, r, h, pps,dB,
                             zoomMin, zoomMax);
   if (event.ButtonUp() && event.GetButton() == mButton)
      return HandleMouseButtonUp( event, r, h, pps, dB,
                                  zoomMin, zoomMax);
   return false;
}
Beispiel #26
0
void CFrame::OnMouse(wxMouseEvent& event)
{
#if defined(HAVE_X11) && HAVE_X11
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
	{
		if(event.Dragging())
			X11Utils::SendMotionEvent(X11Utils::XDisplayFromHandle(GetHandle()),
					event.GetPosition().x, event.GetPosition().y);
		else
			X11Utils::SendButtonEvent(X11Utils::XDisplayFromHandle(GetHandle()), event.GetButton(),
					event.GetPosition().x, event.GetPosition().y, event.ButtonDown());
	}
#endif
	event.Skip();
}
Beispiel #27
0
void AStatus::OnMouseEvent(wxMouseEvent & event)
{
   if (event.ButtonDown() && mRateField.Inside(event.m_x, event.m_y)) {

      {
         wxClientDC dc(this);
         AColor::Bevel(dc, false, mRateField);
      }

      PopupMenu(mRateMenu, mRateField.x, mRateField.y + mRateField.height);

      {
         wxClientDC dc(this);
         AColor::Bevel(dc, true, mRateField);
      }
   }
}
void PanosphereOverviewCameraTool::MouseButtonEvent(wxMouseEvent &e)
{
//    DEBUG_DEBUG("mouse ov drag button");
    if ((e.ButtonDown() && (!helper->IsMouseOverPano() || e.CmdDown() || e.AltDown())) || e.MiddleDown()) {
        down = true;
        hugin_utils::FDiff2D pos = helper->GetMouseScreenPosition();
        start_x = pos.x;
        start_y = pos.y;
        PanosphereOverviewVisualizationState*  state = (PanosphereOverviewVisualizationState*) helper->GetVisualizationStatePtr();
        start_angx = state->getAngX();
        start_angy = state->getAngY();
    }
    if (e.ButtonUp()) {
        if (down) {
            down = false;
        }
    }
}
Beispiel #29
0
void AudioView::TrackSetCursor(wxMouseEvent &event)
{
  if (event.ButtonDown())
	return;

  wxRect r;

  VTrack *t = FindTrack(event.m_x, event.m_y, false, &r);

  if (t) {
	if (event.m_y >= r.y + r.height - 12 && event.m_y < r.y + r.height)
	  trackPanel->SetCursor(*trackPanel->resizeCursor);
	else
	  trackPanel->SetCursor(*trackPanel->mainCursor);
  }
  else
	trackPanel->SetCursor(*trackPanel->noneCursor);
}
Beispiel #30
0
void CTimeBarItem::OnMouse(wxMouseEvent& event)
{
    
    CTimeBarItemContainer* pParent = (CTimeBarItemContainer*)GetParent();
    CTimeBarFrame* pFrame = pParent->GetTimeBarFrameWindow();
    wxPoint pstn= event.GetPosition(); 
    int index = PointToCell(pstn);
    int iCellWidth = pParent->GetCellWidth();
    int CursorPosition = pstn.x / iCellWidth;
    CursorPosition *= iCellWidth;
    CursorPosition += iCellWidth * 0.5F;
    if (event.ButtonDown(wxMOUSE_BTN_LEFT))
    {
        pFrame->SetClickOnScalebar(false);
        pParent->GetCurrentSelect().m_iSelectRowBegin = index;
        pParent->GetCurrentSelect().m_iSelectColumnBegin = GetColumnID();
        pParent->GetCurrentSelect().m_iSelectRowEnd = index;
        pParent->GetCurrentSelect().m_iSelectColumnEnd = GetColumnID();
        pFrame->SetCursorPositionX(CursorPosition);
        pFrame->ClickOnScaleBar();
    }
    else if (event.Dragging())
    {   
        if (pstn.x % FREQUENCYREDUCTIONFACTOR == 0)
        {
            if (!pParent->GetTimeBarFrameWindow()->IsClickOnScalebar())
            {
                pParent->GetCurrentSelect().m_iSelectRowEnd = index;
                pParent->GetCurrentSelect().m_iSelectColumnEnd = GetColumnID();
            }
            pFrame->SetCursorPositionX(CursorPosition);
            pFrame->ClickOnScaleBar();
        }
    }
    else if (event.ButtonUp(wxMOUSE_BTN_LEFT))
    {
        int id = GetColumnID();
        pFrame->SetCurrentSelect(id);
    }
    event.Skip();
};