Пример #1
0
//----------------------------------------------------------------------------
void E_MainFrame::OnMenuToolItem(wxMouseEvent &e)
{
	int id = e.GetId();

	std::map<int, std::string>::iterator it = mIDScripts.find(id);

	if (it != mIDScripts.end())
	{
		if (mToolMenu)
		{
			delete mToolMenu;
			mToolMenu = 0;
		}

		mToolMenu = new wxMenu();
		NirMan::GetSingleton().SetCurMenu(mToolMenu);

		std::string callStr = it->second;
		PX2_SM.CallString(callStr);
		int idx = mToolBarMenu->GetToolPos(id);

		wxRect parentRect = mToolBarMenu->GetRect();
		wxRect rect = mToolBarMenu->GetItems().Item(idx).GetSizerItem()->GetRect();

		if (mToolMenu)
		{
			PopupMenu(mToolMenu, parentRect.x + rect.x, parentRect.y + parentRect.height - rect.y);
		}
	}
}
Пример #2
0
void InstallPrompt::onMouseDown( wxMouseEvent& event )
{
#ifdef WIN32
	if (event.GetId() == textA->GetId())
	{
		m_rbInstallRemove->SetValue(true);
	}
	else if (event.GetId() == textB->GetId())
	{
		m_rbInstallLeave->SetValue(true);
	}
	else if (event.GetId() == textC->GetId())
	{
		m_rbInstallVerify->SetValue(true);
	}
#endif
}
Пример #3
0
void TASInputDlg::SetTurboFalse(wxMouseEvent& event)
{
	switch (event.GetId())
	{
		case ID_A:
			A_turbo = false;
			break;

		case ID_B:
			B_turbo = false;
			break;

		case ID_X:
			X_turbo = false;
			break;

		case ID_Y:
			Y_turbo = false;
			break;

		case ID_Z:
			Z_turbo = false;
			break;

		case ID_L:
			L_turbo = false;
			break;

		case ID_R:
			R_turbo = false;
			break;

		case ID_START:
			START_turbo = false;
			break;

		case ID_UP:
			DU_turbo = false;
			break;

		case ID_DOWN:
			DD_turbo = false;
			break;

		case ID_LEFT:
			DL_turbo = false;
			break;

		case ID_RIGHT:
			DR_turbo = false;
			break;

		default:
			return;
	}

	event.Skip(true);
}
Пример #4
0
void Canvas::OnMouseEvent(wxMouseEvent& event)
{
	if(m_controller)
		m_controller->OnMouseEvent(event);
	
	if(event.GetId() == wxEVT_LEFT_DOWN) {
		event.Skip(); // let the window get focus
	}
}
Пример #5
0
void TASInputDlg::OnMouseDownL(wxMouseEvent& event)
{
	if (event.GetEventType() == wxEVT_MOTION && !event.LeftIsDown())
		return;

	wxSlider *sliderX,*sliderY;
	wxStaticBitmap *sbitmap;
	wxTextCtrl *textX, *textY;
	int *x,*y;

	switch (event.GetId())
	{
		case ID_MAIN_STICK:
			sliderX = wx_mainX_s;
			sliderY = wx_mainY_s;
			textX = wx_mainX_t;
			textY = wx_mainY_t;
			sbitmap = static_bitmap_main;
			x = &xaxis;
			y = &yaxis;
			break;

		case ID_C_STICK:
			sliderX = wx_cX_s;
			sliderY = wx_cY_s;
			textX = wx_cX_t;
			textY = wx_cY_t;
			sbitmap = static_bitmap_c;
			x = &c_xaxis;
			y = &c_yaxis;
			break;

		default:
			return;
	}

	wxPoint ptM(event.GetPosition());
	*x = ptM.x *2;
	*y = ptM.y * 2;

	if (*x > 255)
		*x = 255;

	if (*y > 255)
		*y = 255;

	sbitmap->SetBitmap(TASInputDlg::CreateStickBitmap(*x,*y));

	textX->SetValue(wxString::Format("%i", *x));
	textY->SetValue(wxString::Format("%i", 256 - *y));

	sliderX->SetValue(*x);
	sliderY->SetValue(256 - *y);
	event.Skip(true);
}
Пример #6
0
void SerialConfigurator::continueDragHdl( wxMouseEvent& event )
{
   if (event.Dragging()){

      char buf[5];
      sprintf(buf,"%d ", event.GetId());

      m_Text->AppendText(buf);
   }

   event.Skip();
}
Пример #7
0
void PalettePanel::OnColorRightDown(wxMouseEvent& event)
{
    int i;

    for (i = 0; i < 16; i++)
    {
        if (m_apPanelColor[i]->GetId() == event.GetId())
        {
            SelectColor(i, true);
            break;
        }
    }
}
Пример #8
0
void wxGenericColourDialog::OnCustomColourMouseClick(wxMouseEvent& event)
{
    // Find index of custom colour
    // and call the handler.
    for (int i = 0; i < WXSIZEOF(m_customColoursBmp); i++)
    {
        if ( m_customColoursBmp[i]->GetId() == event.GetId() )
        {
              OnCustomColourClick(i);
              return;
        }
    }

    event.Skip();
}
Пример #9
0
void TASInputDlg::OnMouseUpR(wxMouseEvent& event)
{
	wxSlider *sliderX,*sliderY;
	wxStaticBitmap *sbitmap;
	wxTextCtrl *textX, *textY;
	int *x,*y;

	switch (event.GetId())
	{
		case ID_MAIN_STICK:
			sliderX = wx_mainX_s;
			sliderY = wx_mainY_s;
			textX = wx_mainX_t;
			textY = wx_mainY_t;
			sbitmap = static_bitmap_main;
			x = &xaxis;
			y = &yaxis;
			break;

		case ID_C_STICK:
			sliderX = wx_cX_s;
			sliderY = wx_cY_s;
			textX = wx_cX_t;
			textY = wx_cY_t;
			sbitmap = static_bitmap_c;
			x = &c_xaxis;
			y = &c_yaxis;
			break;

		default:
			return;
	}

	*x = 128;
	*y = 128;

	sbitmap->SetBitmap(TASInputDlg::CreateStickBitmap(*x,*y));

	textX->SetValue(wxString::Format("%i", *x));
	textY->SetValue(wxString::Format("%i", 256 - *y));

	sliderX->SetValue(*x);
	sliderY->SetValue(256 - *y);
	event.Skip(true);

}
Пример #10
0
void mmBudgetingPanel::OnMouseLeftDown(wxMouseEvent& event)
{
    // depending on the clicked control's window id.
    switch (event.GetId())
    {
        case ID_PANEL_BUDGETENTRY_STATIC_BITMAP_VIEW :
        {
            wxMenu menu;
            menu.Append(MENU_VIEW_ALLBUDGETENTRIES, wxGetTranslation(VIEW_ALL));
            menu.Append(MENU_VIEW_PLANNEDBUDGETENTRIES, wxGetTranslation(VIEW_PLANNED));
            menu.Append(MENU_VIEW_NONZEROBUDGETENTRIES, wxGetTranslation(VIEW_NON_ZERO));
            menu.Append(MENU_VIEW_INCOMEBUDGETENTRIES, wxGetTranslation(VIEW_INCOME));
            menu.Append(MENU_VIEW_EXPENSEBUDGETENTRIES, wxGetTranslation(VIEW_EXPENSE));
            menu.AppendSeparator();
            menu.Append(MENU_VIEW_SUMMARYBUDGETENTRIES, wxGetTranslation(VIEW_SUMM));
            PopupMenu(&menu, event.GetPosition());
            break;
        }
    }
    event.Skip();
}
Пример #11
0
void ScrolledPanel::OnMouseDClick(wxMouseEvent & event) {
    cout << "ScrolledPanel::OnMouseDClick::event.GetId() : " << event.GetId() << endl;
}
Пример #12
0
void ScrolledPanel::OnMouseLeftUp(wxMouseEvent & event) {
    cout << "ScrolledPanel::OnMouseUp::event.GetId() : " << event.GetId() << endl;
}
Пример #13
0
void TASInputDlg::SetTurbo(wxMouseEvent& event)
{
	wxCheckBox* placeholder;

	switch (event.GetId())
	{
		case ID_A:
			placeholder = wx_a_button;
			A_turbo = !A_turbo;
			break;

		case ID_B:
			placeholder = wx_b_button;
			B_turbo = !B_turbo;
			break;

		case ID_X:
			placeholder = wx_x_button;
			X_turbo = !X_turbo;
			break;

		case ID_Y:
			placeholder = wx_y_button;
			Y_turbo = !Y_turbo;
			break;

		case ID_Z:
			placeholder = wx_z_button;
			Z_turbo = !Z_turbo;
			break;

		case ID_L:
			placeholder = wx_l_button;
			L_turbo = !L_turbo;
			break;

		case ID_R:
			placeholder = wx_r_button;
			R_turbo = !R_turbo;
			break;

		case ID_START:
			placeholder = wx_start_button;
			START_turbo = !START_turbo;
			break;

		case ID_UP:
			placeholder = wx_up_button;
			DU_turbo = !DU_turbo;
			break;

		case ID_DOWN:
			placeholder = wx_down_button;
			DD_turbo = !DD_turbo;
			break;

		case ID_LEFT:
			placeholder = wx_left_button;
			DL_turbo = !DL_turbo;
			break;

		case ID_RIGHT:
			placeholder = wx_right_button;
			DR_turbo = !DR_turbo;
			break;
		default:
			return;
	}
	placeholder->SetValue(true);
}
Пример #14
0
void TASInputDlg::SetTurbo(wxMouseEvent& event)
{
	wxCheckBox* placeholder;

	switch(event.GetId())
	{
		case ID_A:
			placeholder = wx_a_button;

			if(A_turbo)
				A_turbo = false;
			else
				A_turbo = true;
			break;

		case ID_B:
			placeholder = wx_b_button;
			if(B_turbo)
				B_turbo = false;
			else
				B_turbo = true;
			break;

		case ID_X:
			placeholder = wx_x_button;
			if(X_turbo)
				X_turbo = false;
			else
				X_turbo = true;
			break;

		case ID_Y:
			placeholder = wx_y_button;
			if(Y_turbo)
				Y_turbo = false;
			else
				Y_turbo = true;
			break;

		case ID_Z:
			placeholder = wx_z_button;
			if(Z_turbo)
				Z_turbo = false;
			else
				Z_turbo = true;
			break;

		case ID_L:
			placeholder = wx_l_button;
			if(L_turbo)
				L_turbo = false;
			else
				L_turbo = true;
			break;

		case ID_R:
			placeholder = wx_r_button;
			if(R_turbo)
				R_turbo = false;
			else
				R_turbo = true;
			break;

		case ID_START:
			placeholder = wx_start_button;
			if(START_turbo)
				START_turbo = false;
			else
				START_turbo = true;
			break;

		case ID_UP:
			placeholder = wx_start_button;
			if(DU_turbo)
				DU_turbo = false;
			else
				DU_turbo = true;
			break;

		case ID_DOWN:
			placeholder = wx_start_button;
			if(DD_turbo)
				DD_turbo = false;
			else
				DD_turbo = true;
			break;

		case ID_LEFT:
			placeholder = wx_left_button;
			if(DL_turbo)
				DL_turbo = false;
			else
				DL_turbo = true;
			break;

		case ID_RIGHT:
			placeholder = wx_right_button;
			if(DR_turbo)
				DR_turbo = false;
			else
				DR_turbo = true;
			break;
		default:
			return;
	}
	placeholder->SetValue(true);
}
Пример #15
0
void CursorData::OnMouseEvent( wxMouseEvent &event )
{
    if( event.RightDown() ) {
        if( m_DialogStyle >> 1 == ATTACHED ) {
            wxMouseEvent evt(event);
            m_gparent.OnMouseEvent( evt );
        }
        return;
    }

    static wxPoint s_gspt;
    int x, y;

    event.GetPosition( &x, &y );
    wxPoint spt = wxPoint( x, y );
    if( event.GetId() != 1000 )
        spt = ClientToScreen( spt );
    else
        spt = GetParent()->ClientToScreen( spt );

#ifdef __WXOSX__
    if (!m_bLeftDown && event.LeftIsDown())
    {
        m_bLeftDown = true;
        s_gspt = spt;
        if (!HasCapture()) CaptureMouse();
    }
    else if (m_bLeftDown && !event.LeftIsDown())
    {
       // GetParent()->Move( GetParent()->GetPosition() );
        m_bLeftDown = false;
        if (HasCapture()) ReleaseMouse();
    }
#else

    if( event.LeftDown() ) {
        s_gspt = spt;
        CaptureMouse();
    }

    if( event.LeftUp() ) {
        //GetParent()->Move( GetParent()->GetPosition() );
        if( HasCapture() ) ReleaseMouse();
    }
#endif

    if( event.Dragging() ) {

        wxPoint par_pos_old = GetParent()->GetPosition();

        wxPoint par_pos = par_pos_old;
        par_pos.x += spt.x - s_gspt.x;
        par_pos.y += spt.y - s_gspt.y;

        wxPoint pos_in_parent = GetOCPNCanvasWindow()->ScreenToClient( par_pos );
        wxPoint pos_in_parent_old = GetOCPNCanvasWindow()->ScreenToClient( par_pos_old );

		// X
		if( pos_in_parent.x < pos_in_parent_old.x ) {           // moving left
			if( pos_in_parent.x < 10 ) {
				pos_in_parent.x = 0;
			}
		} else
        if( pos_in_parent.x > pos_in_parent_old.x ) {           // moving right
            int max_right = GetOCPNCanvasWindow()->GetClientSize().x - GetParent()->GetSize().x;
            if( pos_in_parent.x > ( max_right - 10 ) ) {
                pos_in_parent.x = max_right;
            }
        }

		// Y
		if( pos_in_parent.y < pos_in_parent_old.y ) {            // moving up
			if( pos_in_parent.y < 10 ) {
				pos_in_parent.y = 0;
			}
		} else
        if( pos_in_parent.y > pos_in_parent_old.y ) {            // moving dow
            int max_down = GetOCPNCanvasWindow()->GetClientSize().y - GetParent()->GetSize().y;
            if( pos_in_parent.y > ( max_down - 10 ) ) {
                pos_in_parent.y = max_down;
            }
        }

		wxPoint final_pos = GetOCPNCanvasWindow()->ClientToScreen( pos_in_parent );

		GetParent()->Move( final_pos );

        s_gspt = spt;

    }
}
Пример #16
0
void CursorData::OnMenuCallBack( wxMouseEvent& event )
{
    //populate menu
    wxMenu* menu = new wxMenu();
    int id = event.GetId();
    switch( id ) {
        case GribOverlaySettings::WIND:
            MenuAppend( menu, B_ARROWS, _("Barbed Arrows"), id );
            MenuAppend( menu, ISO_LINE, _("Display Isotachs"), id );
            MenuAppend( menu, OVERLAY, _("OverlayMap"), id );
            MenuAppend( menu, NUMBERS, _("Numbers"), id );
            MenuAppend( menu, PARTICLES, _("Particle Map"), id );
            break;
        case GribOverlaySettings::WIND_GUST:
            MenuAppend( menu, ISO_LINE, _("Display Isotachs"), id );
            MenuAppend( menu, OVERLAY, _("OverlayMap"), id );
            MenuAppend( menu, NUMBERS, _("Numbers"), id );
            break;
        case GribOverlaySettings::PRESSURE:
            MenuAppend( menu, ISO_LINE, _("Display Isobars"), id );
            MenuAppend( menu, NUMBERS, _("Numbers"), id );
            break;
        case GribOverlaySettings::AIR_TEMPERATURE:
        case GribOverlaySettings::SEA_TEMPERATURE:
            MenuAppend( menu, ISO_LINE, _("Display Isotherms"), id );
        case GribOverlaySettings::CLOUD:
        case GribOverlaySettings::PRECIPITATION:
            MenuAppend( menu, OVERLAY, _("OverlayMap"), id );
            MenuAppend( menu, NUMBERS, _("Numbers"), id );
            break;
        case GribOverlaySettings::CAPE:
            MenuAppend( menu, ISO_LINE, _("Display Iso CAPE"), id );
            MenuAppend( menu, OVERLAY, _("OverlayMap"), id );
            MenuAppend( menu, NUMBERS, _("Numbers"), id );
            break;
        case GribOverlaySettings::WAVE:
            MenuAppend( menu, D_ARROWS, _("Direction Arrows"), id );
            MenuAppend( menu, OVERLAY, _("OverlayMap"), id );
            MenuAppend( menu, NUMBERS, _("Numbers"), id );
            break;
        case GribOverlaySettings::CURRENT:
            MenuAppend( menu, D_ARROWS, _("Direction Arrows"), id );
            MenuAppend( menu, OVERLAY, _("OverlayMap"), id );
            MenuAppend( menu, NUMBERS, _("Numbers"), id );
            MenuAppend( menu, PARTICLES, _("Particle Map"), id );
    }

    PopupMenu( menu );

    //apply new config
    wxwxMenuItemListNode *node = menu->GetMenuItems().GetFirst();
    while( node ) {
        wxMenuItem *it = node->GetData();
        switch( it->GetId() ) {
            case B_ARROWS:
                m_gparent.m_OverlaySettings.Settings[id].m_bBarbedArrows = it->IsChecked();
                break;
            case ISO_LINE:
                m_gparent.m_OverlaySettings.Settings[id].m_bIsoBars = it->IsChecked();
                break;
            case D_ARROWS:
                m_gparent.m_OverlaySettings.Settings[id].m_bDirectionArrows = it->IsChecked();
                break;
            case OVERLAY:
                m_gparent.m_OverlaySettings.Settings[id].m_bOverlayMap = it->IsChecked();
                break;
            case NUMBERS:
                m_gparent.m_OverlaySettings.Settings[id].m_bNumbers = it->IsChecked();
                break;
            case PARTICLES:
                m_gparent.m_OverlaySettings.Settings[id].m_bParticles = it->IsChecked();
        }
        node = node->GetNext();
    }

    //if the current parameter type is selected then resolve display conflicts
	if( m_gparent.InDataPlot(id) && m_gparent.m_bDataPlot[id] )
		ResolveDisplayConflicts( id );

    //save new config
    m_gparent.m_OverlaySettings.Write();

    delete menu;
}