28 static void backFolder() {
30 strcpy(fullpath,fileBrowser->path->getText());
31 for (
int i=strlen(fullpath)-2; i>=0; i--) {
32 if (fullpath[i]==
'/') {
37 fileBrowser->path->setText(fullpath);
38 fileBrowser->loadFolders();
39 fileBrowser->loadFiles();
42 static void forwardFolder(
const char item[]) {
44 sprintf(fullpath,
"%s%s/",fileBrowser->path->getText(),item);
45 fileBrowser->path->setText(fullpath);
46 fileBrowser->loadFolders();
47 fileBrowser->loadFiles();
50 static void selectFile(
const char item[]) {
51 sprintf(fullname,
"%s%s",fileBrowser->path->getText(),item);
52 fileBrowser->dispose();
58 back =
new Button(10,13,13,14,
"<");
59 path =
new Label(25,10,365,20,
"/home/");
60 folders =
new List(10,40,185,145);
61 files =
new List(205,40,185,145);
70 back->action = &backFolder;
71 folders->doubleClicked = &forwardFolder;
72 files->doubleClicked = &selectFile;
81 if ((dir = opendir (path->getText())) != NULL) {
82 while ((ent = readdir (dir)) != NULL) {
83 if (ent->d_name[0]==
'.')
continue;
84 if (ent->d_type == 4) {
85 folders->add(ent->d_name);
97 if ((dir = opendir (path->getText())) != NULL) {
98 while ((ent = readdir (dir)) != NULL) {
99 if (ent->d_name[0]==
'.')
continue;
100 if (ent->d_type != 4) {
101 files->add(ent->d_name);
109 static const char* searchFile() {
118 #endif // FILEBROWSER
The FileBrowser class show a frame useful to search a file. This interface is created using the Simpl...
Definition: filebrowser.h:21
The Label class is the most simple visual class, useful show information to an application final user...
Definition: simplegui.h:106
The List class is a containter of textual items, it object can be stored more items as it can to show...
Definition: simplegui.h:292
The Frame class manage all visual objects: Labels, InputText, Buttons, Lists, so on. One frame works like a window, and send all actions to each object after use them.
Definition: simplegui.h:454