home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Examples / LazyScrollDir / DirArray.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-08  |  1.9 KB  |  75 lines

  1. #ifndef __DirArray_h
  2. #define __DirArray_h
  3. //=============================================================================
  4. //
  5. //        Copyright (C) 1995,1996 by Paul S. McCarthy and Eric Sunshine.
  6. //                Written by Paul S. McCarthy and Eric Sunshine.
  7. //                            All Rights Reserved.
  8. //
  9. //        This notice may not be removed from this source code.
  10. //
  11. //        This object is included in the MiscKit by permission from the authors
  12. //        and its use is governed by the MiscKit license, found in the file
  13. //        "License.rtf" in the MiscKit distribution.    Please refer to that file
  14. //        for a list of all applicable permissions and restrictions.
  15. //
  16. //=============================================================================
  17. //-----------------------------------------------------------------------------
  18. // DirArray.h
  19. //
  20. //        An extensible array of directory entries.
  21. //
  22. //-----------------------------------------------------------------------------
  23. //-----------------------------------------------------------------------------
  24. // $Id$
  25. // $Log$
  26. //-----------------------------------------------------------------------------
  27.  
  28. #import <objc/Object.h>
  29. #import <sys/dir.h>
  30. #import <sys/stat.h>
  31.  
  32. @class DirArray;
  33. @class NXImage;
  34.  
  35. typedef struct DirEntryStruct
  36.     {
  37.     DirArray*    dir;
  38.     char*        name;
  39.     char*        soft_link;
  40.     NXImage*    image;
  41.     int            err;
  42.     struct stat st;
  43.     } DirEntry;
  44.  
  45.  
  46. @interface DirArray : Object
  47.     {
  48.     char*        name;
  49.     size_t        total_bytes;
  50.     int            num_entries;
  51.     int            max_entries;
  52.     DirEntry*    entries;
  53.     };
  54.  
  55. - init;
  56. - free;
  57. - (void) empty;
  58. - (int) count;
  59. - (int) totalBytes;
  60. - (DirEntry const*) entryAt:(int)n;
  61. - (void) addName:(char const*)name path:(char const*)fullpath;
  62. - (void) remove:(int)n;
  63.  
  64. // Returns: 0 = success, else could not open directory and returns errno value.
  65. - (int) loadPath:(char const*)path showHidden:(BOOL)flag;
  66.  
  67. - (BOOL) isDir:(DirEntry const*)entry;
  68. - (BOOL) isDirAt:(int)n;
  69. - (NXImage*) getImage:(DirEntry const*)entry;
  70. - (NXImage*) getImageAt:(int)n;
  71.  
  72. @end
  73.  
  74. #endif // __DirArray_h
  75.