void wxMouseEventsManager::OnLeftUp(wxMouseEvent& event) { switch ( m_state ) { case State_Normal: // ignore it, the mouse hasn't been pressed over any item initially // so releasing it shouldn't do anything event.Skip(); // skip releasing the capture below return; case State_Pressed: if ( MouseHitTest(event.GetPosition()) == m_item ) { // mouse released over the same item, so it was a click MouseClicked(m_item); } break; case State_Dragging: MouseDragEnd(m_item, event.GetPosition()); break; } m_state = State_Normal; m_item = wxNOT_FOUND; m_win->ReleaseMouse(); }
Bool ColorBox::InputEvent(const BaseContainer &msg) { if(msg.GetInt32(BFM_INPUT_DEVICE) == BFM_INPUT_MOUSE){ if(msg.GetInt32(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSELEFT){ m_mouseX = msg.GetInt32(BFM_INPUT_X); m_mouseY = msg.GetInt32(BFM_INPUT_Y); m_mouseDown = TRUE; Global2Local(&m_mouseX, &m_mouseY); MouseDragStart(BFM_INPUT_MOUSELEFT,m_mouseX, m_mouseY,MOUSEDRAGFLAGS_0); MouseUpdate(); } } Float x, y; BaseContainer channels; while (MouseDrag(&x, &y, &channels) == MOUSEDRAGRESULT_CONTINUE) { m_mouseX -= x; m_mouseY -= y; //Global2Local(&m_mouseX, &m_mouseY); MouseUpdate(); } BaseContainer res; if(GetInputState(BFM_INPUT_MOUSE,BFM_INPUT_MOUSELEFT,res) && res.GetInt32(BFM_INPUT_VALUE) == 0){ if(m_mouseDown){ MouseDragEnd(); m_mouseDown = FALSE; } } return FALSE; }