From 14c76e247f982b153adba005283826a2b722f89f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 16 Apr 2017 21:33:38 +0200 Subject: Hacky filebrowser-as-a-Dialog implementation. --- plugingui/filebrowser.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugingui/filebrowser.h') diff --git a/plugingui/filebrowser.h b/plugingui/filebrowser.h index 7b31864..ff8a7e8 100644 --- a/plugingui/filebrowser.h +++ b/plugingui/filebrowser.h @@ -49,12 +49,20 @@ public: void setPath(const std::string& path); Notifier fileSelectNotifier; // (const std::string& path) + Notifier<> fileSelectCancelNotifier; // From Widget: bool isFocusable() override { return true; } virtual void repaintEvent(RepaintEvent* repaintEvent) override; virtual void resize(std::size_t width, std::size_t height) override; + //! Return the filename selected in the browser. + std::string getFilename() const; + + //! Returns true if the filebrowser has a selection, false if the window was + //! closed or the cancel button was clicked. + bool hasFilename() const; + private: void listSelectionChanged(); void selectButtonClicked(); @@ -68,6 +76,7 @@ private: #endif void cancel(); + void select(const std::string& file); void changeDir(); Label lbl_path; @@ -79,6 +88,9 @@ private: Button btn_esc; Image back; + + bool has_filename{false}; + std::string filename; }; } // GUI:: -- cgit v1.2.3