filelist_view.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __RTGUI_FILELIST_VIEW_H__
  2. #define __RTGUI_FILELIST_VIEW_H__
  3. #include <rtgui/widgets/view.h>
  4. #include <rtgui/widgets/scrollbar.h>
  5. #include <rtgui/kbddef.h>
  6. #include <rtgui/color.h>
  7. #define RTGUI_FITEM_FILE 0x0
  8. #define RTGUI_FITEM_DIR 0x1
  9. typedef struct rtgui_fileview rtgui_filelist_view_t;
  10. /** Gets the type of a filelist view */
  11. #define RTGUI_FILELIST_VIEW_TYPE (rtgui_filelist_view_type_get())
  12. /** Casts the object to a filelist */
  13. #define RTGUI_FILELIST_VIEW(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_FILELIST_VIEW_TYPE, rtgui_filelist_view_t))
  14. /** Checks if the object is a filelist view */
  15. #define RTGUI_IS_FILELIST_VIEW(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_FILELIST_VIEW_TYPE))
  16. typedef struct rtgui_file_item
  17. {
  18. char* name;
  19. rt_uint32_t type;
  20. rt_uint32_t size;
  21. }rtgui_filelist_view_item_t;
  22. struct rtgui_fileview
  23. {
  24. rtgui_container_t parent;
  25. /* widget private data */
  26. char* current_dir; //当前文件夹current_dir
  27. char* pattern; //文件查找类型
  28. rt_int16_t item_per_page; //每页可显示条数
  29. rt_int16_t item_count; //总条数
  30. rt_int16_t frist_aloc;/* frist item */
  31. rt_int16_t now_aloc; /* now item */
  32. rt_int16_t old_aloc; /* old item */
  33. rtgui_scrollbar_t *sbar; //卷标
  34. rtgui_filelist_view_item_t *items; /* items array */
  35. };
  36. rtgui_type_t *rtgui_filelist_view_type_get(void);
  37. rtgui_filelist_view_t* rtgui_filelist_view_create(PVOID parent, const char* directory, const char* pattern, int left, int top, int w, int h);
  38. void rtgui_filelist_view_destroy(rtgui_filelist_view_t* view);
  39. rt_bool_t rtgui_filelist_view_event_handler(PVOID wdt, rtgui_event_t* event);
  40. void rtgui_filelist_view_set_directory(rtgui_filelist_view_t* view, const char* directory);
  41. void rtgui_filelist_view_on_enter(rtgui_filelist_view_t* fview);
  42. void rtgui_filelist_view_get_fullpath(rtgui_filelist_view_t* view, char* path, rt_size_t len);
  43. #endif