Esempio n. 1
0
void SimpleList::OnLButtonUp(UINT nFlags, CPoint point)
{
	int cell_pos;
	DWORD cell_data;
	if (CalcParamsForClicks(point, cell_pos, cell_data))
		OnLeftUp(cell_pos, cell_pos + m_v_scroll_bar.GetFirstVisibleElement(), cell_data, point.x - 0, point.y - cell_pos*m_cell_h);
}
Esempio n. 2
0
 Keyboard(wxWindow *parent)
 :   wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(0, kWhiteKeyHeight))
 {
     img_white_          = LoadImage(L"pianokey_white.png");
     img_white_pushed_   = LoadImage(L"pianokey_white_pushed.png");
     img_white_pushed_contiguous_   = LoadImage(L"pianokey_white_pushed_contiguous.png");
     img_black_          = LoadImage(L"pianokey_black.png");
     img_black_pushed_   = LoadImage(L"pianokey_black_pushed.png");
     
     img_white_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_white_pushed_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_white_pushed_contiguous_.Rescale(kKeyWidth, kWhiteKeyHeight);
     img_black_.Rescale(kKeyWidth+1, kBlackKeyHeight);
     img_black_pushed_.Rescale(kKeyWidth+1, kBlackKeyHeight);
     
     Bind(wxEVT_PAINT, [this](auto &ev) { OnPaint(); });
     
     timer_.Bind(wxEVT_TIMER, [this](auto &ev) { OnTimer(); });
     timer_.Start(50);
     Bind(wxEVT_LEFT_DOWN, [this](auto &ev) { OnLeftDown(ev); });
     Bind(wxEVT_LEFT_DCLICK, [this](auto &ev) { OnLeftDown(ev); });
     Bind(wxEVT_LEFT_UP, [this](auto &ev) { OnLeftUp(ev); });
     Bind(wxEVT_MOTION, [this](auto &ev) { OnMotion(ev); });
     Bind(wxEVT_KEY_DOWN, [this](auto &ev) { OnKeyDown(ev); });
     Bind(wxEVT_KEY_UP, [this](auto &ev) { OnKeyUp(ev); });
     
     key_code_for_sample_note_.fill(0);
 }
Esempio n. 3
0
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);
	}
}
Esempio n. 4
0
void MapGridCtrl::OnMouseMove(wxMouseEvent& event)
{
	SetCursor(wxCursor(wxCURSOR_HAND));
	if (m_in_mouse_drag) {
		// Fix for for not receiving LeftUp event when left button
		// is released outside the control (happens on Windows.)
		if (!event.LeftIsDown()) {
			OnLeftUp(event);
			return;
		}

		m_pos -= (event.GetPosition() - m_last_mouse_pos);
		m_last_mouse_pos = event.GetPosition();

		CheckInBounds();
		Refresh();
	} else {
		const wxPoint pos_unscaled = event.GetPosition() + m_pos;
		const wxPoint pos = wxPoint2DInt(pos_unscaled) / (MINIMAP_SIZE + MINIMAP_MARGIN);
		const int idx = pos.y * m_size.x + pos.x;
		MapData* old_mouseover_map = m_mouseover_map;

		// use pos_unscaled for tests against 0 because negative values lower
		// than MINIMAP_SIZE get rounded up to 0 when diviving by MINIMAP_SIZE..
		if (pos_unscaled.x >= 0 && pos.x < m_size.x && pos_unscaled.y >= 0 && pos.y <= m_size.y && idx < (int)m_grid.size()) {
			m_mouseover_map = m_grid[idx];
		} else {
			m_mouseover_map = NULL;
		}

		if (m_mouseover_map != old_mouseover_map) {
			if (m_selection_follows_mouse && m_mouseover_map != NULL) {
				SelectMap(m_mouseover_map);
			}
		}
	}
}
Esempio n. 5
0
void HoldButton::OnLeaveWindow(wxMouseEvent &event)
{
  OnLeftUp(event);
}