void ElementsCtrlBase::select_item( const ElementBase* const pel, bool select /*=true*/ ) { long idx = index_by_pointer(pel); if( idx == wxNOT_FOUND ) return; m_list->SetItemState(idx, (select ? wxLIST_STATE_SELECTED : 0), wxLIST_STATE_SELECTED); }
bool ElementsCtrlBase::update_item( const ElementBase* const pel ) { // look for item index long idx = index_by_pointer(pel); if( idx == wxNOT_FOUND ) return false; return update_item(idx, pel); }
void ElementsCtrlBase::OnInsertNotuniq( wxCommandEvent& ev ) { int idx = ev.GetId() - ID_INSERT_NOTUNIQ; if( m_selels.size() != 1 ) return; const notuniqs_type& notuniqs = wxGetApp().hudfile()->notuniq_elements(); ElementBase *el = wxGetApp().hudfile()->create_element_from_default( notuniqs[idx] ); wxGetApp().hudfile()->insert( m_selels.front(), el ); wxGetApp().mainframe()->update_elementsctrl(); long itemidx = index_by_pointer(el); m_list->EnsureVisible( itemidx ); select_item( itemidx ); }
int main (void) { opentest(OUTFILE); init_array(4); check_array(4); if(buff[achar0 + 7] != 4+7) failures++; dummy = buff[achar0]; if(dummy != 4) failures++; if(dummy != (buff[achar0+1] -1)) failures++; index_by_pointer(&dummy, 8); f1 (&achar0); f2 (&aint0); acharP = f3 (); if ((acharP == 0) || (*acharP)) failures++; achar0 = 42; if(*acharP != 42) failures++; achar0 = 5; f4(&achar0, achar0); success = failures; done (); fprintf(outfile,"failures: %d\n",failures); closetest(THISFILE); return (0); }
int main (void) { init_array(4); check_array(4); if(buff[achar0 + 7] != 4+7) failures++; dummy = buff[achar0]; if(dummy != 4) failures++; if(dummy != (buff[achar0+1] -1)) failures++; index_by_pointer(&dummy, 8); f1 (&achar0); f2 (&aint0); acharP = f3 (); if ((acharP == 0) || (*acharP)) failures++; achar0 = 42; if(*acharP != 42) failures++; achar0 = 5; f4(&achar0, achar0); success = failures; done (); printf("failures: %d\n",failures); return failures; }