sptk2 logo
SPTK Home Page
CFileDialog.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29#include <sptk5/DirectoryDS.h>
30#include <sptk5/Strings.h>
31#include <sptk5/gui/CComboBox.h>
32#include <sptk5/gui/CDataControl.h>
33#include <sptk5/gui/CDialog.h>
34#include <sptk5/gui/CListView.h>
35
36namespace sptk {
37
49class SP_EXPORT CFileDialog : public CDialog
50{
51protected:
56
61
66
71
76
77
83 static String removeTrailingSlash(const String& dirname);
84
88 static void new_folder_cb(Fl_Widget*, void*);
89
93 static void home_cb(Fl_Widget*, void*);
94
98 static void up_cb(Fl_Widget*, void*);
99
103 static void dirview_cb(Fl_Widget* w, void*);
104
108 static void lookin_cb(Fl_Widget* w, void*);
109
113 static void pattern_cb(Fl_Widget* w, void*);
114
119
123 static const char slashChar;
124
128 static const char slashStr[];
129
135 CFileDialog(const String& label, bool saveMode);
136
137public:
142 {
143 return m_directory.directory();
144 }
145
149 void directory(const String& p);
150
155
160 void setPattern(const String& patternName);
161
167 void addPattern(const String& patternName, const String& pattern);
168
173
178 void refreshDirectory(const String& dirName = "");
179
185 {
186 return m_fileNameInput->data().asString();
187 }
188
194
199 void fileName(const String& fileName);
200
204 bool execute();
205};
209}
Combo box widget.
Definition: CComboBox.h:461
Definition: CDialog.h:126
Base class for CFileOpenDialog and CFileSaveDialog.
Definition: CFileDialog.h:50
static String removeTrailingSlash(const String &dirname)
Removes a trailing slash in the directory name.
static void new_folder_cb(Fl_Widget *, void *)
void fileName(const String &fileName)
CComboBox * m_lookInCombo
Definition: CFileDialog.h:65
String pattern() const
static void home_cb(Fl_Widget *, void *)
static void lookin_cb(Fl_Widget *w, void *)
void directory(const String &p)
static void dirview_cb(Fl_Widget *w, void *)
DirectoryDS m_directory
Definition: CFileDialog.h:55
CListView * m_directoryView
Definition: CFileDialog.h:60
void addPattern(const String &patternName, const String &pattern)
String directory() const
Definition: CFileDialog.h:141
String fullFileName() const
CFileDialog(const String &label, bool saveMode)
CComboBox * m_patternCombo
Definition: CFileDialog.h:75
String fileName() const
Definition: CFileDialog.h:184
static void up_cb(Fl_Widget *, void *)
void setPattern(const String &patternName)
static const char slashChar
Definition: CFileDialog.h:123
void refreshDirectory(const String &dirName="")
CInput * m_fileNameInput
Definition: CFileDialog.h:70
static void pattern_cb(Fl_Widget *w, void *)
Definition: CInput.h:197
Variant data() const override
List view widget.
Definition: CListView.h:108
Directory datasource.
Definition: DirectoryDS.h:64
void directory(const String &d)
Definition: String.h:49
virtual String asString() const

Fri Oct 14 2022 09:58:31: SPTK 5.4.1