void Interactor2DRegionEdit::UpdateCursor( wxEvent& event, wxWindow* wnd )
{
  if ( wnd->FindFocus() == wnd )
  {
    if ( event.IsKindOf( CLASSINFO( wxMouseEvent ) )
         && ( event.GetEventType() == wxEVT_MIDDLE_DOWN || event.GetEventType() == wxEVT_RIGHT_DOWN )
         && !m_bEditing )
    {
      Interactor2D::UpdateCursor( event, wnd );
      return;
    }

    if ( m_nAction == EM_Freehand || m_nAction == EM_Polyline )
    {
      if ( event.IsKindOf( CLASSINFO( wxKeyEvent ) ) && (( wxKeyEvent* )&event)->GetKeyCode() == WXK_CONTROL &&
           (( wxKeyEvent* )&event)->GetEventType() != wxEVT_KEY_UP )
      {
        wnd->SetCursor( CursorFactory::CursorFill );
      }
      else if ( event.IsKindOf( CLASSINFO( wxMouseEvent ) ) && (( wxMouseEvent* )&event)->CmdDown() )
      {
        wnd->SetCursor( CursorFactory::CursorFill );
      }
      else
        wnd->SetCursor( m_nAction == EM_Freehand ? CursorFactory::CursorPencil : CursorFactory::CursorPolyline );
    }
    else if ( m_nAction == EM_Fill )
      wnd->SetCursor( CursorFactory::CursorFill );
    else
      Interactor2D::UpdateCursor( event, wnd );
  }
  else
    Interactor2D::UpdateCursor( event, wnd );
}
Exemplo n.º 2
0
bool wxPropertyGridManager::ProcessEvent( wxEvent& event )
{
    int evtType = event.GetEventType();

    // NB: For some reason, under wxPython, Connect in Init doesn't work properly,
    //     so we'll need to call OnPropertyGridSelect manually. Multiple call's
    //     don't really matter.
    if ( evtType == wxEVT_PG_SELECTED )
        OnPropertyGridSelect((wxPropertyGridEvent&)event);

    // Property grid events get special attention
    if ( evtType >= wxPG_BASE_EVT_TYPE &&
         evtType < (wxPG_MAX_EVT_TYPE) &&
         m_selPage >= 0 )
    {
        wxPropertyGridPage* page = GetPage(m_selPage);
        wxPropertyGridEvent* pgEvent = wxDynamicCast(&event, wxPropertyGridEvent);

        // Add property grid events to appropriate custom pages
        // but stop propagating to parent if page says it is
        // handling everything.
        if ( pgEvent && !page->m_isDefault )
        {
            /*if ( pgEvent->IsPending() )
                page->AddPendingEvent(event);
            else*/
                page->ProcessEvent(event);

            if ( page->IsHandlingAllEvents() )
                event.StopPropagation();
        }
    }

    return wxPanel::ProcessEvent(event);
}
Exemplo n.º 3
0
bool AudioView::ProcessEvent(wxEvent& event)
{
  if (event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED &&
      event.GetId() >= FirstEffectID &&
      event.GetId() < FirstEffectID + numEffects) {
    Effect *f = Effect::GetEffect(event.GetId() - FirstEffectID);

    TrackList *tracks = GetTracks();
    VTrack *t = tracks->First();
    
    while(t) {
      if (t->selected && t->GetKind() == (VTrack::Wave)) {
	f->DoInPlaceEffect((WaveTrack *)t, sel0, sel1);
      }
      
      t = tracks->Next();
    }
    
    PushState();
    
    FixScrollbars();
    REDRAW(trackPanel);
    REDRAW(rulerPanel);
    
    // This indicates we handled the event.
    return true;
  }
  
  return wxView::ProcessEvent(event);
}
Exemplo n.º 4
0
bool wxContextHelpEvtHandler::ProcessEvent(wxEvent& event)
{
    if (event.GetEventType() == wxEVT_LEFT_DOWN)
    {
        m_contextHelp->SetStatus(true);
        m_contextHelp->EndContextHelp();
        return true;
    }

    if ((event.GetEventType() == wxEVT_CHAR) ||
        (event.GetEventType() == wxEVT_KEY_DOWN) ||
        (event.GetEventType() == wxEVT_ACTIVATE) ||
        (event.GetEventType() == wxEVT_MOUSE_CAPTURE_CHANGED))
    {
        // May have already been set to true by a left-click
        //m_contextHelp->SetStatus(false);
        m_contextHelp->EndContextHelp();
        return true;
    }

    if ((event.GetEventType() == wxEVT_PAINT) ||
        (event.GetEventType() == wxEVT_ERASE_BACKGROUND))
    {
        event.Skip();
        return false;
    }

    return true;
}
Exemplo n.º 5
0
void ClangPlugin::OnClangSyncTaskFinished( wxEvent& event )
{
#ifdef CLANGPLUGIN_TRACE_FUNCTIONS
    //fprintf(stdout,"%s\n", __PRETTY_FUNCTION__);
#endif
    ClangProxy::SyncJob* pJob = static_cast<ClangProxy::SyncJob*>(event.GetEventObject());

    if (event.GetId() == idClangCodeCompleteTask)
    {
        ClangProxy::CodeCompleteAtJob* pCCJob = dynamic_cast<ClangProxy::CodeCompleteAtJob*>(pJob);
        ClangEvent evt( clEVT_GETCODECOMPLETE_FINISHED, pCCJob->GetTranslationUnitId(), pCCJob->GetFilename(), pCCJob->GetLocation(), pCCJob->GetResults());
        ProcessEvent(evt);
        if ( HasEventSink(clEVT_DIAGNOSTICS_UPDATED) )
        {
            ClangEvent evt( clEVT_DIAGNOSTICS_UPDATED, pCCJob->GetTranslationUnitId(), pCCJob->GetFilename(), pCCJob->GetLocation(), pCCJob->GetDiagnostics());
            ProcessEvent(evt);
        }
    }
    else if (event.GetId() == idClangGetOccurrencesTask)
    {
        ClangProxy::GetOccurrencesOfJob* pOCJob = dynamic_cast<ClangProxy::GetOccurrencesOfJob*>(pJob);
        ClangEvent evt( clEVT_GETOCCURRENCES_FINISHED, pOCJob->GetTranslationUnitId(), pOCJob->GetFilename(), pOCJob->GetLocation(), pOCJob->GetResults());
        ProcessEvent(evt);
    }
    else if (event.GetId() == idClangGetCCDocumentationTask)
    {
        ClangProxy::DocumentCCTokenJob* pCCDocJob = dynamic_cast<ClangProxy::DocumentCCTokenJob*>(pJob);
        ClangEvent evt( clEVT_GETOCCURRENCES_FINISHED, pCCDocJob->GetTranslationUnitId(), pCCDocJob->GetFilename(), pCCDocJob->GetLocation(), pCCDocJob->GetResult());
        ProcessEvent(evt);
    }

    pJob->Finalize();
}
Exemplo n.º 6
0
bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event)
{
    // stops the same event being processed repeatedly
    if (m_pLastEvt == &event)
        return false;
    m_pLastEvt = &event;

    // let the active child (if any) process the event first.
    bool res = false;
    if (m_pActiveChild &&
            event.IsCommandEvent() &&
            event.GetEventObject() != m_pClientWindow &&
            !(event.GetEventType() == wxEVT_ACTIVATE ||
              event.GetEventType() == wxEVT_SET_FOCUS ||
              event.GetEventType() == wxEVT_KILL_FOCUS ||
              event.GetEventType() == wxEVT_CHILD_FOCUS ||
              event.GetEventType() == wxEVT_COMMAND_SET_FOCUS ||
              event.GetEventType() == wxEVT_COMMAND_KILL_FOCUS )
       )
    {
        res = m_pActiveChild->GetEventHandler()->ProcessEvent(event);
    }

    if (!res)
    {
        // if the event was not handled this frame will handle it,
        // which is why we need the protection code at the beginning
        // of this method
        res = wxEvtHandler::ProcessEvent(event);
    }

    m_pLastEvt = NULL;

    return res;
}
Exemplo n.º 7
0
wxLongLong EventDispatcher::PlatformGetEventTimestamp(const wxEvent &event) {
    // XXX - We need to cast to a DWORD first, because the Win32 API (and
    // wxWidgets) treat the return value of GetMessageTime as a 'LONG'
    // instead of a 'DWORD'.
    ASSERT(event.GetTimestamp() == ::GetMessageTime());
    return (wxLongLong) ((DWORD) event.GetTimestamp());
}
Exemplo n.º 8
0
void wxTestableFrame::OnEvent(wxEvent& evt)
{
    m_count[evt.GetEventType()]++;

    if(! evt.IsCommandEvent() )
        evt.Skip();
}
Exemplo n.º 9
0
 void OnTestEvent(wxEvent& evt)
 {
     if ( evt.GetEventObject() == gs_psrc1 )
         gs_value += 1;
     else if ( evt.GetEventObject() == gs_psrc2 )
         gs_value += 0x10000;
 }
Exemplo n.º 10
0
	virtual bool OnEvent(wxPropertyGrid* propGrid,
		wxPGProperty* prop,
		wxWindow* ctrl,
		wxEvent& evt) const override
	{
		if (evt.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED)
		{
			wxPGMultiButton* buttons = (wxPGMultiButton*)propGrid->GetEditorControlSecondary();

			if (evt.GetId() == buttons->GetButtonId(0))
			{
				auto bprop = dynamic_cast<BtnProperty*>(prop);
				if (bprop && bprop->mFunc)
				{
					OnBtnFunc& f = bprop->mFunc;
					return f(prop);
				}
				return false;

				//auto it = mBtnPropMap.find(prop);
				//if (mBtnPropMap.end() != it)
				//	return (it->second) ? it->second(prop) : false;


			}//if (evt.GetId() == buttons->GetButtonId(0))
		}//if (evt.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED)
		return false;
		// всё что не выбрано кнопкой "..." не принимаем return wxPGTextCtrlEditor::OnEvent(propGrid, property, ctrl, event);	
	}
Exemplo n.º 11
0
void wxLuaEventCallback::OnAllEvents(wxEvent& event)
{
    wxEventType evtType = event.GetEventType();

    // Get the wxLuaEventCallback instance to use which is NOT "this" since
    // "this" is a central event handler function. i.e. this != theCallback
    wxLuaEventCallback *theCallback = (wxLuaEventCallback *)event.m_callbackUserData;
    wxCHECK_RET(theCallback != NULL, wxT("Invalid wxLuaEventCallback in wxEvent user data"));

    if (theCallback != NULL)
    {
        // Not an error if !Ok(), the wxLuaState is cleared during shutdown or after a destroy event.
        wxLuaState wxlState(theCallback->GetwxLuaState());
        if (wxlState.Ok())
        {
            wxlState.SetInEventType(evtType);
            theCallback->OnEvent(&event);
            wxlState.SetInEventType(wxEVT_NULL);
        }
    }

    // we want the wxLuaWinDestroyCallback to get this too
    if (evtType == wxEVT_DESTROY)
        event.Skip(true);
}
Exemplo n.º 12
0
void					SeqTrack::PropagateEvent(wxEvent &event)
{
  // set events propagationlevel to run down through the parents
  event.ResumePropagation(wxEVENT_PROPAGATE_MAX);

  // continue the event
  event.Skip();
}
Exemplo n.º 13
0
bool DoProcessEvent(wxEvent& event)
{
    if ( event.GetEventType() == TEST_EVT ||
            event.GetEventType() == wxEVT_MENU )
        g_str += 'A';

    return false;
}
Exemplo n.º 14
0
int DoFilterEvent(wxEvent& event)
{
    if ( event.GetEventType() == TEST_EVT ||
            event.GetEventType() == wxEVT_MENU )
        g_str += 'a';

    return -1;
}
Exemplo n.º 15
0
void Interactor2DVolumeEdit::UpdateCursor( wxEvent& event, wxWindow* wnd )
{
  if ( wnd->FindFocus() == wnd )
  {
    if ( event.IsKindOf( CLASSINFO( wxMouseEvent ) ) )
    {
      wxMouseEvent* e = ( wxMouseEvent* )&event;
      if ( ( ( e->MiddleDown() || e->RightDown() ) && !m_bEditing ) ||
           ( e->CmdDown() && e->ShiftDown() ) )
      {
        Interactor2D::UpdateCursor( event, wnd );
        return;
      }
    }

    if ( m_nAction != EM_Fill )
    {
      if ( event.IsKindOf( CLASSINFO( wxKeyEvent ) ) )
      {
        wxKeyEvent* e = ( wxKeyEvent* )&event;
        if ( e->GetEventType() != wxEVT_KEY_UP && ( e->GetKeyCode() == WXK_CONTROL && !e->ShiftDown() && !e->AltDown() ) )
        {
          wnd->SetCursor( CursorFactory::CursorFill );
          return;
        }
      }

      if ( event.IsKindOf( CLASSINFO( wxMouseEvent ) ) && (( wxMouseEvent* )&event)->CmdDown()
           && !(( wxMouseEvent* )&event)->ShiftDown() && !(( wxMouseEvent* )&event)->AltDown() )
      {
        wnd->SetCursor( CursorFactory::CursorFill );
      }
      else if ( m_nAction == EM_ColorPicker )
        wnd->SetCursor( CursorFactory::CursorColorPicker );
      else if ( event.IsKindOf( CLASSINFO( wxMouseEvent ) ) )
      {
        switch ( m_nAction )
        {
          case EM_Freehand:
            wnd->SetCursor( CursorFactory::CursorPencil );
            break;
          case EM_Polyline:
            wnd->SetCursor( CursorFactory::CursorPolyline );
            break;
          case EM_Contour:
            wnd->SetCursor( CursorFactory::CursorContour );
            break;
        }
      }
    }
    else 
      wnd->SetCursor( CursorFactory::CursorFill );
  }
  else
    Interactor2D::UpdateCursor( event, wnd );
}
Exemplo n.º 16
0
int InputEventFilter::FilterEvent(wxEvent& event)
{
  if (m_block && ShouldCatchEventType(event.GetEventType()))
  {
    event.StopPropagation();
    return Event_Processed;
  }

  return Event_Skip;
}
Exemplo n.º 17
0
bool wxRibbonPanel::ShouldSendEventToDummy(wxEvent& evt)
{
    // For an expanded panel, filter events between being sent up to the
    // floating top level window or to the dummy panel sitting in the ribbon
    // bar.

    // Child focus events should not be redirected, as the child would not be a
    // child of the window the event is redirected to. All other command events
    // seem to be suitable for redirecting.
    return evt.IsCommandEvent() && evt.GetEventType() != wxEVT_CHILD_FOCUS;
}
Exemplo n.º 18
0
// This is always the first to handle an event !
int MyApp::FilterEvent(wxEvent& event)
{
    if ( event.GetEventType() == wxEVT_BUTTON &&
            event.GetId() == MyEvtTestButton::BUTTON_ID )
    {
        wxLogMessage("Step 0 in \"How Events are Processed\":\n"
                     "App::FilterEvent");
    }

    return wxApp::FilterEvent(event);
}
Exemplo n.º 19
0
int AButton::Listener::FilterEvent(wxEvent &event)
{
   if (event.GetEventType() == wxEVT_KEY_DOWN ||
       event.GetEventType() == wxEVT_KEY_UP)
      OnEvent();
   else if (event.GetEventType() == wxEVT_SET_FOCUS)
      // A modal dialog might have eaten the modifier key-up with its own
      // filter before we saw it; this is adequate to fix the button image
      // when the dialog disappears.
      OnEvent();
   return Event_Skip;
}
Exemplo n.º 20
0
// Extend event processing to call OnCommand
bool wxPropertyFormView::ProcessEvent(wxEvent& event)
{
    if (wxEvtHandler::ProcessEvent(event))
        return true;
    else if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxUpdateUIEvent)) && event.GetEventObject())
    {
        OnCommand(* ((wxWindow*) event.GetEventObject()), (wxCommandEvent&) event);
        return true;
    }
    else
        return false;
}
Exemplo n.º 21
0
    bool ProcessEvent(wxEvent& evt)
    {
        if (evt.GetEventType() == wxEVT_MENU)
        {
            m_lastId = evt.GetId();
            return true;
        }

        if (GetNextHandler())
            return GetNextHandler()->ProcessEvent(evt);

        return false;
    }
Exemplo n.º 22
0
    bool ProcessEvent(wxEvent& evt)
    {
        if (evt.GetEventType() == wxEVT_COMMAND_MENU_SELECTED)
        {
            m_last_id = evt.GetId();
            return true;
        }

        if (GetNextHandler())
            return GetNextHandler()->ProcessEvent(evt);

        return false;
    }
Exemplo n.º 23
0
// Prevent recursive entry of CMainDocument::RequestRPC()
int CBOINCGUIApp::FilterEvent(wxEvent &event) {
    int theEventType;
    wxDialog* theRPCWaitDialog;
    wxObject* theObject;

    if (!m_pDocument) return -1;

    theEventType = event.GetEventType();

    if (m_pDocument->WaitingForRPC()) {
        // If in RPC Please Wait dialog, reject all command 
        // and timer events except: 
        //  - RPC Finished
        //  - those for that dialog or its children
        //  - Open Manager menu item from system tray icon

        if ((theEventType == wxEVT_COMMAND_MENU_SELECTED) && (event.GetId() == wxID_OPEN)) {
            return -1;        
        }

        theRPCWaitDialog = m_pDocument->GetRPCWaitDialog();
        theObject = event.GetEventObject();
        while (theObject) {
            if (!theObject->IsKindOf(CLASSINFO(wxWindow))) break;
            if (theObject == theRPCWaitDialog) return -1;
            theObject = ((wxWindow*)theObject)->GetParent();
        }
        // Continue with rest of filtering below
    } else {
        // Do limited filtering if shutting down to allow RPC 
        // completion events but not events which start new RPCs
        if (!m_bFilterEvents) return -1;
    }

    // Allow all except Command, Timer and Mouse Moved events
    if (event.IsCommandEvent()) {
        return false;
    }
    
    if (theEventType == wxEVT_TIMER) {
        return false;
    }
    
#ifdef __WXMSW__
    if (theEventType == wxEVT_TASKBAR_MOVE) {
        return false;
    }
#endif
   
    return -1;
}
Exemplo n.º 24
0
void Interactor3DMeasure::UpdateCursor( wxEvent& event, wxWindow* wnd )
{
  if ( event.IsKindOf( CLASSINFO( wxMouseEvent ) ) )
  {
    wxMouseEvent* e = ( wxMouseEvent* )&event;
    if ( !e->RightDown() && !e->MiddleDown() )
    {
      if ( e->CmdDown() && !e->ShiftDown() )
      {
        wnd->SetCursor( CursorFactory::CursorContour );
        return;
      }
      else if ( e->CmdDown() && e->ShiftDown() )
      {
        wnd->SetCursor( CursorFactory::CursorAdd );
        return;
      }
      else if ( !e->CmdDown() && e->ShiftDown() )
      {
        wnd->SetCursor( CursorFactory::CursorRemove );
        return;
      }
    }
  }
  else if ( event.IsKindOf( CLASSINFO( wxKeyEvent ) ) )
  {
    wxKeyEvent* e = ( wxKeyEvent* )&event;
    if ( e->GetEventType() != wxEVT_KEY_UP )
    {
      if ( e->GetKeyCode() == WXK_CONTROL && !e->ShiftDown() )
      {
        wnd->SetCursor( CursorFactory::CursorContour );
        return;
      }
      else if ( ( e->GetKeyCode() == WXK_CONTROL && e->ShiftDown() ) ||
                  ( e->GetKeyCode() == WXK_SHIFT && e->CmdDown() ) )
      {
        wnd->SetCursor( CursorFactory::CursorAdd );
        return;
      }
      else if ( e->GetKeyCode() == WXK_SHIFT && !e->CmdDown() )
      {
        wnd->SetCursor( CursorFactory::CursorRemove );
        return;
      }
    }
  }
  
  Interactor3D::UpdateCursor( event, wnd );
}
Exemplo n.º 25
0
// Extend event processing to search the view's event table
	bool MutApp::ProcessEvent(wxEvent& event)
	{
		bool retval =  wxApp::ProcessEvent(event);
#ifdef DEBUG
		if (!retval) {
			DEBUGLOG(eventqueue,
				 _T("Unhandled event %p, id=%d, type=%d"),
				 static_cast<void *>(&event),
				 (int)(event.GetId()),
				 (int)(event.GetEventType())
				);
		}
#endif
		return retval;
	}
