Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef FILEBROWSERPOPUP_INCLUDED
Toshihiro Shimizu 890ddd
#define FILEBROWSERPOPUP_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/popup.h"
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TGenericFileBrowserPopupAction {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  virtual ~TGenericFileBrowserPopupAction() {}
Shinya Kitaoka 120a6e
  virtual void sendCommand(const TFilePath &) = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
class TFileBrowserPopupAction : public TGenericFileBrowserPopupAction {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  typedef void (T::*Method)(const TFilePath &);
Shinya Kitaoka 120a6e
  TFileBrowserPopupAction(T *target, Method method)
Shinya Kitaoka 120a6e
      : m_target(target), m_method(method) {}
Shinya Kitaoka 120a6e
  void sendCommand(const TFilePath &fp) { (m_target->*m_method)(fp); }
Shinya Kitaoka 120a6e
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  T *m_target;
Shinya Kitaoka 120a6e
  Method m_method;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class FileBrowserPopup : public TPopup {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  FileBrowserPopup(TWidget *parent);
Shinya Kitaoka 120a6e
  FileBrowserPopup(TWidget *parent, const vector<string> &fileTypes);</string>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~FileBrowserPopup();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void configureNotify(const TDimension &d);
Shinya Kitaoka 120a6e
  TDimension getPreferredSize() const;
Shinya Kitaoka 120a6e
  void draw();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setCurrentDir(const TFilePath &dirPath);
Shinya Kitaoka 120a6e
  void setFilter(const vector<string> &fileTypes);</string>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setOkAction(TGenericFileBrowserPopupAction *action);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void popup(const TPoint &p);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  class Data;
Shinya Kitaoka 120a6e
  Data *m_data;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif