5 public class FileListItem : struct
12 void OnDisplay(Surface surface, int x, int y, int width, ExplorerListBox icons, Alignment alignment, DataDisplayFlags displayFlags)
14 int indentSize = (displayFlags.dropBox) ? 0 : 10;
17 char label[MAX_FILENAME];
19 Bitmap icon = icons.icons[type].bitmap;
22 if(type == folder || type == folderOpen)
23 surface.SetForeground(red); //Color { 170, 170, 0 } // REDJ What is that color?
26 textOffset = indent * indentSize + (icon ? (icon.width + 4) : 0);
29 sprintf(label, "%s [%s]", name, info);
35 (alignment, x + textOffset, y + 2, width - textOffset, label, len);
37 surface.Blit(icon, x + indent * indentSize, y,0,0, icon.width, icon.height);
40 int OnCompare(FileListItem b)
43 if(type == b.type || (type < folder && b.type < folder) || (type >= drive))
44 result = strcmpi(name, b.name);
47 if(type == folder && b.type < folder) result = -1;
48 else if(type < folder && b.type == folder) result = 1;
53 void OnCopy(FileListItem newData)
56 indent = newData.indent;
59 int len = strlen(newData.name) + 1;
61 CopyBytes(name, newData.name, len);
65 bool OnGetDataFromString(char * string)
67 int len = strlen(string) + 1;
69 CopyBytes(name, string, len);
79 char * OnGetString(char * string, void * fieldData, bool * needClass)
85 FileListItem MakeFileListItem(const FileAttribs attribs, const char * name, const char * extension)
87 FileListItem fileListRow { };
88 fileListRow.name = CopyString(name);
89 if(attribs.isDirectory)
91 fileListRow.type = (attribs.isDrive) ? drive : folder;
92 if(attribs.isServer) fileListRow.type = server;
93 if(attribs.isShare) fileListRow.type = share;
94 if(attribs.isCDROM) fileListRow.type = cdrom;
95 if(attribs.isRemote) fileListRow.type = netDrive;
96 if(attribs.isRemovable)
98 if(name[0] == 'A' || name[0] == 'B')
99 fileListRow.type = floppy;
101 fileListRow.type = removable;
105 fileListRow.type = FileItemType::SelectByExtension(extension);