vdk 2.4.0
FileDialog.h
1/*
2 * ===========================
3 * VDK Visual Develeopment Kit
4 * Version 0.4
5 * October 1998
6 * ===========================
7 *
8 * Copyright (C) 1998, Mario Motta
9 * Developed by Mario Motta <mmotta@guest.net>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 * 02111-1307, USA.
25 */
26
27#ifndef FILEDIALOG_H
28#define FILEDIALOG_H
29#include <vdk/vdk.h>
30
31// undef this and you can use regex library
32// so in dialog filter: '*\.(cc|h)$'
33#define _USE_FNMATCH
34
35#ifndef _USE_FNMATCH
36# include <regex.h>
37#else
38# include <fnmatch.h>
39#endif
40
41#include <dirent.h>
42extern "C" {
43#include <sys/stat.h>
44}
45
46//
79{
80 VDKBox* listbox;
81 VDKString home;
82 bool init();
83 FileStringList* load_dir(char* dir, int mask);
84 // mode == 0 filter dirs, 1 filters files
85 FileStringList* filter(FileStringList* list, int mode = 0);
86 void LoadFileList(FileStringList* list);
87 void LoadDirList(FileStringList* list);
88 void LoadDir(char* dir = (char*) NULL);
89 protected:
90 VDKString first_pcwd,pcwd;
91 FileStringArray* selections;
92 VDKCustomList *dirlist;
93 VDKCustomList *filelist;
94 VDKEntry *filetype;
95 VDKCustomButton *open,*cancel;
96 VDKLabel *dir_label,*filetypeLabel;
97 VDKCheckButton *hiddenCb;
98 bool DirListDoubleClick(VDKObject* sender);
99 bool OpenClick(VDKObject*);
100 bool CancelClick(VDKObject*);
101 bool ToggleHidden(VDKObject*);
102 bool SetFileMask(VDKObject*);
103 public:
107 VDKReadWriteValueProp<VDKFileDialog,VDKString> Filter;
108 VDKFileDialog(VDKForm* owner,
109 FileStringArray* selections,
110 char* title = "",
111 GtkWindowType display = GTK_WINDOW_TOPLEVEL);
112 virtual ~VDKFileDialog() {}
113 bool CanClose();
114 virtual void Setup(void) {}
115 virtual void OnShow(VDKForm*);
116 void SetFilter(VDKString f)
117 { Filter(f); }
118 VDKString GetFilter(void)
119 {
120 VDKString filter = Filter;
121 return VDKString(filter);
122 }
123 DECLARE_SIGNAL_MAP(VDKFileDialog);
124};
125
126#endif
provides a templatized array
Definition: vdkarray.h:73
One of the most used widget containers.
Definition: boxes.h:38
this calls provides a check button widget
Definition: checkbutton.h:45
This class provides an unified wrapper for almost all kind of GtkButton.
Definition: vdkcustombutton.h:48
This class wraps gtkclist widget.
Definition: vdkclist.h:99
This class provides a gtkentry wrapper.
Definition: entry.h:47
Provides a file selection modal window that supports multiple file selection.
Definition: FileDialog.h:79
VDKReadWriteValueProp< VDKFileDialog, VDKString > Filter
Definition: FileDialog.h:107
virtual void Setup(void)
Definition: FileDialog.h:114
bool CanClose()
Definition: FileDialog.cc:196
VDKForm widgets, generally the outermost widget container.
Definition: forms.h:69
Provides a gtklabel wrapper.
Definition: label.h:41
Definition: vdkobj.h:141
Implements famous cont referenced string objects.
Definition: vdkstring.h:46
provides a VDKValueList iterator
Definition: value_sem_list.h:180