00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
#ifndef FILEDIALOG_H
00028
#define FILEDIALOG_H
00029
#include <vdk/vdk.h>
00030
00031
00032
00033
#define _USE_FNMATCH
00034
00035
#ifndef _USE_FNMATCH
00036
# include <regex.h>
00037
#else
00038
# include <fnmatch.h>
00039
#endif
00040
00041
#include <dirent.h>
00042
extern "C" {
00043
#include <sys/stat.h>
00044 }
00045
00046
00047
typedef VDKArray<VDKString> FileStringArray;
00048
typedef VDKValueList<VDKString> FileStringList;
00049
typedef VDKValueListIterator<VDKString> FileStringListIterator;
00078 class VDKFileDialog:
public VDKForm
00079 {
00080
VDKBox* listbox;
00081
VDKString home;
00082
bool init();
00083 FileStringList* load_dir(
char* dir,
int mask);
00084
00085 FileStringList* filter(FileStringList* list,
int mode = 0);
00086
void LoadFileList(FileStringList* list);
00087
void LoadDirList(FileStringList* list);
00088
void LoadDir(
char* dir = (
char*) NULL);
00089
protected:
00090
VDKString first_pcwd,pcwd;
00091 FileStringArray* selections;
00092
VDKCustomList *dirlist;
00093
VDKCustomList *filelist;
00094
VDKEntry *filetype;
00095
VDKCustomButton *open,*cancel;
00096
VDKLabel *dir_label,*filetypeLabel;
00097
VDKCheckButton *hiddenCb;
00098
bool DirListDoubleClick(
VDKObject* sender);
00099
bool OpenClick(
VDKObject*);
00100
bool CancelClick(
VDKObject*);
00101
bool ToggleHidden(
VDKObject*);
00102
bool SetFileMask(
VDKObject*);
00103
public:
00107 VDKReadWriteValueProp<VDKFileDialog,VDKString>
Filter;
00108
VDKFileDialog(
VDKForm* owner,
00109 FileStringArray* selections,
00110
char* title =
"",
00111 GtkWindowType display = GTK_WINDOW_TOPLEVEL);
00112
virtual ~
VDKFileDialog() {}
00113
bool CanClose();
00114 virtual void Setup(
void) {}
00115
virtual void OnShow(
VDKForm*);
00116
void SetFilter(
VDKString f)
00117 { Filter(f); }
00118
VDKString GetFilter(
void)
00119 {
00120
VDKString filter =
Filter;
00121
return VDKString(filter);
00122 }
00123 DECLARE_SIGNAL_MAP(
VDKFileDialog);
00124 };
00125
00126
#endif