filelist_view.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef __RTGUI_FILELIST_VIEW_H__
  2. #define __RTGUI_FILELIST_VIEW_H__
  3. #include <rtgui/widgets/view.h>
  4. #if defined(RTGUI_USING_DFS_FILERW) || defined(RTGUI_USING_STDIO_FILERW)
  5. #define RTGUI_FITEM_FILE 0x0
  6. #define RTGUI_FITEM_DIR 0x1
  7. struct rtgui_file_item
  8. {
  9. char* name;
  10. rt_uint32_t type;
  11. rt_uint32_t size;
  12. };
  13. /** Gets the type of a filelist view */
  14. #define RTGUI_FILELIST_VIEW_TYPE (rtgui_filelist_view_type_get())
  15. /** Casts the object to a filelist */
  16. #define RTGUI_FILELIST_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_FILELIST_VIEW_TYPE, rtgui_filelist_view_t))
  17. /** Checks if the object is a filelist view */
  18. #define RTGUI_IS_FILELIST_VIEW(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_FILELIST_VIEW_TYPE))
  19. struct rtgui_filelist_view
  20. {
  21. struct rtgui_view parent;
  22. /* widget private data */
  23. /* current directory */
  24. char* current_directory;
  25. char* pattern;
  26. /* the number of item in a page */
  27. rt_uint16_t page_items;
  28. rt_uint16_t items_count;
  29. /* the selected item */
  30. rt_uint16_t current_item;
  31. /* items array */
  32. struct rtgui_file_item *items;
  33. };
  34. typedef struct rtgui_filelist_view rtgui_filelist_view_t;
  35. rtgui_type_t *rtgui_filelist_view_type_get(void);
  36. rtgui_filelist_view_t* rtgui_filelist_view_create(rtgui_workbench_t* workbench,
  37. const char* directory, const char* pattern, const rtgui_rect_t* rect);
  38. void rtgui_filelist_view_destroy(rtgui_filelist_view_t* view);
  39. rt_bool_t rtgui_filelist_view_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
  40. void rtgui_filelist_view_set_directory(rtgui_filelist_view_t* view, const char* directory);
  41. void rtgui_filelist_view_get_fullpath(rtgui_filelist_view_t* view, char* path, rt_size_t len);
  42. #endif
  43. #endif