1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /** @file 3 * Path parameter for extensions 4 *//* 5 * Authors: 6 * Patrick Storz <eduard.braun2@gmx.de> 7 * 8 * Copyright (C) 2019 Authors 9 * 10 * Released under GNU GPL v2+, read the file 'COPYING' for more information. 11 */ 12 13 #ifndef INK_EXTENSION_PARAM_PATH_H_SEEN 14 #define INK_EXTENSION_PARAM_PATH_H_SEEN 15 16 #include "parameter.h" 17 18 19 namespace Inkscape { 20 namespace Extension { 21 22 class ParamPathEntry; 23 24 class ParamPath : public InxParameter { 25 public: 26 ParamPath(Inkscape::XML::Node *xml, Inkscape::Extension::Extension *ext); 27 28 /** \brief Returns \c _value, with a \i const to protect it. */ get()29 const std::string& get() const { return _value; } 30 const std::string& set(const std::string &in); 31 32 Gtk::Widget *get_widget(sigc::signal<void> *changeSignal) override; 33 34 std::string value_to_string() const override; 35 36 private: 37 enum Mode { 38 FILE, FOLDER, FILE_NEW, FOLDER_NEW 39 }; 40 41 /** \brief Internal value. */ 42 std::string _value; 43 44 /** selection mode for the file chooser: files or folders? */ 45 Mode _mode = FILE; 46 47 /** selection mode for the file chooser: multiple items? */ 48 bool _select_multiple = false; 49 50 /** filetypes that should be selectable in file chooser */ 51 std::vector<std::string> _filetypes; 52 53 /** pointer to the parameters text entry 54 * keep this around, so we can update the value accordingly in \a on_button_clicked() */ 55 ParamPathEntry *_entry; 56 57 void on_button_clicked(); 58 }; 59 60 61 } // namespace Extension 62 } // namespace Inkscape 63 64 #endif /* INK_EXTENSION_PARAM_PATH_H_SEEN */ 65 66 /* 67 Local Variables: 68 mode:c++ 69 c-file-style:"stroustrup" 70 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) 71 indent-tabs-mode:nil 72 fill-column:99 73 End: 74 */ 75 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : 76