vdk 2.4.0
Main Page
Related Pages
Classes
Files
File List
vdk
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>
42
extern
"C"
{
43
#include <sys/stat.h>
44
}
45
46
//
47
typedef
VDKArray<VDKString>
FileStringArray
;
48
typedef
VDKValueList<VDKString>
FileStringList
;
49
typedef
VDKValueListIterator<VDKString>
FileStringListIterator
;
78
class
VDKFileDialog
:
public
VDKForm
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
Generated on Wed Mar 12 2014 15:03:43 for vdk 2.4.0 by
1.8.1.2