Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef DEPENDEDLIST_H
Toshihiro Shimizu 890ddd
#define DEPENDEDLIST_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tw/popup.h"
Toshihiro Shimizu 890ddd
#include "tw/button.h"
Toshihiro Shimizu 890ddd
#include "tw/mainshell.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "textlist.h"
Toshihiro Shimizu 890ddd
#include <map></map>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TaskShortInfo;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TGenericDependedPopupAction {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  virtual ~TGenericDependedPopupAction() {}
Shinya Kitaoka 120a6e
  virtual void sendCommand(const vector<string> &) = 0;</string>
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
class TDependedPopupAction : public TGenericDependedPopupAction {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  typedef void (T::*Method)(const vector<string> &);</string>
Shinya Kitaoka 120a6e
  TDependedPopupAction(T *target, Method method)
Shinya Kitaoka 120a6e
      : m_target(target), m_method(method) {}
Shinya Kitaoka 120a6e
  void sendCommand(const vector<string> &tasks) {</string>
Shinya Kitaoka 120a6e
    (m_target->*m_method)(tasks);
Shinya Kitaoka 120a6e
  }
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 DependedList : public TWidget {
Shinya Kitaoka 120a6e
  TTextList *m_depList;
Shinya Kitaoka 120a6e
  TButton *m_add;
Shinya Kitaoka 120a6e
  TButton *m_remove;
Shinya Kitaoka 120a6e
  map<string, string=""> m_tasks;</string,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  DependedList(TWidget *parent);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void configureNotify(const TDimension &size);
Shinya Kitaoka 120a6e
  void onAdd();
Shinya Kitaoka 120a6e
  void onRemove();
Shinya Kitaoka 120a6e
  void clearAll();
Shinya Kitaoka 120a6e
  void setList(const map<string, string=""> &tasks);</string,>
Shinya Kitaoka 120a6e
  void AddItems(const vector<string> &tasksId);</string>
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DependedPopup : public TModalPopup {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  DependedPopup(TWidget *parent);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void configureNotify(const TDimension &d);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDimension getPreferredSize() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onOk();
Shinya Kitaoka 120a6e
  void setList(const vector<taskshortinfo> &tasks);</taskshortinfo>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setOkAction(TGenericDependedPopupAction *action);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  TTextList *m_submitList;
Shinya Kitaoka 120a6e
  TButton *m_ok;
Shinya Kitaoka 120a6e
  TButton *m_cancel;
Shinya Kitaoka 120a6e
  TGenericDependedPopupAction *m_okAction;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif