diff options
| author | Trent McPheron <twilightinzero@gmail.com> | 2022-04-03 20:04:00 -0400 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-12-16 16:21:23 +0100 |
| commit | 576271fb04e1c2f9ba1f95c0399fef2f73af3b06 (patch) | |
| tree | 3740f4878b837a1254cd3f7becc97321c1d0f31c /src/Fl_Native_File_Chooser_Zenity.H | |
| parent | 2ddb27f0f293eb0e57e32194e4f48c72614500ab (diff) | |
Add Zenity-based file chooser based on the KDialog one (HugLifeTiZ)
If available, it is used on Linux regardless of the current desktop because
it offers free XDG portal integration, which means it picks the correct file
chooser on all desktops, and allows for meaningful file selection in sandbox
environments like Flatpak.
Diffstat (limited to 'src/Fl_Native_File_Chooser_Zenity.H')
| -rw-r--r-- | src/Fl_Native_File_Chooser_Zenity.H | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/Fl_Native_File_Chooser_Zenity.H b/src/Fl_Native_File_Chooser_Zenity.H new file mode 100644 index 000000000..90614bb4f --- /dev/null +++ b/src/Fl_Native_File_Chooser_Zenity.H @@ -0,0 +1,54 @@ +// +// FLTK native file chooser widget : Zenity version +// +// Copyright 2021-2022 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +#ifndef FL_ZENITY_NATIVE_FILE_CHOOSER_H +#define FL_ZENITY_NATIVE_FILE_CHOOSER_H 1 + +#include <FL/Fl_Native_File_Chooser.H> + +class FL_EXPORT Fl_Zenity_Native_File_Chooser_Driver : public Fl_Native_File_Chooser_FLTK_Driver { + friend class Fl_Native_File_Chooser; + struct fnfc_pipe_struct { + char *all_files; + int fd; + }; + static void fnfc_fd_cb(int fd, fnfc_pipe_struct *data); + char **_pathnames; + int _tpathnames; + char *_directory; + char *_preset_file; + char *_title; + static bool did_find_zenity; + static bool have_looked_for_zenity; + Fl_Zenity_Native_File_Chooser_Driver(int val); + ~Fl_Zenity_Native_File_Chooser_Driver(); + int count() const; + const char *filename() const; + const char *filename(int i) const; + int show(); + char *parse_filter(const char *f); + const char *filter() const; + virtual void filter(const char *f); + int filters() const; + void preset_file(const char *val); + const char *preset_file() const; + void directory(const char *val); + const char *directory() const; + void title(const char *val); + const char *title() const; +}; + +#endif // FL_ZENITY_NATIVE_FILE_CHOOSER_H |
