| 1 | // This file is part of SmallBASIC |
| 2 | // |
| 3 | // Copyright(C) 2001-2019 Chris Warren-Smith. |
| 4 | // |
| 5 | // This program is distributed under the terms of the GPL v2.0 or later |
| 6 | // Download the GNU Public License (GPL) from www.gnu.org |
| 7 | // |
| 8 | |
| 9 | #ifndef FILE_WIDGET_H |
| 10 | #define FILE_WIDGET_H |
| 11 | |
| 12 | #include <limits.h> |
| 13 | #include "platform/fltk/HelpWidget.h" |
| 14 | #include "platform/fltk/EditorWidget.h" |
| 15 | |
| 16 | struct FileWidget : public HelpWidget { |
| 17 | FileWidget(Fl_Widget *rect, int fontSize); |
| 18 | ~FileWidget(); |
| 19 | |
| 20 | static const char *forwardSlash(char *filename); |
| 21 | static const char *splitPath(const char *filename, char *path); |
| 22 | static const char *trimEOL(char *buffer); |
| 23 | |
| 24 | void anchorClick(); |
| 25 | void fileOpen(EditorWidget *saveEditorAs); |
| 26 | void openPath(const char *newPath, StringList *recentPaths); |
| 27 | |
| 28 | private: |
| 29 | void changeDir(const char *target); |
| 30 | void setDir(const char *target); |
| 31 | void displayPath(); |
| 32 | void enterPath(); |
| 33 | int handle(int e); |
| 34 | void saveAs(); |
| 35 | |
| 36 | char _path[PATH_MAX + 1]; |
| 37 | EditorWidget *_saveEditorAs; |
| 38 | StringList *_recentPaths; |
| 39 | }; |
| 40 | |
| 41 | #endif |
| 42 | |