/* * This adds a single item to a scrolling list, before the current item. */ void insertCDKScrollItem (CDKSCROLL *scrollp, const char *item) { int widestItem = WidestItem (scrollp); char *temp = 0; size_t have = 0; if (allocListArrays (scrollp, scrollp->listSize, scrollp->listSize + 1) && insertListItem (scrollp, scrollp->currentItem) && allocListItem (scrollp, scrollp->currentItem, &temp, &have, scrollp->numbers ? (scrollp->currentItem + 1) : 0, item)) { /* Determine the size of the widest item. */ widestItem = MAXIMUM (scrollp->itemLen[scrollp->currentItem], widestItem); updateViewWidth (scrollp, widestItem); setViewSize (scrollp, scrollp->listSize + 1); resequence (scrollp); } freeChecked (temp); }
/* SwitchesEntryPanel::populateEntryList * Clears and adds all entries to the entry list *******************************************************************/ void SwitchesEntryPanel::populateEntryList() { // Clear current list list_entries->ClearAll(); // Add columns list_entries->InsertColumn(0, "Off Texture"); list_entries->InsertColumn(1, "On Texture"); list_entries->InsertColumn(2, "Range"); // Add each switch to the list list_entries->enableSizeUpdate(false); for (uint32_t a = 0; a < switches.nEntries(); a++) { insertListItem(switches.getEntry(a), a); } // Update list width list_entries->enableSizeUpdate(true); list_entries->updateSize(); }
/* AnimatedEntryPanel::populateEntryList * Clears and adds all entries to the entry list *******************************************************************/ void AnimatedEntryPanel::populateEntryList() { // Clear current list list_entries->ClearAll(); // Add columns list_entries->InsertColumn(0, "Type"); list_entries->InsertColumn(1, "First frame"); list_entries->InsertColumn(2, "Last frame"); list_entries->InsertColumn(3, "Speed"); list_entries->InsertColumn(4, "Decals"); // Add each animation to the list list_entries->enableSizeUpdate(false); for (uint32_t a = 0; a < animated.nEntries(); a++) insertListItem(animated.getEntry(a), a); // Update list width list_entries->enableSizeUpdate(true); list_entries->updateSize(); }
/* SwitchesEntryPanel::add * Insert new switch after selected switches *******************************************************************/ void SwitchesEntryPanel::add() { // Get selected switch wxArrayInt selection = list_entries->selectedItems(); uint32_t index = list_entries->GetItemCount(); if (selection.size() > 0) index = selection[selection.size() - 1] + 1; // Create new switch switches_t swch = { "????????", "????????", SWCH_DEMO }; SwitchesEntry* se = new SwitchesEntry(swch); se->setStatus(LV_STATUS_NEW); // Insert it in list list_entries->enableSizeUpdate(false); switches.addEntry(se, index); insertListItem(se, index); list_entries->enableSizeUpdate(true); list_entries->EnsureVisible(index); // Update variables setModified(true); }
/* AnimatedEntryPanel::add * Insert new animation after selected animations *******************************************************************/ void AnimatedEntryPanel::add() { // Get selected animations wxArrayInt selection = list_entries->selectedItems(); uint32_t index = list_entries->GetItemCount(); if (selection.size() > 0) index = selection[selection.size() - 1] + 1; // Create new animation animated_t anim = { 0, "????????", "????????", 8 }; AnimatedEntry* ae = new AnimatedEntry(anim); ae->setStatus(LV_STATUS_NEW); // Insert it in list list_entries->enableSizeUpdate(false); animated.addEntry(ae, index); insertListItem(ae, index); list_entries->enableSizeUpdate(true); list_entries->EnsureVisible(index); // Update variables setModified(true); }
int main(void){ EList list; initList(&list); setListSize(&list,200); insertListItem(&list,"f6","zero", "dir"); // printList(list); // printf("size: %d\n", list.size); //printf("\n"); insertListItem(&list,"f7","one", "dir"); insertListItem(&list,"f7","one", "dir"); insertListItem(&list,"f7","two","dir"); insertListItem(&list,"a8","two", "dir"); insertListItem(&list,"a8","three", "dir"); insertListItem(&list,"a8","four", "dir"); insertListItem(&list,"a8","five", "dir"); insertListItem(&list,"a8","six", "dir"); insertListItem(&list,"a8","seven", "dir"); insertListItem(&list,"a8","eight", "dir"); insertListItem(&list,"a8","nine", "dir"); insertListItem(&list,"a8","ten", "dir"); insertListItem(&list,"a8","eleven", "dir"); insertListItem(&list,"a8","twelve", "dir"); insertListItem(&list,"a8","thirteen", "dir"); insertListItem(&list,"a8","fourteen", "dir"); insertListItem(&list,"a8","fifteen", "dir"); insertListItem(&list,"a8","sixteen", "dir"); int x=0; for(;x<list.item_count;x++){ printSL(list,x); } printf("item_count: %d %d\n", list.item_count, list.size); printf("\n"); printList(list); return 0; }