summaryrefslogtreecommitdiff
path: root/plugingui/filebrowser.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/filebrowser.h')
-rw-r--r--plugingui/filebrowser.h52
1 files changed, 29 insertions, 23 deletions
diff --git a/plugingui/filebrowser.h b/plugingui/filebrowser.h
index 6583b53..bd9dd8e 100644
--- a/plugingui/filebrowser.h
+++ b/plugingui/filebrowser.h
@@ -24,8 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#ifndef __DRUMGIZMO_FILEBROWSER_H__
-#define __DRUMGIZMO_FILEBROWSER_H__
+#pragma once
#include "widget.h"
@@ -35,41 +34,48 @@
#include "label.h"
#include "image.h"
#include "directory.h"
+#include "notifier.h"
namespace GUI {
class FileBrowser : public Widget {
public:
- struct private_data;
+ FileBrowser(Widget *parent);
+ ~FileBrowser();
- FileBrowser(Widget *parent);
- ~FileBrowser();
+ void setPath(const std::string& path);
- void setPath(std::string path);
+ Notifier<const std::string&> fileSelectNotifier; // (const std::string& path)
- bool isFocusable() { return true; }
-
- void registerFileSelectHandler(void (*handler)(void *, std::string),
- void *ptr);
-
- virtual void repaintEvent(RepaintEvent *e);
-
- virtual void resize(int w, int h);
+ // From Widget:
+ bool isFocusable() override { return true; }
+ virtual void repaintEvent(RepaintEvent* repaintEvent) override;
+ virtual void resize(int w, int h) override;
private:
- struct private_data *prv;
+ void listSelectionChanged();
+ void selectButtonClicked();
+ void cancelButtonClicked();
+ void handleKeyEvent();
- GUI::Label lbl_path;
- GUI::LineEdit lineedit;
+ Directory dir;
+#ifdef WIN32
+ bool above_root;
+ bool in_root;
+#endif
- GUI::ListBox listbox;
+ void cancel();
+ void changeDir();
- GUI::Button btn_sel;
- GUI::Button btn_esc;
+ Label lbl_path;
- Image back;
-};
+ LineEdit lineedit;
+ ListBox listbox;
+
+ Button btn_sel;
+ Button btn_esc;
+ Image back;
};
-#endif/*__DRUMGIZMO_FILEBROWSER_H__*/
+} // GUI::