summaryrefslogtreecommitdiff
path: root/plugingui/filebrowser.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-10-26 19:48:30 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2015-10-26 19:48:30 +0100
commit88ad7366a3eb6bc73bc99078ae13302099b76f09 (patch)
tree64a5f5b3a4b5c187d25e21e21bf2808f12367820 /plugingui/filebrowser.h
parentb84e5f74e5513e4cd14fe62b03777be8ee9c2537 (diff)
Refactored LineEdit and FileBrowser. Renamed all KEY_XYZ event types to KeyXyz.
Diffstat (limited to 'plugingui/filebrowser.h')
-rw-r--r--plugingui/filebrowser.h48
1 files changed, 26 insertions, 22 deletions
diff --git a/plugingui/filebrowser.h b/plugingui/filebrowser.h
index 93a745e..7edfaa2 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,45 +34,50 @@
#include "label.h"
#include "image.h"
#include "directory.h"
+#include "notifier.h"
namespace GUI {
class FileBrowser : public Widget {
public:
- struct private_data;
+ struct private_data;
- FileBrowser(Widget *parent);
- ~FileBrowser();
+ FileBrowser(Widget *parent);
+ ~FileBrowser();
- void setPath(std::string path);
+ void setPath(const std::string& path);
- bool isFocusable() { return true; }
+ Notifier<const std::string&> fileSelectNotifier; // (const std::string& path)
- 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 *e) override;
+ virtual void resize(int w, int h) override;
private:
void listSelectionChanged();
void selectButtonClicked();
void cancelButtonClicked();
+ void handleKeyEvent();
- struct private_data *prv;
+ Directory dir;
+#ifdef WIN32
+ bool above_root;
+ bool in_root;
+#endif
- GUI::Label lbl_path;
- GUI::LineEdit lineedit;
+ void cancel();
+ void changeDir();
- GUI::ListBox listbox;
+ Label lbl_path;
- GUI::Button btn_sel;
- GUI::Button btn_esc;
+ LineEdit lineedit;
+ ListBox listbox;
- Image back;
-};
+ Button btn_sel;
+ Button btn_esc;
+ Image back;
};
-#endif/*__DRUMGIZMO_FILEBROWSER_H__*/
+} // GUI::