33 while (w->numChildren() != 0) {
34 FXWindow* child = w->childAtIndex(0);
42 const FXString& file) {
43 if (!FXStat::exists(file)) {
47 FXMessageBox::question(parent, MBOX_YES_NO,
TL(
"File Exists"),
TL(
"Overwrite '%s'?"), file.text());
48 if (answer == MBOX_CLICKED_NO) {
57 return FXPath::name(filename);
63 if (filename.length() == 0) {
72 const auto extensions =
parseExtensions(openDialog.getPatternText(openDialog.getCurrentPattern()));
73 const auto filename = openDialog.getFilename();
75 for (
const auto& extension : extensions) {
76 if (extension.length() < filename.length()) {
77 bool sameExtension =
true;
78 for (
auto i = 0; i < extension.length(); i++) {
79 if (filename[i + filename.length() - extension.length()] != extension[i]) {
80 sameExtension =
false;
89 if (extensions.size() > 0) {
90 return filename +
"." + extensions.front();
99 std::vector<FXString> extensions;
101 patternText = patternText.after(
'(');
102 patternText = patternText.before(
')');
104 if (patternText !=
"*") {
107 for (
const auto& extensionStr : extensionsStr) {
108 FXString extension = extensionStr.c_str();
109 extensions.push_back(extension.after(
'.'));
118 FXIcon* icon, FXString& currentFolder) {
120 FXFileDialog opendialog(parent, header);
121 opendialog.setIcon(icon);
122 opendialog.setSelectMode(SELECTFILE_ANY);
123 opendialog.setPatternList(extensions);
124 if (currentFolder.length() != 0) {
125 opendialog.setDirectory(currentFolder);
127 if (!opendialog.execute()) {
134 currentFolder = opendialog.getDirectory();
141 return RGBColor(FXREDVAL(col), FXGREENVAL(col), FXBLUEVAL(col), FXALPHAVAL(col));
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extensions, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
static void deleteChildren(FXWindow *w)
Deletes all children of the given window.
static FXString getDocumentName(const FXString &filename)
Returns the document name.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
static RGBColor getRGBColor(FXColor col)
converts FXColor to RGBColor
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
static std::vector< FXString > parseExtensions(FXString patternText)
parse extensions
static FXString assureExtension(const FXFileDialog &openDialog)
Corrects missing extension.
unsigned char red() const
Returns the red-amount of the color.
unsigned char alpha() const
Returns the alpha-amount of the color.
unsigned char green() const
Returns the green-amount of the color.
unsigned char blue() const
Returns the blue-amount of the color.
std::vector< std::string > getVector()
return vector of strings