Exemplo n.º 26
0
int CubicSDR::FilterEvent(wxEvent& event) {
    if (!appframe) {
        return -1;
    }

    if (event.GetEventType() == wxEVT_KEY_DOWN || event.GetEventType() == wxEVT_CHAR_HOOK) {
		return appframe->OnGlobalKeyDown((wxKeyEvent&)event);
    }
    
    if (event.GetEventType() == wxEVT_KEY_UP || event.GetEventType() == wxEVT_CHAR_HOOK) {
        return appframe->OnGlobalKeyUp((wxKeyEvent&)event);
    }
    
    return -1;  // process normally
}
Exemplo n.º 27
0
int mmGUIApp::FilterEvent(wxEvent &event)
{
    int ret = wxApp::FilterEvent(event);

    if (event.GetEventType() == wxEVT_SHOW)
    {
        wxWindow *win = (wxWindow*)event.GetEventObject();

        if (win && win->IsTopLevel() && win != this->m_frame) // wxDialog & wxFrame http://docs.wxwidgets.org/trunk/classwx_top_level_window.html
        {
            Model_Usage::instance().pageview(win);
        }
    }

    return ret;
}
Exemplo n.º 28
0
void ClangPlugin::OnClangReparseFinished( wxEvent& event )
{
//#ifdef CLANGPLUGIN_TRACE_FUNCTIONS
    fprintf(stdout,"%s\n", __PRETTY_FUNCTION__);
//#endif
    ClangProxy::ReparseJob* pJob = static_cast<ClangProxy::ReparseJob*>(event.GetEventObject());
    if ( HasEventSink(clEVT_DIAGNOSTICS_UPDATED ) )
    {
        ClangProxy::GetDiagnosticsJob job( cbEVT_CLANG_ASYNCTASK_FINISHED, idClangGetDiagnostics, pJob->GetTranslationUnitId(), pJob->GetFilename() );
        m_Proxy.AppendPendingJob(job);
    }
    ClangEvent evt( clEVT_REPARSE_FINISHED, pJob->GetTranslationUnitId(), pJob->GetFilename());
    ProcessEvent(evt);
#if 0
    if (pJob->m_TranslId != this->m_TranslUnitId)
    {
        std::cout<<" Reparse finished but another file was loaded"<<std::endl;
        return;
    }
    if (m_ReparseNeeded)
    {
        fprintf(stdout,"%s: Reparsing again, was modified while we were busy...\n", __PRETTY_FUNCTION__);
        wxCommandEvent evt(cbEVT_COMMAND_REPARSE, idReparse);
        AddPendingEvent(evt);
    }
    else
    {
        //m_DiagnosticTimer.Stop();
        //m_DiagnosticTimer.Start(DIAGNOSTIC_DELAY, wxTIMER_ONE_SHOT);
    }
#endif
}
Exemplo n.º 29
0
// This function is used for all events destined for Python event handlers.
void wxPyCallback::EventThunker(wxEvent& event) {
    wxPyCallback*   cb = (wxPyCallback*)event.m_callbackUserData;
    PyObject*       func = cb->m_func;
    PyObject*       result;
    PyObject*       arg;
    PyObject*       tuple;
    bool            checkSkip = false;

    wxPyThreadBlocker blocker;
    wxString className = event.GetClassInfo()->GetClassName();
    arg = wxPyConstructObject((void*)&event, className);
    
    if (!arg) {
        PyErr_Print();
    } else {
        // Call the event handler, passing the event object
        tuple = PyTuple_New(1);
        PyTuple_SET_ITEM(tuple, 0, arg);  // steals ref to arg
        result = PyEval_CallObject(func, tuple);
        if ( result ) {
            Py_DECREF(result);   // result is ignored, but we still need to decref it
            PyErr_Clear();       // Just in case...
        } else {
            PyErr_Print();
        }
        Py_DECREF(tuple);
    }
}
void EDA_DRAW_PANEL_GAL::onEnter( wxEvent& aEvent )
{
    // Getting focus is necessary in order to receive key events properly
    SetFocus();

    aEvent.Skip();
}