mirror of https://gitlab.com/nakst/essence
remove ES_LIST_VIEW_NON_LINEAR
This commit is contained in:
parent
7e65dafaa9
commit
2b5e5f53a0
|
@ -284,7 +284,7 @@ void BookmarkAdd(String path, bool saveConfiguration = true) {
|
||||||
if (saveConfiguration) ConfigurationSave();
|
if (saveConfiguration) ConfigurationSave();
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
||||||
EsListViewInsert(instances[i]->placesView, PLACES_VIEW_GROUP_BOOKMARKS, bookmarks.Length(), bookmarks.Length());
|
EsListViewInsert(instances[i]->placesView, PLACES_VIEW_GROUP_BOOKMARKS, bookmarks.Length(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ void BookmarkRemove(String path) {
|
||||||
bookmarks.Delete(i);
|
bookmarks.Delete(i);
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
||||||
EsListViewRemove(instances[i]->placesView, PLACES_VIEW_GROUP_BOOKMARKS, i + 1, i + 1);
|
EsListViewRemove(instances[i]->placesView, PLACES_VIEW_GROUP_BOOKMARKS, i + 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationSave();
|
ConfigurationSave();
|
||||||
|
|
|
@ -420,7 +420,7 @@ void DriveRemove(const char *prefix, size_t prefixBytes) {
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
||||||
EsListViewRemove(instances[i]->placesView, PLACES_VIEW_GROUP_DRIVES, index, index);
|
EsListViewRemove(instances[i]->placesView, PLACES_VIEW_GROUP_DRIVES, index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -457,7 +457,7 @@ void DriveAdd(const char *prefix, size_t prefixBytes) {
|
||||||
drives.Add(drive);
|
drives.Add(drive);
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
for (uintptr_t i = 0; i < instances.Length(); i++) {
|
||||||
EsListViewInsert(instances[i]->placesView, PLACES_VIEW_GROUP_DRIVES, drives.Length(), drives.Length());
|
EsListViewInsert(instances[i]->placesView, PLACES_VIEW_GROUP_DRIVES, drives.Length(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
EsMutexRelease(&drivesMutex);
|
EsMutexRelease(&drivesMutex);
|
||||||
|
|
|
@ -60,10 +60,10 @@ bool InstanceLoadFolder(Instance *instance, String path /* takes ownership */, i
|
||||||
HistoryEntry historyEntry = {};
|
HistoryEntry historyEntry = {};
|
||||||
historyEntry.path = instance->path;
|
historyEntry.path = instance->path;
|
||||||
|
|
||||||
EsGeneric focusedIndex;
|
EsListViewIndex focusedIndex;
|
||||||
|
|
||||||
if (EsListViewGetFocusedItem(instance->list, nullptr, &focusedIndex)) {
|
if (EsListViewGetFocusedItem(instance->list, nullptr, &focusedIndex)) {
|
||||||
String name = instance->listContents[focusedIndex.u].entry->GetName();
|
String name = instance->listContents[focusedIndex].entry->GetName();
|
||||||
historyEntry.focusedItem = StringDuplicate(name);
|
historyEntry.focusedItem = StringDuplicate(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ void InstanceAddSingle(Instance *instance, ListEntry entry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
instance->listContents.Insert(entry, low);
|
instance->listContents.Insert(entry, low);
|
||||||
EsListViewInsert(instance->list, 0, low, low);
|
EsListViewInsert(instance->list, 0, low, 1);
|
||||||
|
|
||||||
if (entry.selected) {
|
if (entry.selected) {
|
||||||
EsListViewSelect(instance->list, 0, low);
|
EsListViewSelect(instance->list, 0, low);
|
||||||
|
@ -344,13 +344,13 @@ void InstanceAddContents(Instance *instance, HashTable *newEntries) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldListEntryCount) {
|
if (oldListEntryCount) {
|
||||||
EsListViewRemove(instance->list, 0, 0, oldListEntryCount - 1);
|
EsListViewRemove(instance->list, 0, 0, oldListEntryCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceSortListContents(instance->listContents.array, instance->listContents.Length(), instance->viewSettings.sortColumn);
|
InstanceSortListContents(instance->listContents.array, instance->listContents.Length(), instance->viewSettings.sortColumn);
|
||||||
|
|
||||||
if (instance->listContents.Length()) {
|
if (instance->listContents.Length()) {
|
||||||
EsListViewInsert(instance->list, 0, 0, instance->listContents.Length() - 1);
|
EsListViewInsert(instance->list, 0, 0, instance->listContents.Length());
|
||||||
|
|
||||||
if (instance->delayedFocusItem.bytes) {
|
if (instance->delayedFocusItem.bytes) {
|
||||||
for (uintptr_t i = 0; i < instance->listContents.Length(); i++) {
|
for (uintptr_t i = 0; i < instance->listContents.Length(); i++) {
|
||||||
|
@ -378,7 +378,7 @@ ListEntry InstanceRemoveSingle(Instance *instance, FolderEntry *folderEntry) {
|
||||||
if (compare == 0) {
|
if (compare == 0) {
|
||||||
ListEntry entry = instance->listContents[middle];
|
ListEntry entry = instance->listContents[middle];
|
||||||
InstanceRemoveInternal(instance, &entry);
|
InstanceRemoveInternal(instance, &entry);
|
||||||
EsListViewRemove(instance->list, 0, middle, middle);
|
EsListViewRemove(instance->list, 0, middle, 1);
|
||||||
instance->listContents.Delete(middle);
|
instance->listContents.Delete(middle);
|
||||||
InstanceUpdateStatusString(instance);
|
InstanceUpdateStatusString(instance);
|
||||||
return entry;
|
return entry;
|
||||||
|
@ -401,7 +401,7 @@ void InstanceRemoveContents(Instance *instance) {
|
||||||
EsAssert(instance->selectedItemCount == 0); // After removing all items none should be selected.
|
EsAssert(instance->selectedItemCount == 0); // After removing all items none should be selected.
|
||||||
|
|
||||||
if (instance->listContents.Length()) {
|
if (instance->listContents.Length()) {
|
||||||
EsListViewRemove(instance->list, 0, 0, instance->listContents.Length() - 1);
|
EsListViewRemove(instance->list, 0, 0, instance->listContents.Length());
|
||||||
EsListViewContentChanged(instance->list);
|
EsListViewContentChanged(instance->list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +609,7 @@ void ListItemGenerateThumbnailTaskComplete(Instance *, Task *task) {
|
||||||
|
|
||||||
Thumbnail *ListItemGetThumbnail(EsElement *element) {
|
Thumbnail *ListItemGetThumbnail(EsElement *element) {
|
||||||
Instance *instance = element->instance;
|
Instance *instance = element->instance;
|
||||||
ListEntry *entry = &instance->listContents[EsListViewGetIndexFromItem(element).u];
|
ListEntry *entry = &instance->listContents[EsListViewGetIndexFromItem(element)];
|
||||||
Thumbnail *thumbnail = thumbnailCache.Get(&entry->entry->id);
|
Thumbnail *thumbnail = thumbnailCache.Get(&entry->entry->id);
|
||||||
return thumbnail;
|
return thumbnail;
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ int ListCallback(EsElement *element, EsMessage *message) {
|
||||||
Instance *instance = element->instance;
|
Instance *instance = element->instance;
|
||||||
|
|
||||||
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
||||||
int column = message->getContent.column, index = message->getContent.index.i;
|
int column = message->getContent.column, index = message->getContent.index;
|
||||||
EsAssert(index < (int) instance->listContents.Length() && index >= 0);
|
EsAssert(index < (int) instance->listContents.Length() && index >= 0);
|
||||||
ListEntry *listEntry = &instance->listContents[index];
|
ListEntry *listEntry = &instance->listContents[index];
|
||||||
FolderEntry *entry = listEntry->entry;
|
FolderEntry *entry = listEntry->entry;
|
||||||
|
@ -704,7 +704,7 @@ int ListCallback(EsElement *element, EsMessage *message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_GET_SUMMARY) {
|
} else if (message->type == ES_MSG_LIST_VIEW_GET_SUMMARY) {
|
||||||
int index = message->getContent.index.i;
|
int index = message->getContent.index;
|
||||||
EsAssert(index < (int) instance->listContents.Length() && index >= 0);
|
EsAssert(index < (int) instance->listContents.Length() && index >= 0);
|
||||||
ListEntry *listEntry = &instance->listContents[index];
|
ListEntry *listEntry = &instance->listContents[index];
|
||||||
FolderEntry *entry = listEntry->entry;
|
FolderEntry *entry = listEntry->entry;
|
||||||
|
@ -714,7 +714,7 @@ int ListCallback(EsElement *element, EsMessage *message) {
|
||||||
message->getContent.icon = fileType->iconID;
|
message->getContent.icon = fileType->iconID;
|
||||||
message->getContent.richText = true;
|
message->getContent.richText = true;
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_SELECT_RANGE) {
|
} else if (message->type == ES_MSG_LIST_VIEW_SELECT_RANGE) {
|
||||||
for (intptr_t i = message->selectRange.fromIndex.i; i <= message->selectRange.toIndex.i; i++) {
|
for (intptr_t i = message->selectRange.fromIndex; i <= message->selectRange.toIndex; i++) {
|
||||||
ListEntry *entry = &instance->listContents[i];
|
ListEntry *entry = &instance->listContents[i];
|
||||||
if (entry->selected) { instance->selectedItemCount--; instance->selectedItemsTotalSize -= entry->entry->size; }
|
if (entry->selected) { instance->selectedItemCount--; instance->selectedItemsTotalSize -= entry->entry->size; }
|
||||||
entry->selected = message->selectRange.toggle ? !entry->selected : message->selectRange.select;
|
entry->selected = message->selectRange.toggle ? !entry->selected : message->selectRange.select;
|
||||||
|
@ -725,7 +725,7 @@ int ListCallback(EsElement *element, EsMessage *message) {
|
||||||
StringDestroy(&instance->delayedFocusItem);
|
StringDestroy(&instance->delayedFocusItem);
|
||||||
InstanceUpdateStatusString(instance);
|
InstanceUpdateStatusString(instance);
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_SELECT) {
|
} else if (message->type == ES_MSG_LIST_VIEW_SELECT) {
|
||||||
ListEntry *entry = &instance->listContents[message->selectItem.index.i];
|
ListEntry *entry = &instance->listContents[message->selectItem.index];
|
||||||
if (entry->selected) { instance->selectedItemCount--; instance->selectedItemsTotalSize -= entry->entry->size; }
|
if (entry->selected) { instance->selectedItemCount--; instance->selectedItemsTotalSize -= entry->entry->size; }
|
||||||
entry->selected = message->selectItem.isSelected;
|
entry->selected = message->selectItem.isSelected;
|
||||||
if (entry->selected) { instance->selectedItemCount++; instance->selectedItemsTotalSize += entry->entry->size; }
|
if (entry->selected) { instance->selectedItemCount++; instance->selectedItemsTotalSize += entry->entry->size; }
|
||||||
|
@ -733,10 +733,10 @@ int ListCallback(EsElement *element, EsMessage *message) {
|
||||||
StringDestroy(&instance->delayedFocusItem);
|
StringDestroy(&instance->delayedFocusItem);
|
||||||
InstanceUpdateStatusString(instance);
|
InstanceUpdateStatusString(instance);
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
||||||
ListEntry *entry = &instance->listContents[message->selectItem.index.i];
|
ListEntry *entry = &instance->listContents[message->selectItem.index];
|
||||||
message->selectItem.isSelected = entry->selected;
|
message->selectItem.isSelected = entry->selected;
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_CHOOSE_ITEM) {
|
} else if (message->type == ES_MSG_LIST_VIEW_CHOOSE_ITEM) {
|
||||||
ListEntry *listEntry = &instance->listContents[message->chooseItem.index.i];
|
ListEntry *listEntry = &instance->listContents[message->chooseItem.index];
|
||||||
|
|
||||||
if (listEntry) {
|
if (listEntry) {
|
||||||
FolderEntry *entry = listEntry->entry;
|
FolderEntry *entry = listEntry->entry;
|
||||||
|
@ -777,7 +777,7 @@ int ListCallback(EsElement *element, EsMessage *message) {
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_CREATE_ITEM) {
|
} else if (message->type == ES_MSG_LIST_VIEW_CREATE_ITEM) {
|
||||||
EsElement *element = message->createItem.item;
|
EsElement *element = message->createItem.item;
|
||||||
element->messageUser = ListItemMessage;
|
element->messageUser = ListItemMessage;
|
||||||
ListItemCreated(element, message->createItem.index.u, false);
|
ListItemCreated(element, message->createItem.index, false);
|
||||||
} else if (message->type == ES_MSG_MOUSE_RIGHT_CLICK) {
|
} else if (message->type == ES_MSG_MOUSE_RIGHT_CLICK) {
|
||||||
EsMenu *menu = EsMenuCreate(element, ES_MENU_AT_CURSOR);
|
EsMenu *menu = EsMenuCreate(element, ES_MENU_AT_CURSOR);
|
||||||
|
|
||||||
|
@ -826,7 +826,7 @@ int PlacesViewCallback(EsElement *element, EsMessage *message) {
|
||||||
|
|
||||||
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
||||||
int group = message->getContent.group;
|
int group = message->getContent.group;
|
||||||
int index = message->getContent.index.i;
|
int index = message->getContent.index;
|
||||||
|
|
||||||
if (group == PLACES_VIEW_GROUP_DRIVES) {
|
if (group == PLACES_VIEW_GROUP_DRIVES) {
|
||||||
// TODO Use namespace lookup.
|
// TODO Use namespace lookup.
|
||||||
|
@ -851,33 +851,33 @@ int PlacesViewCallback(EsElement *element, EsMessage *message) {
|
||||||
}
|
}
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_SELECT && message->selectItem.isSelected) {
|
} else if (message->type == ES_MSG_LIST_VIEW_SELECT && message->selectItem.isSelected) {
|
||||||
if (message->selectItem.group == PLACES_VIEW_GROUP_DRIVES) {
|
if (message->selectItem.group == PLACES_VIEW_GROUP_DRIVES) {
|
||||||
if (message->selectItem.index.i == 0) {
|
if (message->selectItem.index == 0) {
|
||||||
InstanceLoadFolder(instance, StringAllocateAndFormat("%z", interfaceString_FileManagerDrivesPage), LOAD_FOLDER_NO_FOCUS);
|
InstanceLoadFolder(instance, StringAllocateAndFormat("%z", interfaceString_FileManagerDrivesPage), LOAD_FOLDER_NO_FOCUS);
|
||||||
} else {
|
} else {
|
||||||
Drive *drive = &drives[message->selectItem.index.i - 1];
|
Drive *drive = &drives[message->selectItem.index - 1];
|
||||||
InstanceLoadFolder(instance, StringAllocateAndFormat("%s/", drive->prefixBytes, drive->prefix), LOAD_FOLDER_NO_FOCUS);
|
InstanceLoadFolder(instance, StringAllocateAndFormat("%s/", drive->prefixBytes, drive->prefix), LOAD_FOLDER_NO_FOCUS);
|
||||||
}
|
}
|
||||||
} else if (message->selectItem.group == PLACES_VIEW_GROUP_BOOKMARKS && message->selectItem.index.i) {
|
} else if (message->selectItem.group == PLACES_VIEW_GROUP_BOOKMARKS && message->selectItem.index) {
|
||||||
String string = bookmarks[message->selectItem.index.i - 1];
|
String string = bookmarks[message->selectItem.index - 1];
|
||||||
InstanceLoadFolder(instance, StringAllocateAndFormat("%s", STRFMT(string)), LOAD_FOLDER_NO_FOCUS);
|
InstanceLoadFolder(instance, StringAllocateAndFormat("%s", STRFMT(string)), LOAD_FOLDER_NO_FOCUS);
|
||||||
}
|
}
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
||||||
if (message->selectItem.group == PLACES_VIEW_GROUP_DRIVES) {
|
if (message->selectItem.group == PLACES_VIEW_GROUP_DRIVES) {
|
||||||
if (message->selectItem.index.i == 0) {
|
if (message->selectItem.index == 0) {
|
||||||
message->selectItem.isSelected = 0 == EsStringCompareRaw(INTERFACE_STRING(FileManagerDrivesPage),
|
message->selectItem.isSelected = 0 == EsStringCompareRaw(INTERFACE_STRING(FileManagerDrivesPage),
|
||||||
instance->path.text, instance->path.bytes);
|
instance->path.text, instance->path.bytes);
|
||||||
} else {
|
} else {
|
||||||
Drive *drive = &drives[message->selectItem.index.i - 1];
|
Drive *drive = &drives[message->selectItem.index - 1];
|
||||||
message->selectItem.isSelected = 0 == EsStringCompareRaw(drive->prefix, drive->prefixBytes,
|
message->selectItem.isSelected = 0 == EsStringCompareRaw(drive->prefix, drive->prefixBytes,
|
||||||
instance->path.text, instance->path.bytes - 1);
|
instance->path.text, instance->path.bytes - 1);
|
||||||
}
|
}
|
||||||
} else if (message->selectItem.group == PLACES_VIEW_GROUP_BOOKMARKS && message->selectItem.index.i) {
|
} else if (message->selectItem.group == PLACES_VIEW_GROUP_BOOKMARKS && message->selectItem.index) {
|
||||||
String string = bookmarks[message->selectItem.index.i - 1];
|
String string = bookmarks[message->selectItem.index - 1];
|
||||||
message->selectItem.isSelected = 0 == EsStringCompareRaw(string.text, string.bytes,
|
message->selectItem.isSelected = 0 == EsStringCompareRaw(string.text, string.bytes,
|
||||||
instance->path.text, instance->path.bytes);
|
instance->path.text, instance->path.bytes);
|
||||||
}
|
}
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_CONTEXT_MENU) {
|
} else if (message->type == ES_MSG_LIST_VIEW_CONTEXT_MENU) {
|
||||||
if (message->selectItem.group == PLACES_VIEW_GROUP_BOOKMARKS && !message->selectItem.index.i) {
|
if (message->selectItem.group == PLACES_VIEW_GROUP_BOOKMARKS && !message->selectItem.index) {
|
||||||
bool isCurrentFolderBookmarked = false;
|
bool isCurrentFolderBookmarked = false;
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < bookmarks.Length(); i++) {
|
for (uintptr_t i = 0; i < bookmarks.Length(); i++) {
|
||||||
|
|
|
@ -153,7 +153,7 @@ int FontListMessage(EsElement *element, EsMessage *message) {
|
||||||
|
|
||||||
if (message->type == ES_MSG_LIST_VIEW_CREATE_ITEM) {
|
if (message->type == ES_MSG_LIST_VIEW_CREATE_ITEM) {
|
||||||
EsPanel *panel = EsPanelCreate(message->createItem.item, ES_CELL_FILL, &styleFontInformationPanel);
|
EsPanel *panel = EsPanelCreate(message->createItem.item, ES_CELL_FILL, &styleFontInformationPanel);
|
||||||
EsFontInformation *font = &instance->fonts[message->createItem.index.u];
|
EsFontInformation *font = &instance->fonts[message->createItem.index];
|
||||||
|
|
||||||
EsPanel *row = EsPanelCreate(panel, ES_CELL_H_FILL | ES_PANEL_HORIZONTAL, &styleFontInformationRow);
|
EsPanel *row = EsPanelCreate(panel, ES_CELL_H_FILL | ES_PANEL_HORIZONTAL, &styleFontInformationRow);
|
||||||
// EsIconDisplayCreate(row, ES_FLAGS_DEFAULT, ES_STYLE_ICON_DISPLAY_SMALL, ES_ICON_FONT_X_GENERIC);
|
// EsIconDisplayCreate(row, ES_FLAGS_DEFAULT, ES_STYLE_ICON_DISPLAY_SMALL, ES_ICON_FONT_X_GENERIC);
|
||||||
|
@ -285,7 +285,7 @@ void LoadFontsFromDatabase(Instance *instance) {
|
||||||
return EsStringCompareRaw(fontLeft->name, fontLeft->nameBytes, fontRight->name, fontRight->nameBytes);
|
return EsStringCompareRaw(fontLeft->name, fontLeft->nameBytes, fontRight->name, fontRight->nameBytes);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
EsListViewInsert(instance->fontList, 0, 0, instance->fonts.Length() - 1);
|
EsListViewInsert(instance->fontList, 0, 0, instance->fonts.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackCommand(Instance *instance, EsElement *, EsCommand *) {
|
void BackCommand(Instance *instance, EsElement *, EsCommand *) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ void UpdateProcesses(Instance *instance) {
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < previous.Length(); i++) {
|
for (uintptr_t i = 0; i < previous.Length(); i++) {
|
||||||
if (!FindProcessByPID(processes, previous[i].data.pid)) {
|
if (!FindProcessByPID(processes, previous[i].data.pid)) {
|
||||||
EsListViewRemove(instance->listViewProcesses, 0, i, i);
|
EsListViewRemove(instance->listViewProcesses, 0, i, 1);
|
||||||
previous.Delete(i--);
|
previous.Delete(i--);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ void UpdateProcesses(Instance *instance) {
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < processes.Length(); i++) {
|
for (uintptr_t i = 0; i < processes.Length(); i++) {
|
||||||
if (!FindProcessByPID(previous, processes[i].data.pid)) {
|
if (!FindProcessByPID(previous, processes[i].data.pid)) {
|
||||||
EsListViewInsert(instance->listViewProcesses, 0, i, i);
|
EsListViewInsert(instance->listViewProcesses, 0, i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ void UpdateDisplay(Instance *instance, int index) {
|
||||||
} else if (index == DISPLAY_PCI_DEVICES) {
|
} else if (index == DISPLAY_PCI_DEVICES) {
|
||||||
size_t count = EsSyscall(ES_SYSCALL_DEBUG_COMMAND, index, (uintptr_t) pciDevices, sizeof(pciDevices) / sizeof(pciDevices[0]), 0);
|
size_t count = EsSyscall(ES_SYSCALL_DEBUG_COMMAND, index, (uintptr_t) pciDevices, sizeof(pciDevices) / sizeof(pciDevices[0]), 0);
|
||||||
EsListViewRemoveAll(instance->listViewPCIDevices, 0);
|
EsListViewRemoveAll(instance->listViewPCIDevices, 0);
|
||||||
EsListViewInsert(instance->listViewPCIDevices, 0, 0, count - 1);
|
EsListViewInsert(instance->listViewPCIDevices, 0, 0, count);
|
||||||
EsPanelSwitchTo(instance->switcher, instance->listViewPCIDevices, ES_TRANSITION_NONE);
|
EsPanelSwitchTo(instance->switcher, instance->listViewPCIDevices, ES_TRANSITION_NONE);
|
||||||
} else if (index == DISPLAY_MEMORY) {
|
} else if (index == DISPLAY_MEMORY) {
|
||||||
EsMemoryStatistics statistics = {};
|
EsMemoryStatistics statistics = {};
|
||||||
|
@ -341,7 +341,7 @@ void UpdateDisplay(Instance *instance, int index) {
|
||||||
|
|
||||||
int ListViewProcessesCallback(EsElement *element, EsMessage *message) {
|
int ListViewProcessesCallback(EsElement *element, EsMessage *message) {
|
||||||
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
||||||
int column = message->getContent.column, index = message->getContent.index.i;
|
int column = message->getContent.column, index = message->getContent.index;
|
||||||
ProcessItem *item = &processes[index];
|
ProcessItem *item = &processes[index];
|
||||||
if (column == 0) GET_CONTENT("%s", item->data.nameBytes, item->data.name);
|
if (column == 0) GET_CONTENT("%s", item->data.nameBytes, item->data.name);
|
||||||
else if (column == 1) { if (item->data.pid == -1) GET_CONTENT("n/a"); else GET_CONTENT("%d", item->data.pid); }
|
else if (column == 1) { if (item->data.pid == -1) GET_CONTENT("n/a"); else GET_CONTENT("%d", item->data.pid); }
|
||||||
|
@ -350,9 +350,9 @@ int ListViewProcessesCallback(EsElement *element, EsMessage *message) {
|
||||||
else if (column == 4) GET_CONTENT("%d", item->data.handleCount);
|
else if (column == 4) GET_CONTENT("%d", item->data.handleCount);
|
||||||
else EsAssert(false);
|
else EsAssert(false);
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
||||||
message->selectItem.isSelected = processes[message->selectItem.index.u].data.pid == selectedPID;
|
message->selectItem.isSelected = processes[message->selectItem.index].data.pid == selectedPID;
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_SELECT && message->selectItem.isSelected) {
|
} else if (message->type == ES_MSG_LIST_VIEW_SELECT && message->selectItem.isSelected) {
|
||||||
selectedPID = processes[message->selectItem.index.u].data.pid;
|
selectedPID = processes[message->selectItem.index].data.pid;
|
||||||
EsCommandSetDisabled(&element->instance->commandTerminateProcess, selectedPID < 0 || !FindProcessByPID(processes, selectedPID));
|
EsCommandSetDisabled(&element->instance->commandTerminateProcess, selectedPID < 0 || !FindProcessByPID(processes, selectedPID));
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -363,7 +363,7 @@ int ListViewProcessesCallback(EsElement *element, EsMessage *message) {
|
||||||
|
|
||||||
int ListViewPCIDevicesCallback(EsElement *, EsMessage *message) {
|
int ListViewPCIDevicesCallback(EsElement *, EsMessage *message) {
|
||||||
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
||||||
int column = message->getContent.column, index = message->getContent.index.i;
|
int column = message->getContent.column, index = message->getContent.index;
|
||||||
|
|
||||||
EsPCIDevice *entry = pciDevices + index;
|
EsPCIDevice *entry = pciDevices + index;
|
||||||
|
|
||||||
|
|
|
@ -6695,12 +6695,12 @@ int InspectorElementItemCallback(EsElement *element, EsMessage *message) {
|
||||||
InspectorWindow *inspector = (InspectorWindow *) element->instance;
|
InspectorWindow *inspector = (InspectorWindow *) element->instance;
|
||||||
|
|
||||||
if (message->type == ES_MSG_HOVERED_START) {
|
if (message->type == ES_MSG_HOVERED_START) {
|
||||||
InspectorElementEntry *entry = &inspector->elements[EsListViewGetIndexFromItem(element).u];
|
InspectorElementEntry *entry = &inspector->elements[EsListViewGetIndexFromItem(element)];
|
||||||
if (entry->element->parent) entry->element->parent->Repaint(true);
|
if (entry->element->parent) entry->element->parent->Repaint(true);
|
||||||
else entry->element->Repaint(true);
|
else entry->element->Repaint(true);
|
||||||
inspector->hoveredElement = *entry;
|
inspector->hoveredElement = *entry;
|
||||||
} else if (message->type == ES_MSG_HOVERED_END || message->type == ES_MSG_DESTROY) {
|
} else if (message->type == ES_MSG_HOVERED_END || message->type == ES_MSG_DESTROY) {
|
||||||
InspectorElementEntry *entry = &inspector->elements[EsListViewGetIndexFromItem(element).u];
|
InspectorElementEntry *entry = &inspector->elements[EsListViewGetIndexFromItem(element)];
|
||||||
if (entry->element->parent) entry->element->parent->Repaint(true);
|
if (entry->element->parent) entry->element->parent->Repaint(true);
|
||||||
else entry->element->Repaint(true);
|
else entry->element->Repaint(true);
|
||||||
inspector->hoveredElement = {};
|
inspector->hoveredElement = {};
|
||||||
|
@ -6795,7 +6795,7 @@ int InspectorElementListCallback(EsElement *element, EsMessage *message) {
|
||||||
InspectorWindow *inspector = (InspectorWindow *) element->instance;
|
InspectorWindow *inspector = (InspectorWindow *) element->instance;
|
||||||
|
|
||||||
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT) {
|
||||||
int column = message->getContent.column, index = message->getContent.index.i;
|
int column = message->getContent.column, index = message->getContent.index;
|
||||||
EsAssert(index >= 0 && index < (int) inspector->elements.Length());
|
EsAssert(index >= 0 && index < (int) inspector->elements.Length());
|
||||||
InspectorElementEntry *entry = &inspector->elements[index];
|
InspectorElementEntry *entry = &inspector->elements[index];
|
||||||
|
|
||||||
|
@ -6811,7 +6811,7 @@ int InspectorElementListCallback(EsElement *element, EsMessage *message) {
|
||||||
|
|
||||||
return ES_HANDLED;
|
return ES_HANDLED;
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_GET_INDENT) {
|
} else if (message->type == ES_MSG_LIST_VIEW_GET_INDENT) {
|
||||||
message->getIndent.indent = inspector->elements[message->getIndent.index.i].depth;
|
message->getIndent.indent = inspector->elements[message->getIndent.index].depth;
|
||||||
return ES_HANDLED;
|
return ES_HANDLED;
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_CREATE_ITEM) {
|
} else if (message->type == ES_MSG_LIST_VIEW_CREATE_ITEM) {
|
||||||
message->createItem.item->messageUser = InspectorElementItemCallback;
|
message->createItem.item->messageUser = InspectorElementItemCallback;
|
||||||
|
@ -6821,7 +6821,7 @@ int InspectorElementListCallback(EsElement *element, EsMessage *message) {
|
||||||
inspector->elements[inspector->selectedElement].element->state &= ~UI_STATE_INSPECTING;
|
inspector->elements[inspector->selectedElement].element->state &= ~UI_STATE_INSPECTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
inspector->selectedElement = message->selectItem.isSelected ? message->selectItem.index.i : -1;
|
inspector->selectedElement = message->selectItem.isSelected ? message->selectItem.index : -1;
|
||||||
|
|
||||||
if (inspector->selectedElement != -1) {
|
if (inspector->selectedElement != -1) {
|
||||||
EsElement *e = inspector->elements[inspector->selectedElement].element;
|
EsElement *e = inspector->elements[inspector->selectedElement].element;
|
||||||
|
@ -6832,7 +6832,7 @@ int InspectorElementListCallback(EsElement *element, EsMessage *message) {
|
||||||
InspectorUpdateEditor(inspector);
|
InspectorUpdateEditor(inspector);
|
||||||
return ES_HANDLED;
|
return ES_HANDLED;
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED) {
|
||||||
message->selectItem.isSelected = message->selectItem.index.i == inspector->selectedElement;
|
message->selectItem.isSelected = message->selectItem.index == inspector->selectedElement;
|
||||||
return ES_HANDLED;
|
return ES_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6945,7 +6945,7 @@ void InspectorNotifyElementDestroyed(EsElement *element) {
|
||||||
inspector->selectedElement--;
|
inspector->selectedElement--;
|
||||||
}
|
}
|
||||||
|
|
||||||
EsListViewRemove(inspector->elementList, 0, i, i);
|
EsListViewRemove(inspector->elementList, 0, i, 1);
|
||||||
inspector->elements.Delete(i);
|
inspector->elements.Delete(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7013,7 +7013,7 @@ void InspectorNotifyElementCreated(EsElement *element) {
|
||||||
entry.element = element;
|
entry.element = element;
|
||||||
entry.depth = depth;
|
entry.depth = depth;
|
||||||
inspector->elements.Insert(entry, insertAfterIndex + 1);
|
inspector->elements.Insert(entry, insertAfterIndex + 1);
|
||||||
EsListViewInsert(inspector->elementList, 0, insertAfterIndex + 1, insertAfterIndex + 1);
|
EsListViewInsert(inspector->elementList, 0, insertAfterIndex + 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorFindElementsRecursively(InspectorWindow *inspector, EsElement *element, int depth) {
|
void InspectorFindElementsRecursively(InspectorWindow *inspector, EsElement *element, int depth) {
|
||||||
|
@ -7031,7 +7031,7 @@ void InspectorRefreshElementList(InspectorWindow *inspector) {
|
||||||
EsListViewRemoveAll(inspector->elementList, 0);
|
EsListViewRemoveAll(inspector->elementList, 0);
|
||||||
inspector->elements.Free();
|
inspector->elements.Free();
|
||||||
InspectorFindElementsRecursively(inspector, inspector->instance->window, 0);
|
InspectorFindElementsRecursively(inspector, inspector->instance->window, 0);
|
||||||
EsListViewInsert(inspector->elementList, 0, 0, inspector->elements.Length() - 1);
|
EsListViewInsert(inspector->elementList, 0, 0, inspector->elements.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorNotifyElementPainted(EsElement *element, EsPainter *painter) {
|
void InspectorNotifyElementPainted(EsElement *element, EsPainter *painter) {
|
||||||
|
|
|
@ -9,9 +9,9 @@ struct ListViewItemElement : EsElement {
|
||||||
|
|
||||||
struct ListViewItem {
|
struct ListViewItem {
|
||||||
ListViewItemElement *element;
|
ListViewItemElement *element;
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
int32_t size;
|
int32_t size;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
uint8_t indent;
|
uint8_t indent;
|
||||||
bool startAtSecondColumn;
|
bool startAtSecondColumn;
|
||||||
bool isHeader, isFooter;
|
bool isHeader, isFooter;
|
||||||
|
@ -20,7 +20,7 @@ struct ListViewItem {
|
||||||
|
|
||||||
struct ListViewGroup {
|
struct ListViewGroup {
|
||||||
// TODO Empty groups.
|
// TODO Empty groups.
|
||||||
uint64_t itemCount;
|
EsListViewIndex itemCount;
|
||||||
int64_t totalSize;
|
int64_t totalSize;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
bool initialised;
|
bool initialised;
|
||||||
|
@ -51,12 +51,12 @@ struct EsListView : EsElement {
|
||||||
UIStyle *secondaryCellStyle;
|
UIStyle *secondaryCellStyle;
|
||||||
|
|
||||||
bool hasFocusedItem;
|
bool hasFocusedItem;
|
||||||
int32_t focusedItemGroup;
|
EsListViewIndex focusedItemGroup;
|
||||||
EsGeneric focusedItemIndex;
|
EsListViewIndex focusedItemIndex;
|
||||||
|
|
||||||
bool hasAnchorItem;
|
bool hasAnchorItem;
|
||||||
int32_t anchorItemGroup;
|
EsListViewIndex anchorItemGroup;
|
||||||
EsGeneric anchorItemIndex;
|
EsListViewIndex anchorItemIndex;
|
||||||
|
|
||||||
// Valid only during Z-order messages.
|
// Valid only during Z-order messages.
|
||||||
Array<EsElement *> zOrderItems;
|
Array<EsElement *> zOrderItems;
|
||||||
|
@ -83,8 +83,8 @@ struct EsListView : EsElement {
|
||||||
int64_t totalColumnWidth;
|
int64_t totalColumnWidth;
|
||||||
|
|
||||||
EsTextbox *inlineTextbox;
|
EsTextbox *inlineTextbox;
|
||||||
int32_t inlineTextboxGroup;
|
EsListViewIndex inlineTextboxGroup;
|
||||||
EsGeneric inlineTextboxIndex;
|
EsListViewIndex inlineTextboxIndex;
|
||||||
|
|
||||||
int maximumItemsPerBand;
|
int maximumItemsPerBand;
|
||||||
|
|
||||||
|
@ -102,173 +102,65 @@ struct EsListView : EsElement {
|
||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CompareIndices(int32_t groupIndex, EsGeneric left, EsGeneric right) {
|
|
||||||
if (left.u == right.u) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (~flags & ES_LIST_VIEW_NON_LINEAR) {
|
|
||||||
if (left.i > right.i) return 1;
|
|
||||||
if (left.i < right.i) return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EsMessage m = { ES_MSG_LIST_VIEW_COMPARE_INDICES };
|
|
||||||
m.compareIndices.group = groupIndex;
|
|
||||||
m.compareIndices.left = left;
|
|
||||||
m.compareIndices.right = right;
|
|
||||||
EsAssert(EsMessageSend(this, &m) == ES_HANDLED); // Could not compare indices.
|
|
||||||
return m.compareIndices.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void GetFirstIndex(EsMessage *message) {
|
inline void GetFirstIndex(EsMessage *message) {
|
||||||
EsAssert(message->iterateIndex.group < (int32_t) groups.Length()); // Invalid group index.
|
EsAssert(message->iterateIndex.group < (EsListViewIndex) groups.Length()); // Invalid group index.
|
||||||
EsAssert(groups[message->iterateIndex.group].itemCount); // No items in the group.
|
EsAssert(groups[message->iterateIndex.group].itemCount); // No items in the group.
|
||||||
|
message->iterateIndex.index = 0;
|
||||||
if (flags & ES_LIST_VIEW_NON_LINEAR) {
|
|
||||||
message->type = ES_MSG_LIST_VIEW_FIRST_INDEX;
|
|
||||||
EsAssert(ES_HANDLED == EsMessageSend(this, message)); // First index message not handled.
|
|
||||||
} else {
|
|
||||||
message->iterateIndex.index.i = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EsGeneric GetFirstIndex(int32_t group) {
|
|
||||||
EsMessage m = {};
|
|
||||||
m.iterateIndex.group = group;
|
|
||||||
GetFirstIndex(&m);
|
|
||||||
return m.iterateIndex.index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GetLastIndex(EsMessage *message) {
|
inline void GetLastIndex(EsMessage *message) {
|
||||||
EsAssert(message->iterateIndex.group < (int32_t) groups.Length()); // Invalid group index.
|
EsAssert(message->iterateIndex.group < (EsListViewIndex) groups.Length()); // Invalid group index.
|
||||||
EsAssert(groups[message->iterateIndex.group].itemCount); // No items in the group.
|
EsAssert(groups[message->iterateIndex.group].itemCount); // No items in the group.
|
||||||
|
message->iterateIndex.index = groups[message->iterateIndex.group].itemCount - 1;
|
||||||
if (flags & ES_LIST_VIEW_NON_LINEAR) {
|
|
||||||
message->type = ES_MSG_LIST_VIEW_LAST_INDEX;
|
|
||||||
EsAssert(ES_HANDLED == EsMessageSend(this, message)); // First index message not handled.
|
|
||||||
} else {
|
|
||||||
message->iterateIndex.index.i = groups[message->iterateIndex.group].itemCount - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EsGeneric GetLastIndex(int32_t group) {
|
|
||||||
EsMessage m = {};
|
|
||||||
m.iterateIndex.group = group;
|
|
||||||
GetLastIndex(&m);
|
|
||||||
return m.iterateIndex.index;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IterateForwards(EsMessage *message) {
|
inline bool IterateForwards(EsMessage *message) {
|
||||||
if (flags & ES_LIST_VIEW_NON_LINEAR) {
|
if (message->iterateIndex.index == groups[message->iterateIndex.group].itemCount - 1) {
|
||||||
message->type = ES_MSG_LIST_VIEW_NEXT_INDEX;
|
if (message->iterateIndex.group == (EsListViewIndex) groups.Length() - 1) {
|
||||||
int response = EsMessageSend(this, message);
|
|
||||||
EsAssert(0 != response); // Next index message not handled.
|
|
||||||
return response == ES_HANDLED;
|
|
||||||
} else {
|
|
||||||
if (message->iterateIndex.index.u == groups[message->iterateIndex.group].itemCount - 1) {
|
|
||||||
if (message->iterateIndex.group == (int32_t) groups.Length() - 1) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
message->iterateIndex.group++;
|
message->iterateIndex.group++;
|
||||||
message->iterateIndex.index.i = 0;
|
message->iterateIndex.index = 0;
|
||||||
} else {
|
} else {
|
||||||
message->iterateIndex.index.i++;
|
message->iterateIndex.index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IterateBackwards(EsMessage *message) {
|
inline bool IterateBackwards(EsMessage *message) {
|
||||||
if (flags & ES_LIST_VIEW_NON_LINEAR) {
|
if (message->iterateIndex.index == 0) {
|
||||||
message->type = ES_MSG_LIST_VIEW_PREVIOUS_INDEX;
|
|
||||||
int response = EsMessageSend(this, message);
|
|
||||||
EsAssert(0 != response); // Previous index message not handled.
|
|
||||||
return response == ES_HANDLED;
|
|
||||||
} else {
|
|
||||||
if (message->iterateIndex.index.u == 0) {
|
|
||||||
if (message->iterateIndex.group == 0) {
|
if (message->iterateIndex.group == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
message->iterateIndex.group--;
|
message->iterateIndex.group--;
|
||||||
message->iterateIndex.index.i = groups[message->iterateIndex.group].itemCount - 1;
|
message->iterateIndex.index = groups[message->iterateIndex.group].itemCount - 1;
|
||||||
} else {
|
} else {
|
||||||
message->iterateIndex.index.i--;
|
message->iterateIndex.index--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int64_t CountItems(int32_t groupIndex, EsGeneric firstIndex, EsGeneric lastIndex) {
|
int64_t MeasureItems(EsListViewIndex groupIndex, EsListViewIndex firstIndex, EsListViewIndex count) {
|
||||||
if (firstIndex.u == lastIndex.u) {
|
if (count == 0) return 0;
|
||||||
return 1;
|
EsAssert(count > 0);
|
||||||
}
|
|
||||||
|
|
||||||
if (~flags & ES_LIST_VIEW_NON_LINEAR) {
|
|
||||||
return lastIndex.i - firstIndex.i + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
EsMessage m = { ES_MSG_LIST_VIEW_COUNT_ITEMS };
|
|
||||||
m.itemRange.group = groupIndex;
|
|
||||||
m.itemRange.firstIndex = firstIndex;
|
|
||||||
m.itemRange.lastIndex = lastIndex;
|
|
||||||
|
|
||||||
if (ES_HANDLED == EsMessageSend(this, &m)) {
|
|
||||||
return m.itemRange.result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EsMessage m = {};
|
|
||||||
m.iterateIndex.group = groupIndex;
|
|
||||||
m.iterateIndex.index = firstIndex;
|
|
||||||
|
|
||||||
int64_t count = 1;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
IterateForwards(&m);
|
|
||||||
EsAssert(groupIndex == m.iterateIndex.group); // Index range did not exist in group.
|
|
||||||
count++;
|
|
||||||
|
|
||||||
if (m.iterateIndex.index.u == lastIndex.u) {
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t MeasureItems(int32_t groupIndex, EsGeneric firstIndex, EsGeneric lastIndex, int64_t *count = nullptr) {
|
|
||||||
int64_t _tempCount = -1;
|
|
||||||
if (!count) count = &_tempCount;
|
|
||||||
|
|
||||||
if (~flags & ES_LIST_VIEW_NON_LINEAR) {
|
|
||||||
if (*count == -1) {
|
|
||||||
*count = lastIndex.i - firstIndex.i + 1;
|
|
||||||
} else {
|
|
||||||
EsAssert(*count == lastIndex.i - firstIndex.i + 1); // Invalid item count.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool haveCount = *count != -1;
|
|
||||||
bool variableSize = flags & ES_LIST_VIEW_VARIABLE_SIZE;
|
bool variableSize = flags & ES_LIST_VIEW_VARIABLE_SIZE;
|
||||||
|
|
||||||
if (!variableSize) {
|
if (!variableSize) {
|
||||||
if (!haveCount) {
|
|
||||||
*count = CountItems(groupIndex, firstIndex, lastIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
ListViewGroup *group = &groups[groupIndex];
|
ListViewGroup *group = &groups[groupIndex];
|
||||||
int64_t normalCount = *count;
|
int64_t normalCount = count;
|
||||||
int64_t additionalSize = 0;
|
int64_t additionalSize = 0;
|
||||||
|
|
||||||
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && firstIndex.u == 0) {
|
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && firstIndex == 0) {
|
||||||
normalCount--;
|
normalCount--;
|
||||||
additionalSize += fixedHeaderSize;
|
additionalSize += fixedHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && lastIndex.u == group->itemCount - 1) {
|
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && firstIndex + count == group->itemCount) {
|
||||||
normalCount--;
|
normalCount--;
|
||||||
additionalSize += fixedFooterSize;
|
additionalSize += fixedFooterSize;
|
||||||
}
|
}
|
||||||
|
@ -276,11 +168,11 @@ struct EsListView : EsElement {
|
||||||
return additionalSize + normalCount * (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight);
|
return additionalSize + normalCount * (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstIndex.u != lastIndex.u) {
|
if (count > 1) {
|
||||||
EsMessage m = { ES_MSG_LIST_VIEW_MEASURE_RANGE };
|
EsMessage m = { ES_MSG_LIST_VIEW_MEASURE_RANGE };
|
||||||
m.itemRange.group = groupIndex;
|
m.itemRange.group = groupIndex;
|
||||||
m.itemRange.firstIndex = firstIndex;
|
m.itemRange.firstIndex = firstIndex;
|
||||||
m.itemRange.lastIndex = lastIndex;
|
m.itemRange.count = count;
|
||||||
|
|
||||||
if (ES_HANDLED == EsMessageSend(this, &m)) {
|
if (ES_HANDLED == EsMessageSend(this, &m)) {
|
||||||
return m.itemRange.result;
|
return m.itemRange.result;
|
||||||
|
@ -301,9 +193,7 @@ struct EsListView : EsElement {
|
||||||
total += m2.measureItem.result;
|
total += m2.measureItem.result;
|
||||||
_count++;
|
_count++;
|
||||||
|
|
||||||
if (m.iterateIndex.index.u == lastIndex.u) {
|
if (count == _count) {
|
||||||
if (*count != -1) EsAssert(*count == _count); // Invalid item count.
|
|
||||||
else *count = _count;
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +202,7 @@ struct EsListView : EsElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetItemPosition(int32_t groupIndex, EsGeneric index, int64_t *_position, int64_t *_itemSize) {
|
void GetItemPosition(EsListViewIndex groupIndex, EsListViewIndex index, int64_t *_position, int64_t *_itemSize) {
|
||||||
int64_t gapBetweenGroup = currentStyle->gapMajor,
|
int64_t gapBetweenGroup = currentStyle->gapMajor,
|
||||||
gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? currentStyle->gapWrap : currentStyle->gapMinor,
|
gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? currentStyle->gapWrap : currentStyle->gapMinor,
|
||||||
fixedSize = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight),
|
fixedSize = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight),
|
||||||
|
@ -321,23 +211,21 @@ struct EsListView : EsElement {
|
||||||
int64_t position = (flags & ES_LIST_VIEW_HORIZONTAL ? -scroll.position[0] : -scroll.position[1]) + startInset,
|
int64_t position = (flags & ES_LIST_VIEW_HORIZONTAL ? -scroll.position[0] : -scroll.position[1]) + startInset,
|
||||||
itemSize = 0;
|
itemSize = 0;
|
||||||
|
|
||||||
EsGeneric targetIndex = index;
|
EsListViewIndex targetIndex = index;
|
||||||
|
|
||||||
for (int32_t i = 0; i < groupIndex; i++) {
|
for (EsListViewIndex i = 0; i < groupIndex; i++) {
|
||||||
position += groups[i].totalSize + gapBetweenGroup;
|
position += groups[i].totalSize + gapBetweenGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListViewGroup *group = &groups[groupIndex];
|
ListViewGroup *group = &groups[groupIndex];
|
||||||
|
|
||||||
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && index.u == 0) {
|
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && index == 0) {
|
||||||
itemSize = fixedHeaderSize;
|
itemSize = fixedHeaderSize;
|
||||||
} else if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && index.u == group->itemCount - 1) {
|
} else if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && index == group->itemCount - 1) {
|
||||||
position += group->totalSize - fixedFooterSize;
|
position += group->totalSize - fixedFooterSize;
|
||||||
itemSize = fixedFooterSize;
|
itemSize = fixedFooterSize;
|
||||||
} else if ((~flags & ES_LIST_VIEW_NON_LINEAR) && (~flags & ES_LIST_VIEW_VARIABLE_SIZE)) {
|
} else if (~flags & ES_LIST_VIEW_VARIABLE_SIZE) {
|
||||||
// TODO MAP_TO_LINEAR if non-linear but fixed size.
|
intptr_t linearIndex = index;
|
||||||
|
|
||||||
intptr_t linearIndex = index.i;
|
|
||||||
|
|
||||||
if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
|
if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
|
||||||
linearIndex--;
|
linearIndex--;
|
||||||
|
@ -348,7 +236,7 @@ struct EsListView : EsElement {
|
||||||
position += (fixedSize + gapBetweenItems) * linearIndex;
|
position += (fixedSize + gapBetweenItems) * linearIndex;
|
||||||
itemSize = fixedSize;
|
itemSize = fixedSize;
|
||||||
} else {
|
} else {
|
||||||
EsAssert(~flags & ES_LIST_VIEW_TILED); // Tiled list views must be linear and fixed-size.;
|
EsAssert(~flags & ES_LIST_VIEW_TILED); // Tiled list views must be fixed-size.
|
||||||
|
|
||||||
EsMessage index = {};
|
EsMessage index = {};
|
||||||
index.type = ES_MSG_LIST_VIEW_FIND_POSITION;
|
index.type = ES_MSG_LIST_VIEW_FIND_POSITION;
|
||||||
|
@ -365,14 +253,13 @@ struct EsListView : EsElement {
|
||||||
bool forwards;
|
bool forwards;
|
||||||
ListViewItem *reference = visibleItems.Length() ? visibleItems.array : nullptr;
|
ListViewItem *reference = visibleItems.Length() ? visibleItems.array : nullptr;
|
||||||
|
|
||||||
bool closerToStartThanReference = reference && targetIndex.i < reference->index.i / 2;
|
bool closerToStartThanReference = reference && targetIndex < reference->index / 2;
|
||||||
bool closerToEndThanReference = reference && targetIndex.i > reference->index.i / 2 + (intptr_t) group->itemCount / 2;
|
bool closerToEndThanReference = reference && targetIndex > reference->index / 2 + (intptr_t) group->itemCount / 2;
|
||||||
if (flags & ES_LIST_VIEW_NON_LINEAR) closerToStartThanReference = closerToEndThanReference = false;
|
|
||||||
|
|
||||||
if (reference && reference->group == groupIndex && !closerToStartThanReference && !closerToEndThanReference) {
|
if (reference && reference->group == groupIndex && !closerToStartThanReference && !closerToEndThanReference) {
|
||||||
index.iterateIndex.index = reference->index;
|
index.iterateIndex.index = reference->index;
|
||||||
position = (flags & ES_LIST_VIEW_HORIZONTAL) ? reference->element->offsetX : reference->element->offsetY;
|
position = (flags & ES_LIST_VIEW_HORIZONTAL) ? reference->element->offsetX : reference->element->offsetY;
|
||||||
forwards = CompareIndices(groupIndex, reference->index, targetIndex) < 0;
|
forwards = reference->index < targetIndex;
|
||||||
|
|
||||||
EsMessage firstIndex = {};
|
EsMessage firstIndex = {};
|
||||||
firstIndex.iterateIndex.group = groupIndex;
|
firstIndex.iterateIndex.group = groupIndex;
|
||||||
|
@ -381,24 +268,24 @@ struct EsListView : EsElement {
|
||||||
if (index.iterateIndex.index == firstIndex.iterateIndex.index) {
|
if (index.iterateIndex.index == firstIndex.iterateIndex.index) {
|
||||||
forwards = true;
|
forwards = true;
|
||||||
}
|
}
|
||||||
} else if ((~flags & ES_LIST_VIEW_NON_LINEAR) && targetIndex.u > group->itemCount / 2) {
|
} else if (targetIndex > group->itemCount / 2) {
|
||||||
GetLastIndex(&index);
|
GetLastIndex(&index);
|
||||||
position += group->totalSize;
|
position += group->totalSize;
|
||||||
position -= MeasureItems(index.iterateIndex.group, index.iterateIndex.index, index.iterateIndex.index);
|
position -= MeasureItems(index.iterateIndex.group, index.iterateIndex.index, 1);
|
||||||
forwards = false;
|
forwards = false;
|
||||||
} else {
|
} else {
|
||||||
GetFirstIndex(&index);
|
GetFirstIndex(&index);
|
||||||
forwards = true;
|
forwards = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (index.iterateIndex.index.u != targetIndex.u) {
|
while (index.iterateIndex.index != targetIndex) {
|
||||||
int64_t size = MeasureItems(index.iterateIndex.group, index.iterateIndex.index, index.iterateIndex.index);
|
int64_t size = MeasureItems(index.iterateIndex.group, index.iterateIndex.index, 1);
|
||||||
position += forwards ? (size + gapBetweenItems) : -(size + gapBetweenItems);
|
position += forwards ? (size + gapBetweenItems) : -(size + gapBetweenItems);
|
||||||
EsAssert((forwards ? IterateForwards(&index) : IterateBackwards(&index)) && index.iterateIndex.group == groupIndex);
|
EsAssert((forwards ? IterateForwards(&index) : IterateBackwards(&index)) && index.iterateIndex.group == groupIndex);
|
||||||
// Could not find the item in the group.
|
// Could not find the item in the group.
|
||||||
}
|
}
|
||||||
|
|
||||||
itemSize = MeasureItems(index.iterateIndex.group, index.iterateIndex.index, index.iterateIndex.index);
|
itemSize = MeasureItems(index.iterateIndex.group, index.iterateIndex.index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +293,7 @@ struct EsListView : EsElement {
|
||||||
*_itemSize = itemSize;
|
*_itemSize = itemSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnsureItemVisible(int32_t groupIndex, EsGeneric index, bool alignTop) {
|
void EnsureItemVisible(EsListViewIndex groupIndex, EsListViewIndex index, bool alignTop) {
|
||||||
EsRectangle contentBounds = GetListBounds();
|
EsRectangle contentBounds = GetListBounds();
|
||||||
|
|
||||||
int64_t startInset = flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.l : currentStyle->insets.t,
|
int64_t startInset = flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.l : currentStyle->insets.t,
|
||||||
|
@ -443,10 +330,10 @@ struct EsListView : EsElement {
|
||||||
// Find the group.
|
// Find the group.
|
||||||
// TODO Faster searching when there are many groups.
|
// TODO Faster searching when there are many groups.
|
||||||
|
|
||||||
int32_t groupIndex = 0;
|
EsListViewIndex groupIndex = 0;
|
||||||
bool foundGroup = false;
|
bool foundGroup = false;
|
||||||
|
|
||||||
for (; groupIndex < (int32_t) groups.Length(); groupIndex++) {
|
for (; groupIndex < (EsListViewIndex) groups.Length(); groupIndex++) {
|
||||||
ListViewGroup *group = &groups[groupIndex];
|
ListViewGroup *group = &groups[groupIndex];
|
||||||
int64_t totalSize = group->totalSize;
|
int64_t totalSize = group->totalSize;
|
||||||
|
|
||||||
|
@ -472,10 +359,8 @@ struct EsListView : EsElement {
|
||||||
|
|
||||||
// Can we go directly to the item?
|
// Can we go directly to the item?
|
||||||
|
|
||||||
if ((~flags & ES_LIST_VIEW_NON_LINEAR) && (~flags & ES_LIST_VIEW_VARIABLE_SIZE)) {
|
if (~flags & ES_LIST_VIEW_VARIABLE_SIZE) {
|
||||||
// TODO MAP_FROM_LINEAR message if non-linear but fixed size.
|
index.iterateIndex.index = 0;
|
||||||
|
|
||||||
index.iterateIndex.index.i = 0;
|
|
||||||
intptr_t addHeader = 0;
|
intptr_t addHeader = 0;
|
||||||
|
|
||||||
ListViewGroup *group = &groups[groupIndex];
|
ListViewGroup *group = &groups[groupIndex];
|
||||||
|
@ -498,17 +383,17 @@ struct EsListView : EsElement {
|
||||||
band *= GetItemsPerBand();
|
band *= GetItemsPerBand();
|
||||||
}
|
}
|
||||||
|
|
||||||
index.iterateIndex.index.i = band + addHeader;
|
index.iterateIndex.index = band + addHeader;
|
||||||
|
|
||||||
if (index.iterateIndex.index.i >= (intptr_t) group->itemCount) {
|
if (index.iterateIndex.index >= (intptr_t) group->itemCount) {
|
||||||
index.iterateIndex.index.i = group->itemCount - 1;
|
index.iterateIndex.index = group->itemCount - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*_position = position;
|
*_position = position;
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
EsAssert(~flags & ES_LIST_VIEW_TILED); // Trying to use TILED mode with NON_LINEAR or VARIABLE_SIZE mode.
|
EsAssert(~flags & ES_LIST_VIEW_TILED); // Trying to use TILED mode with VARIABLE_SIZE mode.
|
||||||
|
|
||||||
// Try asking the application to find the item.
|
// Try asking the application to find the item.
|
||||||
|
|
||||||
|
@ -551,7 +436,7 @@ struct EsListView : EsElement {
|
||||||
} else {
|
} else {
|
||||||
GetLastIndex(&index); // Use end of group as reference
|
GetLastIndex(&index); // Use end of group as reference
|
||||||
position += groups[groupIndex].totalSize;
|
position += groups[groupIndex].totalSize;
|
||||||
position -= MeasureItems(index.iterateIndex.group, index.iterateIndex.index, index.iterateIndex.index);
|
position -= MeasureItems(index.iterateIndex.group, index.iterateIndex.index, 1);
|
||||||
forwards = false;
|
forwards = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +446,7 @@ struct EsListView : EsElement {
|
||||||
// Iterate forwards from reference point.
|
// Iterate forwards from reference point.
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int64_t size = fixedSize ?: MeasureItems(index.iterateIndex.group, index.iterateIndex.index, index.iterateIndex.index);
|
int64_t size = fixedSize ?: MeasureItems(index.iterateIndex.group, index.iterateIndex.index, 1);
|
||||||
|
|
||||||
if (position + size > 0) {
|
if (position + size > 0) {
|
||||||
*_position = position;
|
*_position = position;
|
||||||
|
@ -581,7 +466,7 @@ struct EsListView : EsElement {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t size = fixedSize ?: MeasureItems(index.iterateIndex.group, index.iterateIndex.index, index.iterateIndex.index);
|
int64_t size = fixedSize ?: MeasureItems(index.iterateIndex.group, index.iterateIndex.index, 1);
|
||||||
EsAssert(index.iterateIndex.group == groupIndex);
|
EsAssert(index.iterateIndex.group == groupIndex);
|
||||||
// No items in the group are visible. Maybe invalid scroll position?
|
// No items in the group are visible. Maybe invalid scroll position?
|
||||||
position -= size + gapBetweenItems;
|
position -= size + gapBetweenItems;
|
||||||
|
@ -642,7 +527,7 @@ struct EsListView : EsElement {
|
||||||
|
|
||||||
if (position < expectedPosition - 1 || position > expectedPosition + 1) {
|
if (position < expectedPosition - 1 || position > expectedPosition + 1) {
|
||||||
EsPrint("Item in unexpected position: expected %d, got %d; index %d, scroll %d.\n",
|
EsPrint("Item in unexpected position: expected %d, got %d; index %d, scroll %d.\n",
|
||||||
expectedPosition, position, visibleItem->index.i, scroll);
|
expectedPosition, position, visibleItem->index, scroll);
|
||||||
EsAssert(false);
|
EsAssert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,15 +540,15 @@ struct EsListView : EsElement {
|
||||||
|
|
||||||
visibleItem->group = currentItem.iterateIndex.group;
|
visibleItem->group = currentItem.iterateIndex.group;
|
||||||
visibleItem->index = currentItem.iterateIndex.index;
|
visibleItem->index = currentItem.iterateIndex.index;
|
||||||
visibleItem->size = MeasureItems(visibleItem->group, visibleItem->index, visibleItem->index);
|
visibleItem->size = MeasureItems(visibleItem->group, visibleItem->index, 1);
|
||||||
|
|
||||||
ListViewGroup *group = &groups[visibleItem->group];
|
ListViewGroup *group = &groups[visibleItem->group];
|
||||||
const EsStyle *style = nullptr;
|
const EsStyle *style = nullptr;
|
||||||
|
|
||||||
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && visibleItem->index.i == 0 ) {
|
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && visibleItem->index == 0) {
|
||||||
style = headerItemStyle;
|
style = headerItemStyle;
|
||||||
visibleItem->isHeader = true;
|
visibleItem->isHeader = true;
|
||||||
} else if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && visibleItem->index.i == (intptr_t) group->itemCount - 1) {
|
} else if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && visibleItem->index == (intptr_t) group->itemCount - 1) {
|
||||||
style = footerItemStyle;
|
style = footerItemStyle;
|
||||||
visibleItem->isFooter = true;
|
visibleItem->isFooter = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -681,7 +566,7 @@ struct EsListView : EsElement {
|
||||||
|
|
||||||
visibleItem->element->messageClass = ListViewProcessItemMessage;
|
visibleItem->element->messageClass = ListViewProcessItemMessage;
|
||||||
|
|
||||||
if (hasFocusedItem && visibleItem->group == focusedItemGroup && visibleItem->index.u == focusedItemIndex.u) {
|
if (hasFocusedItem && visibleItem->group == focusedItemGroup && visibleItem->index == focusedItemIndex) {
|
||||||
visibleItem->element->customStyleState |= THEME_STATE_FOCUSED_ITEM;
|
visibleItem->element->customStyleState |= THEME_STATE_FOCUSED_ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,8 +618,8 @@ struct EsListView : EsElement {
|
||||||
minorPosition += computedMinorGap + fixedMinorSize;
|
minorPosition += computedMinorGap + fixedMinorSize;
|
||||||
itemInBand++;
|
itemInBand++;
|
||||||
|
|
||||||
bool endOfGroup = ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && currentItem.iterateIndex.index.u == group->itemCount - 2)
|
bool endOfGroup = ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && currentItem.iterateIndex.index == group->itemCount - 2)
|
||||||
|| (currentItem.iterateIndex.index.u == group->itemCount - 1);
|
|| (currentItem.iterateIndex.index == group->itemCount - 1);
|
||||||
|
|
||||||
if (itemInBand == itemsPerBand || endOfGroup) {
|
if (itemInBand == itemsPerBand || endOfGroup) {
|
||||||
minorPosition = 0;
|
minorPosition = 0;
|
||||||
|
@ -768,7 +653,7 @@ struct EsListView : EsElement {
|
||||||
position += visibleItem->element->height;
|
position += visibleItem->element->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & ES_LIST_VIEW_TILED) && (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && currentItem.iterateIndex.index.u == 0) {
|
if ((flags & ES_LIST_VIEW_TILED) && (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && currentItem.iterateIndex.index == 0) {
|
||||||
position += currentStyle->gapWrap;
|
position += currentStyle->gapWrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -776,7 +661,7 @@ struct EsListView : EsElement {
|
||||||
// Go to the next item.
|
// Go to the next item.
|
||||||
|
|
||||||
visibleIndex++;
|
visibleIndex++;
|
||||||
int32_t previousGroup = currentItem.iterateIndex.group;
|
EsListViewIndex previousGroup = currentItem.iterateIndex.group;
|
||||||
if (!IterateForwards(¤tItem)) break;
|
if (!IterateForwards(¤tItem)) break;
|
||||||
position += previousGroup == currentItem.iterateIndex.group ? (flags & ES_LIST_VIEW_TILED ? 0 : currentStyle->gapMinor) : currentStyle->gapMajor;
|
position += previousGroup == currentItem.iterateIndex.group ? (flags & ES_LIST_VIEW_TILED ? 0 : currentStyle->gapMinor) : currentStyle->gapMajor;
|
||||||
}
|
}
|
||||||
|
@ -867,7 +752,7 @@ struct EsListView : EsElement {
|
||||||
EsElementUpdateContentSize(this);
|
EsElementUpdateContentSize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSelected(int32_t fromGroup, EsGeneric fromIndex, int32_t toGroup, EsGeneric toIndex,
|
void SetSelected(EsListViewIndex fromGroup, EsListViewIndex fromIndex, EsListViewIndex toGroup, EsListViewIndex toIndex,
|
||||||
bool select, bool toggle,
|
bool select, bool toggle,
|
||||||
intptr_t period = 0, intptr_t periodBegin = 0, intptr_t periodEnd = 0) {
|
intptr_t period = 0, intptr_t periodBegin = 0, intptr_t periodEnd = 0) {
|
||||||
if (!select && (flags & ES_LIST_VIEW_CHOICE_SELECT)) {
|
if (!select && (flags & ES_LIST_VIEW_CHOICE_SELECT)) {
|
||||||
|
@ -883,15 +768,15 @@ struct EsListView : EsElement {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromGroup == toGroup && CompareIndices(fromGroup, fromIndex, toIndex) > 0) {
|
if (fromGroup == toGroup && fromIndex > toIndex) {
|
||||||
EsGeneric temp = fromIndex;
|
EsListViewIndex temp = fromIndex;
|
||||||
fromIndex = toIndex;
|
fromIndex = toIndex;
|
||||||
toIndex = temp;
|
toIndex = temp;
|
||||||
} else if (fromGroup > toGroup) {
|
} else if (fromGroup > toGroup) {
|
||||||
int32_t temp1 = fromGroup;
|
EsListViewIndex temp1 = fromGroup;
|
||||||
fromGroup = toGroup;
|
fromGroup = toGroup;
|
||||||
toGroup = temp1;
|
toGroup = temp1;
|
||||||
EsGeneric temp2 = fromIndex;
|
EsListViewIndex temp2 = fromIndex;
|
||||||
fromIndex = toIndex;
|
fromIndex = toIndex;
|
||||||
toIndex = temp2;
|
toIndex = temp2;
|
||||||
}
|
}
|
||||||
|
@ -965,7 +850,7 @@ struct EsListView : EsElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
m.type = ES_MSG_LIST_VIEW_SELECT;
|
m.type = ES_MSG_LIST_VIEW_SELECT;
|
||||||
fixedItemSelection = m.selectItem.index.u;
|
fixedItemSelection = m.selectItem.index;
|
||||||
EsMessageSend(this, &m);
|
EsMessageSend(this, &m);
|
||||||
|
|
||||||
ignore:;
|
ignore:;
|
||||||
|
@ -1086,7 +971,7 @@ struct EsListView : EsElement {
|
||||||
int r2 = (flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.l - x2 : currentStyle->insets.t - y2 + scroll.fixedViewport[1];
|
int r2 = (flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.l - x2 : currentStyle->insets.t - y2 + scroll.fixedViewport[1];
|
||||||
start = FindFirstVisibleItem(&offset, r1, nullptr, &noItems);
|
start = FindFirstVisibleItem(&offset, r1, nullptr, &noItems);
|
||||||
if (noItems) return;
|
if (noItems) return;
|
||||||
adjustStart = -offset >= MeasureItems(start.iterateIndex.group, start.iterateIndex.index, start.iterateIndex.index);
|
adjustStart = -offset >= MeasureItems(start.iterateIndex.group, start.iterateIndex.index, 1);
|
||||||
end = FindFirstVisibleItem(&offset, r2, nullptr, &noItems);
|
end = FindFirstVisibleItem(&offset, r2, nullptr, &noItems);
|
||||||
adjustEnd = !noItems;
|
adjustEnd = !noItems;
|
||||||
if (noItems) { end.iterateIndex.group = groups.Length() - 1; GetLastIndex(&end); }
|
if (noItems) { end.iterateIndex.group = groups.Length() - 1; GetLastIndex(&end); }
|
||||||
|
@ -1103,12 +988,12 @@ struct EsListView : EsElement {
|
||||||
if (adjustStart) {
|
if (adjustStart) {
|
||||||
ListViewGroup *group = &groups[start.iterateIndex.group];
|
ListViewGroup *group = &groups[start.iterateIndex.group];
|
||||||
|
|
||||||
if (((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && start.iterateIndex.index.u == 0)
|
if (((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && start.iterateIndex.index == 0)
|
||||||
|| ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && start.iterateIndex.index.u == group->itemCount - 1)) {
|
|| ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && start.iterateIndex.index == group->itemCount - 1)) {
|
||||||
IterateForwards(&start);
|
IterateForwards(&start);
|
||||||
} else {
|
} else {
|
||||||
for (intptr_t i = 0; i < itemsPerBand; i++) {
|
for (intptr_t i = 0; i < itemsPerBand; i++) {
|
||||||
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && start.iterateIndex.index.u == group->itemCount - 1) {
|
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && start.iterateIndex.index == group->itemCount - 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1120,11 +1005,11 @@ struct EsListView : EsElement {
|
||||||
if (adjustEnd) {
|
if (adjustEnd) {
|
||||||
ListViewGroup *group = &groups[end.iterateIndex.group];
|
ListViewGroup *group = &groups[end.iterateIndex.group];
|
||||||
|
|
||||||
if (((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && end.iterateIndex.index.u == 0)
|
if (((group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && end.iterateIndex.index == 0)
|
||||||
|| ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && end.iterateIndex.index.u == group->itemCount - 1)) {
|
|| ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && end.iterateIndex.index == group->itemCount - 1)) {
|
||||||
} else {
|
} else {
|
||||||
for (intptr_t i = 0; i < itemsPerBand - 1; i++) {
|
for (intptr_t i = 0; i < itemsPerBand - 1; i++) {
|
||||||
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && end.iterateIndex.index.u == group->itemCount - 1) {
|
if ((group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) && end.iterateIndex.index == group->itemCount - 1) {
|
||||||
IterateBackwards(&end);
|
IterateBackwards(&end);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1167,7 +1052,7 @@ struct EsListView : EsElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Select(int32_t group, EsGeneric index, bool range, bool toggle, bool moveAnchorOnly) {
|
void Select(EsListViewIndex group, EsListViewIndex index, bool range, bool toggle, bool moveAnchorOnly) {
|
||||||
if ((~flags & ES_LIST_VIEW_SINGLE_SELECT) && (~flags & ES_LIST_VIEW_MULTI_SELECT) && (~flags & ES_LIST_VIEW_CHOICE_SELECT)) {
|
if ((~flags & ES_LIST_VIEW_SINGLE_SELECT) && (~flags & ES_LIST_VIEW_MULTI_SELECT) && (~flags & ES_LIST_VIEW_CHOICE_SELECT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1200,7 +1085,7 @@ struct EsListView : EsElement {
|
||||||
|
|
||||||
if (!toggle) {
|
if (!toggle) {
|
||||||
// Clear existing selection.
|
// Clear existing selection.
|
||||||
SetSelected(0, GetFirstIndex(0), groups.Length() - 1, GetLastIndex(groups.Length() - 1), false, false);
|
SetSelected(0, 0, groups.Length() - 1, groups.Last().itemCount - 1, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (range) {
|
if (range) {
|
||||||
|
@ -1291,7 +1176,7 @@ struct EsListView : EsElement {
|
||||||
|
|
||||||
standardPaint:;
|
standardPaint:;
|
||||||
|
|
||||||
if (inlineTextbox && inlineTextboxGroup == item->group && inlineTextboxIndex.u == item->index.u) {
|
if (inlineTextbox && inlineTextboxGroup == item->group && inlineTextboxIndex == item->index) {
|
||||||
buffer.position = 0;
|
buffer.position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1356,7 +1241,7 @@ struct EsListView : EsElement {
|
||||||
m.getContent.index = item->index;
|
m.getContent.index = item->index;
|
||||||
m.getContent.group = item->group;
|
m.getContent.group = item->group;
|
||||||
EsMessageSend(this, &m);
|
EsMessageSend(this, &m);
|
||||||
EsBufferFormat(message->getContent.buffer, "index %d '%s'", item->index.u, buffer.position, buffer.out);
|
EsBufferFormat(message->getContent.buffer, "index %d '%s'", item->index, buffer.position, buffer.out);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1371,11 +1256,11 @@ struct EsListView : EsElement {
|
||||||
: bounds.r - bounds.l - currentStyle->insets.r - currentStyle->insets.l;
|
: bounds.r - bounds.l - currentStyle->insets.r - currentStyle->insets.l;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListViewItem *FindVisibleItem(int32_t group, EsGeneric index) {
|
ListViewItem *FindVisibleItem(EsListViewIndex group, EsListViewIndex index) {
|
||||||
for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
|
for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
|
||||||
ListViewItem *item = &visibleItems[i];
|
ListViewItem *item = &visibleItems[i];
|
||||||
|
|
||||||
if (item->group == group && item->index.u == index.u) {
|
if (item->group == group && item->index == index) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1442,7 +1327,7 @@ struct EsListView : EsElement {
|
||||||
|
|
||||||
m.getContent.index = m2.iterateIndex.index;
|
m.getContent.index = m2.iterateIndex.index;
|
||||||
m.getContent.group = m2.iterateIndex.group;
|
m.getContent.group = m2.iterateIndex.group;
|
||||||
} while (m.getContent.index.u != focusedItemIndex.u || m.getContent.group != focusedItemGroup);
|
} while (m.getContent.index != focusedItemIndex || m.getContent.group != focusedItemGroup);
|
||||||
|
|
||||||
focusedItemIndex = m.getContent.index;
|
focusedItemIndex = m.getContent.index;
|
||||||
focusedItemGroup = m.getContent.group;
|
focusedItemGroup = m.getContent.group;
|
||||||
|
@ -1756,14 +1641,14 @@ struct EsListView : EsElement {
|
||||||
if (!hasFocusedItem && groups.Length() && (message->focus.flags & ES_ELEMENT_FOCUS_FROM_KEYBOARD)) {
|
if (!hasFocusedItem && groups.Length() && (message->focus.flags & ES_ELEMENT_FOCUS_FROM_KEYBOARD)) {
|
||||||
hasFocusedItem = true;
|
hasFocusedItem = true;
|
||||||
focusedItemGroup = 0;
|
focusedItemGroup = 0;
|
||||||
focusedItemIndex = GetFirstIndex(focusedItemGroup);
|
focusedItemIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
|
for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
|
||||||
ListViewItem *item = &visibleItems[i];
|
ListViewItem *item = &visibleItems[i];
|
||||||
item->element->customStyleState |= THEME_STATE_LIST_FOCUSED;
|
item->element->customStyleState |= THEME_STATE_LIST_FOCUSED;
|
||||||
|
|
||||||
if (hasFocusedItem && focusedItemGroup == item->group && focusedItemIndex.u == item->index.u) {
|
if (hasFocusedItem && focusedItemGroup == item->group && focusedItemIndex == item->index) {
|
||||||
item->element->customStyleState |= THEME_STATE_FOCUSED_ITEM;
|
item->element->customStyleState |= THEME_STATE_FOCUSED_ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1776,7 +1661,7 @@ struct EsListView : EsElement {
|
||||||
EsCommandSetCallback(command, [] (EsInstance *, EsElement *, EsCommand *command) {
|
EsCommandSetCallback(command, [] (EsInstance *, EsElement *, EsCommand *command) {
|
||||||
EsListView *list = (EsListView *) command->data.p;
|
EsListView *list = (EsListView *) command->data.p;
|
||||||
if (!list->groups.Length() || !list->totalItemCount) return;
|
if (!list->groups.Length() || !list->totalItemCount) return;
|
||||||
list->SetSelected(0, list->GetFirstIndex(0), list->groups.Length() - 1, list->GetLastIndex(list->groups.Length() - 1), true, false);
|
list->SetSelected(0, 0, list->groups.Length() - 1, list->groups.Last().itemCount - 1, true, false);
|
||||||
list->UpdateVisibleItemsSelectionState();
|
list->UpdateVisibleItemsSelectionState();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1892,7 +1777,7 @@ struct EsListView : EsElement {
|
||||||
intptr_t focused = -1, hovered = -1;
|
intptr_t focused = -1, hovered = -1;
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
|
for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
|
||||||
if (hasFocusedItem && visibleItems[i].index.u == focusedItemIndex.u && visibleItems[i].group == focusedItemGroup) {
|
if (hasFocusedItem && visibleItems[i].index == focusedItemIndex && visibleItems[i].group == focusedItemGroup) {
|
||||||
focused = i;
|
focused = i;
|
||||||
} else if (visibleItems[i].element->state & UI_STATE_HOVERED) {
|
} else if (visibleItems[i].element->state & UI_STATE_HOVERED) {
|
||||||
hovered = i;
|
hovered = i;
|
||||||
|
@ -1911,11 +1796,11 @@ struct EsListView : EsElement {
|
||||||
} else if (message->type == ES_MSG_AFTER_Z_ORDER) {
|
} else if (message->type == ES_MSG_AFTER_Z_ORDER) {
|
||||||
zOrderItems.Free();
|
zOrderItems.Free();
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT && (flags & ES_LIST_VIEW_FIXED_ITEMS)) {
|
} else if (message->type == ES_MSG_LIST_VIEW_GET_CONTENT && (flags & ES_LIST_VIEW_FIXED_ITEMS)) {
|
||||||
uintptr_t index = message->getContent.index.u;
|
uintptr_t index = message->getContent.index;
|
||||||
EsAssert(index < fixedItems.Length());
|
EsAssert(index < fixedItems.Length());
|
||||||
EsBufferFormat(message->getContent.buffer, "%s", fixedItems[index].stringBytes, fixedItems[index].string);
|
EsBufferFormat(message->getContent.buffer, "%s", fixedItems[index].stringBytes, fixedItems[index].string);
|
||||||
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED && (flags & ES_LIST_VIEW_FIXED_ITEMS)) {
|
} else if (message->type == ES_MSG_LIST_VIEW_IS_SELECTED && (flags & ES_LIST_VIEW_FIXED_ITEMS)) {
|
||||||
message->selectItem.isSelected = message->selectItem.index.i == fixedItemSelection;
|
message->selectItem.isSelected = message->selectItem.index == fixedItemSelection;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2032,7 +1917,7 @@ void EsListViewChangeStyles(EsListView *view, const EsStyle *style, const EsStyl
|
||||||
for (uintptr_t i = 0; i < view->groups.Length(); i++) {
|
for (uintptr_t i = 0; i < view->groups.Length(); i++) {
|
||||||
if (!view->groups[i].itemCount) continue;
|
if (!view->groups[i].itemCount) continue;
|
||||||
spaceDelta -= view->groups[i].totalSize;
|
spaceDelta -= view->groups[i].totalSize;
|
||||||
view->groups[i].totalSize = view->MeasureItems(i, view->GetFirstIndex(i), view->GetLastIndex(i));
|
view->groups[i].totalSize = view->MeasureItems(i, 0, view->groups[i].itemCount);
|
||||||
spaceDelta += view->groups[i].totalSize;
|
spaceDelta += view->groups[i].totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2066,13 +1951,13 @@ EsListView *EsListViewCreate(EsElement *parent, uint64_t flags, const EsStyle *s
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewInsertGroup(EsListView *view, int32_t group, uint32_t flags) {
|
void EsListViewInsertGroup(EsListView *view, EsListViewIndex group, uint32_t flags) {
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
|
|
||||||
// Add the group.
|
// Add the group.
|
||||||
|
|
||||||
ListViewGroup empty = { .flags = flags };
|
ListViewGroup empty = { .flags = flags };
|
||||||
EsAssert(group <= (int32_t) view->groups.Length()); // Invalid group index.
|
EsAssert(group <= (EsListViewIndex) view->groups.Length()); // Invalid group index.
|
||||||
view->groups.Insert(empty, group);
|
view->groups.Insert(empty, group);
|
||||||
|
|
||||||
// Update the group index on visible items.
|
// Update the group index on visible items.
|
||||||
|
@ -2098,52 +1983,36 @@ void EsListViewInsertGroup(EsListView *view, int32_t group, uint32_t flags) {
|
||||||
// Create header and footer items.
|
// Create header and footer items.
|
||||||
|
|
||||||
int64_t additionalItems = ((flags & ES_LIST_VIEW_GROUP_HAS_HEADER) ? 1 : 0) + ((flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) ? 1 : 0);
|
int64_t additionalItems = ((flags & ES_LIST_VIEW_GROUP_HAS_HEADER) ? 1 : 0) + ((flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) ? 1 : 0);
|
||||||
if (additionalItems) EsListViewInsert(view, group, 0, additionalItems - 1, additionalItems);
|
EsListViewInsert(view, group, 0, additionalItems);
|
||||||
view->groups[group].initialised = true;
|
view->groups[group].initialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewInsert(EsListView *view, int32_t groupIndex, EsGeneric firstIndex, EsGeneric lastIndex, int64_t count) {
|
void EsListViewInsert(EsListView *view, EsListViewIndex groupIndex, EsListViewIndex firstIndex, EsListViewIndex count) {
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
|
if (!count) return;
|
||||||
bool pushIndices = false;
|
EsAssert(count > 0);
|
||||||
|
|
||||||
if (~view->flags & ES_LIST_VIEW_NON_LINEAR) {
|
|
||||||
// Skip check for non-linear views, because it'd be expensive.
|
|
||||||
EsAssert(firstIndex.i <= lastIndex.i); // Invalid item index range.
|
|
||||||
|
|
||||||
pushIndices = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the group.
|
// Get the group.
|
||||||
|
|
||||||
EsAssert(groupIndex < (int32_t) view->groups.Length()); // Invalid group index.
|
EsAssert(groupIndex < (EsListViewIndex) view->groups.Length()); // Invalid group index.
|
||||||
ListViewGroup *group = &view->groups[groupIndex];
|
ListViewGroup *group = &view->groups[groupIndex];
|
||||||
|
|
||||||
if (group->initialised) {
|
if (group->initialised) {
|
||||||
if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
|
if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
|
||||||
EsAssert(firstIndex.i > 0); // Cannot insert before group header.
|
EsAssert(firstIndex > 0); // Cannot insert before group header.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) {
|
if (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) {
|
||||||
EsAssert(firstIndex.i < (intptr_t) group->itemCount); // Cannot insert after group footer.
|
EsAssert(firstIndex < (intptr_t) group->itemCount); // Cannot insert after group footer.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the items to the group.
|
// Add the items to the group.
|
||||||
|
|
||||||
bool alreadySetItemCount = false;
|
|
||||||
bool addedFirstItemInGroup = !group->itemCount;
|
bool addedFirstItemInGroup = !group->itemCount;
|
||||||
|
|
||||||
if (count != -1) {
|
|
||||||
// Setting the item count early is necessary for MeasureItems when adding the group header/footer items.
|
|
||||||
alreadySetItemCount = true;
|
|
||||||
group->itemCount += count;
|
group->itemCount += count;
|
||||||
}
|
int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
|
||||||
|
|
||||||
int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, lastIndex, &count);
|
|
||||||
int64_t sizeToAdd = (count - (addedFirstItemInGroup ? 1 : 0)) * view->currentStyle->gapMinor + totalSizeOfItems;
|
int64_t sizeToAdd = (count - (addedFirstItemInGroup ? 1 : 0)) * view->currentStyle->gapMinor + totalSizeOfItems;
|
||||||
|
|
||||||
if (!alreadySetItemCount) group->itemCount += count;
|
|
||||||
group->totalSize += sizeToAdd;
|
group->totalSize += sizeToAdd;
|
||||||
view->totalItemCount += count;
|
view->totalItemCount += count;
|
||||||
|
|
||||||
|
@ -2151,15 +2020,15 @@ void EsListViewInsert(EsListView *view, int32_t groupIndex, EsGeneric firstIndex
|
||||||
|
|
||||||
uintptr_t firstVisibleItemToMove = view->visibleItems.Length();
|
uintptr_t firstVisibleItemToMove = view->visibleItems.Length();
|
||||||
|
|
||||||
if (view->hasFocusedItem && view->focusedItemGroup == groupIndex && pushIndices) {
|
if (view->hasFocusedItem && view->focusedItemGroup == groupIndex) {
|
||||||
if (view->CompareIndices(groupIndex, view->focusedItemIndex, firstIndex) >= 0) {
|
if (view->focusedItemIndex >= firstIndex) {
|
||||||
view->focusedItemIndex.i += count;
|
view->focusedItemIndex += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->hasAnchorItem && view->anchorItemGroup == groupIndex && pushIndices) {
|
if (view->hasAnchorItem && view->anchorItemGroup == groupIndex) {
|
||||||
if (view->CompareIndices(groupIndex, view->anchorItemIndex, firstIndex) >= 0) {
|
if (view->anchorItemIndex >= firstIndex) {
|
||||||
view->anchorItemIndex.i += count;
|
view->anchorItemIndex += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2176,69 +2045,45 @@ void EsListViewInsert(EsListView *view, int32_t groupIndex, EsGeneric firstIndex
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->flags & ES_LIST_VIEW_NON_LINEAR) {
|
if (item->index >= firstIndex) {
|
||||||
int result = 1;
|
item->index += count;
|
||||||
|
|
||||||
if (firstVisibleItemToMove >= i) {
|
|
||||||
result = view->CompareIndices(groupIndex, item->index, lastIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
EsAssert(result != 0); // Adding item already in the list.
|
|
||||||
|
|
||||||
if (result > 0) {
|
|
||||||
if (i < firstVisibleItemToMove) {
|
|
||||||
firstVisibleItemToMove = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (item->index.i >= firstIndex.i) {
|
|
||||||
item->index.i += count;
|
|
||||||
|
|
||||||
if (i < firstVisibleItemToMove) {
|
if (i < firstVisibleItemToMove) {
|
||||||
firstVisibleItemToMove = i;
|
firstVisibleItemToMove = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the space for the items.
|
// Insert the space for the items.
|
||||||
|
|
||||||
view->InsertSpace(sizeToAdd, firstVisibleItemToMove);
|
view->InsertSpace(sizeToAdd, firstVisibleItemToMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewRemove(EsListView *view, int32_t groupIndex, EsGeneric firstIndex, EsGeneric lastIndex, int64_t count) {
|
void EsListViewRemove(EsListView *view, EsListViewIndex groupIndex, EsListViewIndex firstIndex, EsListViewIndex count) {
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
|
if (!count) return;
|
||||||
bool pushIndices = false;
|
EsAssert(count > 0);
|
||||||
|
|
||||||
if (~view->flags & ES_LIST_VIEW_NON_LINEAR) {
|
|
||||||
// Skip check for non-linear views, because it'd be expensive.
|
|
||||||
EsAssert(firstIndex.i <= lastIndex.i); // Invalid item index range.
|
|
||||||
|
|
||||||
pushIndices = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the group.
|
// Get the group.
|
||||||
|
|
||||||
EsAssert(groupIndex < (int32_t) view->groups.Length()); // Invalid group index.
|
EsAssert(groupIndex < (EsListViewIndex) view->groups.Length()); // Invalid group index.
|
||||||
ListViewGroup *group = &view->groups[groupIndex];
|
ListViewGroup *group = &view->groups[groupIndex];
|
||||||
|
|
||||||
if (group->initialised) {
|
if (group->initialised) {
|
||||||
if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
|
if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
|
||||||
EsAssert(firstIndex.i > 0); // Cannot remove the group header.
|
EsAssert(firstIndex > 0); // Cannot remove the group header.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) {
|
if (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) {
|
||||||
EsAssert(lastIndex.i < (intptr_t) group->itemCount - 1); // Cannot remove the group footer.
|
EsAssert(firstIndex + count < (intptr_t) group->itemCount); // Cannot remove the group footer.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the items from the group.
|
// Remove the items from the group.
|
||||||
|
|
||||||
int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, lastIndex, &count);
|
int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
|
||||||
int64_t sizeToRemove = (int64_t) group->itemCount == count ? group->totalSize
|
int64_t sizeToRemove = (int64_t) group->itemCount == count ? group->totalSize
|
||||||
: (count * view->currentStyle->gapMinor + totalSizeOfItems);
|
: (count * view->currentStyle->gapMinor + totalSizeOfItems);
|
||||||
|
|
||||||
group->itemCount -= count;
|
group->itemCount -= count;
|
||||||
group->totalSize -= sizeToRemove;
|
group->totalSize -= sizeToRemove;
|
||||||
view->totalItemCount -= count;
|
view->totalItemCount -= count;
|
||||||
|
@ -2249,20 +2094,18 @@ void EsListViewRemove(EsListView *view, int32_t groupIndex, EsGeneric firstIndex
|
||||||
uintptr_t firstVisibleItemToMove = view->visibleItems.Length();
|
uintptr_t firstVisibleItemToMove = view->visibleItems.Length();
|
||||||
|
|
||||||
if (view->hasFocusedItem && view->focusedItemGroup == groupIndex) {
|
if (view->hasFocusedItem && view->focusedItemGroup == groupIndex) {
|
||||||
if (view->CompareIndices(groupIndex, view->focusedItemIndex, firstIndex) >= 0
|
if (view->focusedItemIndex >= firstIndex && view->focusedItemIndex < firstIndex + count) {
|
||||||
&& view->CompareIndices(groupIndex, view->focusedItemIndex, lastIndex) <= 0) {
|
|
||||||
view->hasFocusedItem = false;
|
view->hasFocusedItem = false;
|
||||||
} else if (pushIndices) {
|
} else {
|
||||||
view->focusedItemIndex.i -= count;
|
view->focusedItemIndex -= count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->hasAnchorItem && view->anchorItemGroup == groupIndex) {
|
if (view->hasAnchorItem && view->anchorItemGroup == groupIndex) {
|
||||||
if (view->CompareIndices(groupIndex, view->focusedItemIndex, firstIndex) >= 0
|
if (view->focusedItemIndex >= firstIndex && view->anchorItemIndex < firstIndex + count) {
|
||||||
&& view->CompareIndices(groupIndex, view->anchorItemIndex, lastIndex) <= 0) {
|
|
||||||
view->hasAnchorItem = false;
|
view->hasAnchorItem = false;
|
||||||
} else if (pushIndices) {
|
} else {
|
||||||
view->anchorItemIndex.i -= count;
|
view->anchorItemIndex -= count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2279,49 +2122,30 @@ void EsListViewRemove(EsListView *view, int32_t groupIndex, EsGeneric firstIndex
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->flags & ES_LIST_VIEW_NON_LINEAR) {
|
if (item->index >= firstIndex + count) {
|
||||||
int r1 = view->CompareIndices(groupIndex, item->index, firstIndex);
|
item->index -= count;
|
||||||
int r2 = view->CompareIndices(groupIndex, item->index, lastIndex);
|
|
||||||
|
|
||||||
if (r1 < 0) EsAssert(r2 < 0); // Invalid index order.
|
|
||||||
if (r2 > 0) EsAssert(r1 > 0); // Invalid index order.
|
|
||||||
|
|
||||||
if (r2 > 0) {
|
|
||||||
if (i < firstVisibleItemToMove) {
|
|
||||||
firstVisibleItemToMove = i;
|
|
||||||
}
|
|
||||||
} else if (r1 >= 0 && r2 <= 0) {
|
|
||||||
item->element->index = i;
|
|
||||||
item->element->Destroy();
|
|
||||||
view->visibleItems.Delete(i);
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (item->index.i > lastIndex.i) {
|
|
||||||
item->index.i -= count;
|
|
||||||
|
|
||||||
if (i < firstVisibleItemToMove) {
|
if (i < firstVisibleItemToMove) {
|
||||||
firstVisibleItemToMove = i;
|
firstVisibleItemToMove = i;
|
||||||
}
|
}
|
||||||
} else if (item->index.i >= firstIndex.i && item->index.i <= lastIndex.i) {
|
} else if (item->index >= firstIndex && item->index < firstIndex + count) {
|
||||||
item->element->index = i;
|
item->element->index = i;
|
||||||
item->element->Destroy();
|
item->element->Destroy();
|
||||||
view->visibleItems.Delete(i);
|
view->visibleItems.Delete(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the space of the items.
|
// Remove the space of the items.
|
||||||
|
|
||||||
view->InsertSpace(-sizeToRemove, firstVisibleItemToMove);
|
view->InsertSpace(-sizeToRemove, firstVisibleItemToMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewRemoveAll(EsListView *view, int32_t group) {
|
void EsListViewRemoveAll(EsListView *view, EsListViewIndex group) {
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
|
|
||||||
if (view->groups[group].itemCount) {
|
if (view->groups[group].itemCount) {
|
||||||
EsListViewRemove(view, group, view->GetFirstIndex(group), view->GetLastIndex(group), view->groups[group].itemCount);
|
EsListViewRemove(view, group, 0, view->groups[group].itemCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2418,7 +2242,7 @@ void EsListViewContentChanged(EsListView *view) {
|
||||||
EsListViewInvalidateAll(view);
|
EsListViewInvalidateAll(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewFocusItem(EsListView *view, int32_t group, EsGeneric index) {
|
void EsListViewFocusItem(EsListView *view, EsListViewIndex group, EsListViewIndex index) {
|
||||||
ListViewItem *oldFocus = view->FindVisibleItem(view->focusedItemGroup, view->focusedItemIndex);
|
ListViewItem *oldFocus = view->FindVisibleItem(view->focusedItemGroup, view->focusedItemIndex);
|
||||||
|
|
||||||
if (oldFocus) {
|
if (oldFocus) {
|
||||||
|
@ -2440,7 +2264,7 @@ void EsListViewFocusItem(EsListView *view, int32_t group, EsGeneric index) {
|
||||||
view->EnsureItemVisible(group, index, false);
|
view->EnsureItemVisible(group, index, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EsListViewGetFocusedItem(EsListView *view, int32_t *group, EsGeneric *index) {
|
bool EsListViewGetFocusedItem(EsListView *view, EsListViewIndex *group, EsListViewIndex *index) {
|
||||||
if (view->hasFocusedItem) {
|
if (view->hasFocusedItem) {
|
||||||
if (group) *group = view->focusedItemGroup;
|
if (group) *group = view->focusedItemGroup;
|
||||||
if (index) *index = view->focusedItemIndex;
|
if (index) *index = view->focusedItemIndex;
|
||||||
|
@ -2449,7 +2273,7 @@ bool EsListViewGetFocusedItem(EsListView *view, int32_t *group, EsGeneric *index
|
||||||
return view->hasFocusedItem;
|
return view->hasFocusedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewSelect(EsListView *view, int32_t group, EsGeneric index) {
|
void EsListViewSelect(EsListView *view, EsListViewIndex group, EsListViewIndex index) {
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
|
|
||||||
view->Select(group, index, false, false, false);
|
view->Select(group, index, false, false, false);
|
||||||
|
@ -2466,7 +2290,7 @@ void EsListViewSetEmptyMessage(EsListView *view, const char *message, ptrdiff_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EsGeneric EsListViewGetIndexFromItem(EsElement *_element, int32_t *group) {
|
EsListViewIndex EsListViewGetIndexFromItem(EsElement *_element, EsListViewIndex *group) {
|
||||||
ListViewItemElement *element = (ListViewItemElement *) _element;
|
ListViewItemElement *element = (ListViewItemElement *) _element;
|
||||||
EsListView *view = (EsListView *) element->parent;
|
EsListView *view = (EsListView *) element->parent;
|
||||||
EsAssert(element->index < view->visibleItems.Length());
|
EsAssert(element->index < view->visibleItems.Length());
|
||||||
|
@ -2479,9 +2303,9 @@ void EsListViewInvalidateAll(EsListView *view) {
|
||||||
view->Repaint(true);
|
view->Repaint(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewInvalidateContent(EsListView *view, int32_t group, EsGeneric index) {
|
void EsListViewInvalidateContent(EsListView *view, EsListViewIndex group, EsListViewIndex index) {
|
||||||
for (uintptr_t i = 0; i < view->visibleItems.Length(); i++) {
|
for (uintptr_t i = 0; i < view->visibleItems.Length(); i++) {
|
||||||
if (view->visibleItems[i].group == group && view->visibleItems[i].index.u == index.u) {
|
if (view->visibleItems[i].group == group && view->visibleItems[i].index == index) {
|
||||||
view->UpdateVisibleItemSelectionState(i);
|
view->UpdateVisibleItemSelectionState(i);
|
||||||
view->visibleItems[i].element->Repaint(true);
|
view->visibleItems[i].element->Repaint(true);
|
||||||
break;
|
break;
|
||||||
|
@ -2489,7 +2313,7 @@ void EsListViewInvalidateContent(EsListView *view, int32_t group, EsGeneric inde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsListViewInsertFixedItem(EsListView *view, const char *string, ptrdiff_t stringBytes, EsGeneric data, intptr_t index) {
|
void EsListViewInsertFixedItem(EsListView *view, const char *string, ptrdiff_t stringBytes, EsGeneric data, EsListViewIndex index) {
|
||||||
EsAssert(view->flags & ES_LIST_VIEW_FIXED_ITEMS);
|
EsAssert(view->flags & ES_LIST_VIEW_FIXED_ITEMS);
|
||||||
|
|
||||||
if (stringBytes == -1) {
|
if (stringBytes == -1) {
|
||||||
|
@ -2511,7 +2335,7 @@ void EsListViewInsertFixedItem(EsListView *view, const char *string, ptrdiff_t s
|
||||||
item.stringBytes = stringBytes;
|
item.stringBytes = stringBytes;
|
||||||
view->fixedItems.Insert(item, index);
|
view->fixedItems.Insert(item, index);
|
||||||
|
|
||||||
EsListViewInsert(view, 0, index, index);
|
EsListViewInsert(view, 0, index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EsListViewSelectFixedItem(EsListView *view, EsGeneric data) {
|
bool EsListViewSelectFixedItem(EsListView *view, EsGeneric data) {
|
||||||
|
@ -2519,7 +2343,7 @@ bool EsListViewSelectFixedItem(EsListView *view, EsGeneric data) {
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
|
|
||||||
for (uintptr_t i = 0; i < view->fixedItems.Length(); i++) {
|
for (uintptr_t i = 0; i < view->fixedItems.Length(); i++) {
|
||||||
if (view->fixedItems[i].data.u == data.u) {
|
if (view->fixedItems[i].data == data) {
|
||||||
EsListViewSelect(view, 0, i);
|
EsListViewSelect(view, 0, i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2554,7 +2378,7 @@ int ListViewInlineTextboxMessage(EsElement *element, EsMessage *message) {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
EsTextbox *EsListViewCreateInlineTextbox(EsListView *view, int32_t group, EsGeneric index, uint32_t flags) {
|
EsTextbox *EsListViewCreateInlineTextbox(EsListView *view, EsListViewIndex group, EsListViewIndex index, uint32_t flags) {
|
||||||
if (view->inlineTextbox) {
|
if (view->inlineTextbox) {
|
||||||
view->inlineTextbox->Destroy();
|
view->inlineTextbox->Destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ type_name int64_t EsFileOffsetDifference;
|
||||||
type_name uint64_t EsAudioDeviceID;
|
type_name uint64_t EsAudioDeviceID;
|
||||||
type_name uint16_t EsFontFamily;
|
type_name uint16_t EsFontFamily;
|
||||||
type_name uint64_t EsTimer;
|
type_name uint64_t EsTimer;
|
||||||
|
type_name int64_t EsListViewIndex;
|
||||||
|
|
||||||
define ES_SCANCODE_A (0x04)
|
define ES_SCANCODE_A (0x04)
|
||||||
define ES_SCANCODE_B (0x05)
|
define ES_SCANCODE_B (0x05)
|
||||||
|
@ -518,18 +519,13 @@ define ES_LIST_VIEW_HORIZONTAL (1 << 0) // Layout horizontally instead of vert
|
||||||
define ES_LIST_VIEW_VARIABLE_SIZE (1 << 1) // Each item can be a different size.
|
define ES_LIST_VIEW_VARIABLE_SIZE (1 << 1) // Each item can be a different size.
|
||||||
// You need to respond to the LIST_VIEW_MEASURE_ITEM message.
|
// You need to respond to the LIST_VIEW_MEASURE_ITEM message.
|
||||||
// The size of items cannot depend on the size of the parent.
|
// The size of items cannot depend on the size of the parent.
|
||||||
define ES_LIST_VIEW_TILED (1 << 2) // Multiple items per band. Incompatible with variable size items, columns mode and non-linear mode.
|
define ES_LIST_VIEW_TILED (1 << 2) // Multiple items per band. Incompatible with variable size items and columns mode.
|
||||||
define ES_LIST_VIEW_NON_LINEAR (1 << 3) // Indices within a group are arbitrary values. They must be stable.
|
define ES_LIST_VIEW_SINGLE_SELECT (1 << 3) // One item can be selected. By default, selections are disabled.
|
||||||
// You need to respond to LIST_VIEW_NEXT_INDEX, LIST_VIEW_PREVIOUS_INDEX,
|
define ES_LIST_VIEW_MULTI_SELECT (1 << 4) // Multiple items can be selected.
|
||||||
// LIST_VIEW_COMPARE_INDICES, LIST_VIEW_FIRST_INDEX, and LIST_VIEW_LAST_INDEX messages.
|
define ES_LIST_VIEW_CHOICE_SELECT (1 << 5) // Exactly one item is always selected. Dragging on the list view causes the selection to 'slide' between items.
|
||||||
// If the flag is not set, indices are consecutive within a group, starting at 0.
|
define ES_LIST_VIEW_COLUMNS (1 << 6) // Display a column header and let items have multiple values. Incompatible with horizontal and tiled layouts.
|
||||||
// These are non-stable, but are updated automatically when items are inserted/removed.
|
define ES_LIST_VIEW_FIXED_ITEMS (1 << 7) // Use the fixed item API rather than the callback API.
|
||||||
define ES_LIST_VIEW_SINGLE_SELECT (1 << 4) // One item can be selected. By default, selections are disabled.
|
define ES_LIST_VIEW_CENTER_TILES (1 << 8) // Center tiled items.
|
||||||
define ES_LIST_VIEW_MULTI_SELECT (1 << 5) // Multiple items can be selected.
|
|
||||||
define ES_LIST_VIEW_CHOICE_SELECT (1 << 6) // Exactly one item is always selected. Dragging on the list view causes the selection to 'slide' between items.
|
|
||||||
define ES_LIST_VIEW_COLUMNS (1 << 7) // Display a column header and let items have multiple values. Incompatible with horizontal and tiled layouts.
|
|
||||||
define ES_LIST_VIEW_FIXED_ITEMS (1 << 8) // Use the fixed item API rather than the callback API.
|
|
||||||
define ES_LIST_VIEW_CENTER_TILES (1 << 9) // Center tiled items.
|
|
||||||
|
|
||||||
define ES_LIST_VIEW_GROUP_HAS_HEADER (1 << 0) // The first item in the group is a header.
|
define ES_LIST_VIEW_GROUP_HAS_HEADER (1 << 0) // The first item in the group is a header.
|
||||||
define ES_LIST_VIEW_GROUP_HAS_FOOTER (1 << 1) // The last item in the group is a footer.
|
define ES_LIST_VIEW_GROUP_HAS_FOOTER (1 << 1) // The last item in the group is a footer.
|
||||||
|
@ -1000,13 +996,7 @@ enum EsMessageType {
|
||||||
ES_MSG_TEXTBOX_ACTIVATE_BREADCRUMB = 0x5208 // For EsTextboxUseBreadcrumbOverlay.
|
ES_MSG_TEXTBOX_ACTIVATE_BREADCRUMB = 0x5208 // For EsTextboxUseBreadcrumbOverlay.
|
||||||
|
|
||||||
// List view messages:
|
// List view messages:
|
||||||
ES_MSG_LIST_VIEW_COMPARE_INDICES = 0x5300
|
|
||||||
ES_MSG_LIST_VIEW_NEXT_INDEX = 0x5301
|
|
||||||
ES_MSG_LIST_VIEW_PREVIOUS_INDEX = 0x5302
|
|
||||||
ES_MSG_LIST_VIEW_FIRST_INDEX = 0x5303
|
|
||||||
ES_MSG_LIST_VIEW_LAST_INDEX = 0x5304
|
|
||||||
ES_MSG_LIST_VIEW_FIND_INDEX = 0x5305
|
ES_MSG_LIST_VIEW_FIND_INDEX = 0x5305
|
||||||
ES_MSG_LIST_VIEW_COUNT_ITEMS = 0x5306
|
|
||||||
ES_MSG_LIST_VIEW_MEASURE_RANGE = 0x5307
|
ES_MSG_LIST_VIEW_MEASURE_RANGE = 0x5307
|
||||||
ES_MSG_LIST_VIEW_MEASURE_ITEM = 0x5308
|
ES_MSG_LIST_VIEW_MEASURE_ITEM = 0x5308
|
||||||
ES_MSG_LIST_VIEW_CREATE_ITEM = 0x5309
|
ES_MSG_LIST_VIEW_CREATE_ITEM = 0x5309
|
||||||
|
@ -1546,41 +1536,36 @@ struct EsMessageItemToString {
|
||||||
|
|
||||||
// List view messages.
|
// List view messages.
|
||||||
|
|
||||||
struct EsMessageCompareIndices {
|
|
||||||
int32_t group;
|
|
||||||
EsGeneric left, right;
|
|
||||||
int result;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EsMessageIterateIndex {
|
struct EsMessageIterateIndex {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
|
|
||||||
// FIND_INDEX and FIND_POSITION: (TODO Pass the reference item?)
|
// FIND_INDEX and FIND_POSITION: (TODO Pass the reference item?)
|
||||||
int64_t position;
|
int64_t position;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageItemRange {
|
struct EsMessageItemRange {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric firstIndex, lastIndex;
|
EsListViewIndex firstIndex;
|
||||||
|
uint64_t count;
|
||||||
int64_t result;
|
int64_t result;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageMeasureItem {
|
struct EsMessageMeasureItem {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
int64_t result;
|
int64_t result;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageCreateItem {
|
struct EsMessageCreateItem {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
EsElement *item;
|
EsElement *item;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageGetContent {
|
struct EsMessageGetContent {
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
uint32_t icon;
|
uint32_t icon;
|
||||||
EsBuffer *buffer;
|
EsBuffer *buffer;
|
||||||
bool richText;
|
bool richText;
|
||||||
|
@ -1588,32 +1573,32 @@ struct EsMessageGetContent {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageGetIndent {
|
struct EsMessageGetIndent {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
|
|
||||||
uint8_t indent;
|
uint8_t indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageSelectRange {
|
struct EsMessageSelectRange {
|
||||||
EsGeneric fromIndex, toIndex;
|
EsListViewIndex fromIndex, toIndex;
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
bool select, toggle;
|
bool select, toggle;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageSelectItem {
|
struct EsMessageSelectItem {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
bool isSelected;
|
bool isSelected;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageChooseItem {
|
struct EsMessageChooseItem {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EsMessageSearchItem {
|
struct EsMessageSearchItem {
|
||||||
int32_t group;
|
EsListViewIndex group;
|
||||||
EsGeneric index;
|
EsListViewIndex index;
|
||||||
STRING query;
|
STRING query;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1759,7 +1744,6 @@ struct EsMessage {
|
||||||
const EsStyle *childStyleVariant;
|
const EsStyle *childStyleVariant;
|
||||||
|
|
||||||
// List view messages:
|
// List view messages:
|
||||||
EsMessageCompareIndices compareIndices;
|
|
||||||
EsMessageIterateIndex iterateIndex;
|
EsMessageIterateIndex iterateIndex;
|
||||||
EsMessageItemRange itemRange;
|
EsMessageItemRange itemRange;
|
||||||
EsMessageMeasureItem measureItem;
|
EsMessageMeasureItem measureItem;
|
||||||
|
@ -2369,30 +2353,30 @@ function EsListView *EsListViewCreate(EsElement *parent, uint64_t flags = ES_FLA
|
||||||
const EsStyle *style = ES_NULL, const EsStyle *itemStyle = ES_NULL,
|
const EsStyle *style = ES_NULL, const EsStyle *itemStyle = ES_NULL,
|
||||||
const EsStyle *headerItemStyle = ES_NULL, const EsStyle *footerItemStyle = ES_NULL);
|
const EsStyle *headerItemStyle = ES_NULL, const EsStyle *footerItemStyle = ES_NULL);
|
||||||
|
|
||||||
function EsGeneric EsListViewGetIndexFromItem(EsElement *element, int32_t *group = ES_NULL);
|
function EsListViewIndex EsListViewGetIndexFromItem(EsElement *element, EsListViewIndex *group = ES_NULL);
|
||||||
function void EsListViewEnumerateVisibleItems(EsListView *view, EsListViewEnumerateVisibleItemsCallbackFunction callback);
|
function void EsListViewEnumerateVisibleItems(EsListView *view, EsListViewEnumerateVisibleItemsCallbackFunction callback);
|
||||||
|
|
||||||
function void EsListViewSetColumns(EsListView *view, EsListViewColumn *columns, size_t columnCount);
|
function void EsListViewSetColumns(EsListView *view, EsListViewColumn *columns, size_t columnCount);
|
||||||
function void EsListViewSetEmptyMessage(EsListView *view, STRING message = BLANK_STRING);
|
function void EsListViewSetEmptyMessage(EsListView *view, STRING message = BLANK_STRING);
|
||||||
function void EsListViewSetMaximumItemsPerBand(EsListView *view, int maximumItemsPerBand);
|
function void EsListViewSetMaximumItemsPerBand(EsListView *view, int maximumItemsPerBand);
|
||||||
function void EsListViewSelect(EsListView *view, int32_t group, EsGeneric index);
|
function void EsListViewSelect(EsListView *view, EsListViewIndex group, EsListViewIndex index);
|
||||||
function void EsListViewFocusItem(EsListView *view, int32_t group, EsGeneric index);
|
function void EsListViewFocusItem(EsListView *view, EsListViewIndex group, EsListViewIndex index);
|
||||||
function bool EsListViewGetFocusedItem(EsListView *view, int32_t *group, EsGeneric *index); // Returns false if not item was focused.
|
function bool EsListViewGetFocusedItem(EsListView *view, EsListViewIndex *group, EsListViewIndex *index); // Returns false if not item was focused.
|
||||||
function void EsListViewInvalidateContent(EsListView *view, int32_t group, EsGeneric index);
|
function void EsListViewInvalidateContent(EsListView *view, EsListViewIndex group, EsListViewIndex index);
|
||||||
function void EsListViewInvalidateAll(EsListView *view);
|
function void EsListViewInvalidateAll(EsListView *view);
|
||||||
function void EsListViewContentChanged(EsListView *view);
|
function void EsListViewContentChanged(EsListView *view);
|
||||||
function void EsListViewChangeStyles(EsListView *view, const EsStyle *style, const EsStyle *itemStyle,
|
function void EsListViewChangeStyles(EsListView *view, const EsStyle *style, const EsStyle *itemStyle,
|
||||||
const EsStyle *headerItemStyle, const EsStyle *footerItemStyle, uint32_t addFlags, uint32_t removeFlags);
|
const EsStyle *headerItemStyle, const EsStyle *footerItemStyle, uint32_t addFlags, uint32_t removeFlags);
|
||||||
function void EsListViewScrollToEnd(EsListView *view);
|
function void EsListViewScrollToEnd(EsListView *view);
|
||||||
|
|
||||||
function EsTextbox *EsListViewCreateInlineTextbox(EsListView *view, int32_t group, EsGeneric index, uint32_t flags = ES_FLAGS_DEFAULT);
|
function EsTextbox *EsListViewCreateInlineTextbox(EsListView *view, EsListViewIndex group, EsListViewIndex index, uint32_t flags = ES_FLAGS_DEFAULT);
|
||||||
|
|
||||||
// (Callback items.)
|
// (Callback items.)
|
||||||
function void EsListViewInsertGroup(EsListView *view, int32_t group, uint32_t flags = ES_FLAGS_DEFAULT);
|
function void EsListViewInsertGroup(EsListView *view, EsListViewIndex group, uint32_t flags = ES_FLAGS_DEFAULT);
|
||||||
function void EsListViewInsert(EsListView *view, int32_t group, EsGeneric firstIndex, EsGeneric lastIndex, int64_t count = -1);
|
function void EsListViewInsert(EsListView *view, EsListViewIndex group, EsListViewIndex firstIndex, EsListViewIndex count);
|
||||||
function void EsListViewRemove(EsListView *view, int32_t group, EsGeneric firstIndex, EsGeneric lastIndex, int64_t count = -1);
|
function void EsListViewRemove(EsListView *view, EsListViewIndex group, EsListViewIndex firstIndex, EsListViewIndex count);
|
||||||
function void EsListViewRemoveAll(EsListView *view, int32_t group);
|
function void EsListViewRemoveAll(EsListView *view, EsListViewIndex group);
|
||||||
// (Fixed items.)
|
// (Fixed items.)
|
||||||
function void EsListViewInsertFixedItem(EsListView *view, STRING string = BLANK_STRING, EsGeneric data = ES_NULL, intptr_t index = -1);
|
function void EsListViewInsertFixedItem(EsListView *view, STRING string = BLANK_STRING, EsGeneric data = ES_NULL, EsListViewIndex index = -1);
|
||||||
function bool EsListViewSelectFixedItem(EsListView *view, EsGeneric data); // Returns false if the item was not found.
|
function bool EsListViewSelectFixedItem(EsListView *view, EsGeneric data); // Returns false if the item was not found.
|
||||||
function bool EsListViewGetSelectedFixedItem(EsListView *view, EsGeneric *data); // Returns false if no item was selected.
|
function bool EsListViewGetSelectedFixedItem(EsListView *view, EsGeneric *data); // Returns false if no item was selected.
|
||||||
|
|
|
@ -126,6 +126,8 @@ EsApplicationStart=124
|
||||||
EsINIFormat=125
|
EsINIFormat=125
|
||||||
EsINIZeroTerminate=126
|
EsINIZeroTerminate=126
|
||||||
EsIconIDFromString=127
|
EsIconIDFromString=127
|
||||||
|
EsListViewInsert=130
|
||||||
|
EsListViewRemove=131
|
||||||
EsEventCreate=132
|
EsEventCreate=132
|
||||||
EsEventForward=133
|
EsEventForward=133
|
||||||
EsBufferFormat=134
|
EsBufferFormat=134
|
||||||
|
@ -304,8 +306,6 @@ EsUndoInUndo=307
|
||||||
EsUndoPop=308
|
EsUndoPop=308
|
||||||
EsTextboxSetUndoManager=309
|
EsTextboxSetUndoManager=309
|
||||||
EsListViewInsertGroup=310
|
EsListViewInsertGroup=310
|
||||||
EsListViewInsert=311
|
|
||||||
EsListViewRemove=312
|
|
||||||
EsListViewRemoveAll=313
|
EsListViewRemoveAll=313
|
||||||
EsSystemShowShutdownDialog=314
|
EsSystemShowShutdownDialog=314
|
||||||
EsListViewSetColumns=315
|
EsListViewSetColumns=315
|
||||||
|
|
Loading…
Reference in New Issue