Esempio n. 1
0
void wxGenericDirCtrl::OnItemActivated(wxTreeEvent &event)
{
    wxTreeItemId treeid = event.GetItem();
    const wxDirItemData *data = GetItemData(treeid);

    if (data->m_isDir)
    {
        // is dir
        event.Skip();
    }
    else
    {
        // is file
        wxTreeEvent changedEvent(wxEVT_DIRCTRL_FILEACTIVATED, GetId());

        changedEvent.SetEventObject(this);
        changedEvent.SetItem(treeid);
        changedEvent.SetClientObject(m_treeCtrl->GetItemData(treeid));

        if (GetEventHandler()->SafelyProcessEvent(changedEvent) && !changedEvent.IsAllowed())
            event.Veto();
        else
            event.Skip();
    }
}
Esempio n. 2
0
void KstEventMonitorI::changedSelection() {
  int row;
  
  row = tableEvents->currentRow();
    
  changedEvent( row, 0 );
}
Esempio n. 3
0
void wxGenericDirCtrl::OnTreeSelChange(wxTreeEvent &event)
{
    wxTreeEvent changedEvent(wxEVT_DIRCTRL_SELECTIONCHANGED, GetId());

    changedEvent.SetEventObject(this);
    changedEvent.SetItem(event.GetItem());
    changedEvent.SetClientObject(m_treeCtrl->GetItemData(event.GetItem()));

    if (GetEventHandler()->SafelyProcessEvent(changedEvent) && !changedEvent.IsAllowed())
        event.Veto();
    else
        event.Skip();
}
Esempio n. 4
0
int clMultiBook::SetSelection(size_t tabIdx)
{
    Notebook* book;
    size_t bookIndex;
    size_t modIndex;
    if(GetBookByPageIndex(tabIdx, &book, bookIndex, modIndex)) {
        // Update the current selection
        bool pageChanged = (m_selection != (int)tabIdx);

        // Grab a pointer of the page we want to make active
        wxWindow* focusedPage = book->GetPage(modIndex);

        // And perform the actual selection change
        int oldSelection = book->GetSelection();
        if(oldSelection != (int)modIndex) {
            m_selection = tabIdx;
            m_history->Pop(focusedPage);
            m_history->Push(focusedPage);
            return book->SetSelection(modIndex);
        } else {
            // There is no point on calling Notebook::SetSelection since it is already selected
            // However, in the term of 'multi book' control, we might need to generate the events ourselves here
            // But only if we actually modified the selection
            if(pageChanged) {
                wxBookCtrlEvent changingEvent(wxEVT_BOOK_PAGE_CHANGING);
                changingEvent.SetEventObject(this);
                changingEvent.SetOldSelection(m_selection);
                changingEvent.SetSelection(tabIdx);
                GetEventHandler()->ProcessEvent(changingEvent);
                if(!changingEvent.IsAllowed()) { return wxNOT_FOUND; } // User vetoed
                
                // Update the history
                m_history->Pop(focusedPage);
                m_history->Push(focusedPage);
                
                // Update the selection before we fire the event again
                // Or we might end up with stackoverflow...
                m_selection = tabIdx;
                wxBookCtrlEvent changedEvent(wxEVT_BOOK_PAGE_CHANGED);
                changedEvent.SetEventObject(this);
                changedEvent.SetOldSelection(m_selection);
                changedEvent.SetSelection(tabIdx);
                GetEventHandler()->ProcessEvent(changedEvent);
            }
        }
    }
    return wxNOT_FOUND;
}