Search code examples
fltk

fltk set Fl_File_Chooser's Fl_File_Browser's selection_color


I am using fltk 1.3.2.

I couldn't find the way Fl_File_Chooser's Fl_File_Browser's selection_color but I needed it.

I looked at the codes of Fl_File_Chooser to inherit for my custom file chooser but the fileList item (type Fl_File_Browser) is in private part of the class.

I don't understand why fltk developers put the items in private part instead of protected part. If they put them in protected part we can inherit and add custom functions.

I had to edit library files. There was no other way I could do it.


Solution

  • I simply put a function that is named setFileBrowserSelectionColor in Fl_File_Chooser.H's public part.

    class FL_EXPORT Fl_File_Chooser {
    public:
    ...
      void setFileBrowserSelectionColor(Fl_Color color) {
        fileList->selection_color(color);
      }
    ...