summaryrefslogtreecommitdiff
path: root/apps/tree.h
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-12-14 13:37:58 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-12-14 13:37:58 +0000
commit08af5d84044a7f18a619e1cb38cd183819be41b9 (patch)
treee441cf84b0268e5b008d044902641f063f218152 /apps/tree.h
parentfbd75fcc86304ccf44ad8174c91684b687a877ec (diff)
downloadrockbox-08af5d84044a7f18a619e1cb38cd183819be41b9.tar.gz
rockbox-08af5d84044a7f18a619e1cb38cd183819be41b9.zip
FS#11777: enhancement for rockbox_browse()
* Add struct browse_context to be passed to rockbox_browse. * Show proper title when selecting e.g. .wps file or .sbs file from the settings menu. * Add select only mode to rockbox_browse(). when a file is selected, it's path is stored to buffer and the browser exits without 'playing' the file. this will allow to use the browser in more places to select file including plugins. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28831 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.h')
-rw-r--r--apps/tree.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/apps/tree.h b/apps/tree.h
index a74960f7a5..103a20eea6 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -24,6 +24,7 @@
24#include <stdbool.h> 24#include <stdbool.h>
25#include <applimits.h> 25#include <applimits.h>
26#include <file.h> 26#include <file.h>
27#include "icon.h"
27 28
28struct entry { 29struct entry {
29 short attr; /* FAT attributes + file type flags */ 30 short attr; /* FAT attributes + file type flags */
@@ -32,6 +33,26 @@ struct entry {
32}; 33};
33 34
34 35
36#define BROWSE_SELECTONLY 0x0001 /* exit on selecting a file */
37#define BROWSE_SELECTED 0x0100 /* this bit is set if user selected item */
38
39struct tree_context;
40
41struct browse_context {
42 int dirfilter;
43 unsigned flags; /* ored BROWSE_* */
44 bool (*callback_show_item)(char *name, int attr, struct tree_context *tc);
45 /* callback function to determine to show/hide
46 the item for custom browser */
47 char *title; /* title of the browser. if set to NULL,
48 directory name is used. */
49 enum themable_icons icon; /* title icon */
50 const char *root; /* full path of start directory */
51 const char *selected; /* name of selected file in the root */
52 char *buf; /* buffer to store selected file */
53 size_t bufsize; /* size of the buffer */
54};
55
35/* browser context for file or db */ 56/* browser context for file or db */
36struct tree_context { 57struct tree_context {
37 /* The directory we are browsing */ 58 /* The directory we are browsing */
@@ -68,6 +89,7 @@ struct tree_context {
68 int dentry_size; 89 int dentry_size;
69 bool dirfull; 90 bool dirfull;
70 int sort_dir; /* directory sort order */ 91 int sort_dir; /* directory sort order */
92 struct browse_context *browse;
71}; 93};
72 94
73void tree_drawlists(void); 95void tree_drawlists(void);
@@ -76,7 +98,11 @@ void tree_gui_init(void) INIT_ATTR;
76char* get_current_file(char* buffer, size_t buffer_len); 98char* get_current_file(char* buffer, size_t buffer_len);
77void set_dirfilter(int l_dirfilter); 99void set_dirfilter(int l_dirfilter);
78void set_current_file(const char *path); 100void set_current_file(const char *path);
79int rockbox_browse(const char *root, int dirfilter); 101void browse_context_init(struct browse_context *browse,
102 int dirfilter, unsigned flags,
103 char *title, enum themable_icons icon,
104 const char *root, const char *selected);
105int rockbox_browse(struct browse_context *browse);
80bool create_playlist(void); 106bool create_playlist(void);
81void resume_directory(const char *dir); 107void resume_directory(const char *dir);
82#ifdef WIN32 108#ifdef WIN32