native-filechooser: add call to fl_register_images() and explain why

This commit is contained in:
ManoloFLTK 2024-03-03 08:33:27 +01:00
parent 4db9391525
commit 2e315e5424
1 changed files with 12 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#include <FL/Fl_Native_File_Chooser.H> #include <FL/Fl_Native_File_Chooser.H>
#include <FL/Fl_Help_View.H> #include <FL/Fl_Help_View.H>
#include <FL/Fl_Terminal.H> #include <FL/Fl_Terminal.H>
#include <FL/Fl_Shared_Image.H>
#define TERMINAL_HEIGHT 120 #define TERMINAL_HEIGHT 120
@ -80,13 +81,18 @@ void PickDir_CB(Fl_Widget*, void*) {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
//// For a nicer looking browser under linux, call Fl_File_Icon::load_system_icons(); /* For a nicer looking browser under linux/unix, call fl_register_images()
//// (If you do this, you'll need to link with fltk_images) (If you do this, you'll need to link with fltk_images).
//// NOTE: If you do not load the system icons, the file chooser will still work, but That's required for the preview option of the GTK filechooser.
//// no icons will be shown. However, this means you do not need to link in the In the unlikely situation where no native filechooser is found on
//// fltk_images library, potentially reducing the size of your executable. the active Linux system, FLTK reverts to using its own file chooser
//// Loading the system icons is not required by the OSX or Windows native file choosers. (Fl_File_Chooser) which looks best if you also call
Fl_File_Icon::load_system_icons().
None of that is useful for the native file chooser under macOS or Windows.
*/
#if !defined(_WIN32) && !defined(__APPLE__) #if !defined(_WIN32) && !defined(__APPLE__)
fl_register_images();
Fl_File_Icon::load_system_icons(); Fl_File_Icon::load_system_icons();
#endif #endif