public MyGuiControlDirectoryBrowser(string topMostDirectory = null, string initialDirectory = null, Predicate <DirectoryInfo> dirPredicate = null, Predicate <FileInfo> filePredicate = null) { // Empty strings are also considered invalid if (!string.IsNullOrEmpty(topMostDirectory)) { m_topMostDir = new DirectoryInfo(topMostDirectory); } if (!string.IsNullOrEmpty(initialDirectory)) { m_currentDir = new DirectoryInfo(initialDirectory); } else { m_currentDir = new DirectoryInfo(Directory.GetCurrentDirectory()); } DirPredicate = dirPredicate; FilePredicate = filePredicate; FolderCellIconTexture = MyGuiConstants.TEXTURE_ICON_MODS_LOCAL; FolderCellIconAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; ItemDoubleClicked += OnItemDoubleClicked; // Init basic look for less usage confusion ColumnsCount = 2; SetCustomColumnWidths(new float[] { 0.65f, 0.35f }); SetColumnName(0, MyTexts.Get(MyCommonTexts.Name)); SetColumnName(1, MyTexts.Get(MyCommonTexts.Created)); SetColumnComparison(0, (cellA, cellB) => cellA.Text.CompareToIgnoreCase(cellB.Text)); SetColumnComparison(1, (cellA, cellB) => cellB.Text.CompareToIgnoreCase(cellA.Text)); m_cancelEvent = new MyDirectoryChangeCancelEventArgs(null, null, this); Refresh(); }
public MyGuiControlDirectoryBrowser(string topMostDirectory = null, string initialDirectory = null, Predicate<DirectoryInfo> dirPredicate = null, Predicate<FileInfo> filePredicate = null) { // Empty strings are also considered invalid if(!string.IsNullOrEmpty(topMostDirectory)) { m_topMostDir = new DirectoryInfo(topMostDirectory); } if(!string.IsNullOrEmpty(initialDirectory)) { m_currentDir = new DirectoryInfo(initialDirectory); } else { m_currentDir = new DirectoryInfo(Directory.GetCurrentDirectory()); } DirPredicate = dirPredicate; FilePredicate = filePredicate; FolderCellIconTexture = MyGuiConstants.TEXTURE_ICON_MODS_LOCAL; FolderCellIconAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER; ItemDoubleClicked += OnItemDoubleClicked; // Init basic look for less usage confusion ColumnsCount = 2; SetCustomColumnWidths(new float[] { 0.65f, 0.35f }); SetColumnName(0, MyTexts.Get(MyCommonTexts.Name)); SetColumnName(1, MyTexts.Get(MyCommonTexts.Created)); SetColumnComparison(0, (cellA, cellB) => cellA.Text.CompareToIgnoreCase(cellB.Text)); SetColumnComparison(1, (cellA, cellB) => cellB.Text.CompareToIgnoreCase(cellA.Text)); m_cancelEvent = new MyDirectoryChangeCancelEventArgs(null, null, this); Refresh(); }