#ifndef DEPENDEDLIST_H #define DEPENDEDLIST_H #include "tw/popup.h" #include "tw/button.h" #include "tw/mainshell.h" #include "textlist.h" #include class TaskShortInfo; //------------------------------------------------------------------- class TGenericDependedPopupAction { public: virtual ~TGenericDependedPopupAction() {} virtual void sendCommand(const vector &) = 0; }; //------------------------------------------------------------------- template class TDependedPopupAction : public TGenericDependedPopupAction { public: typedef void (T::*Method)(const vector &); TDependedPopupAction(T *target, Method method) : m_target(target), m_method(method) {} void sendCommand(const vector &tasks) { (m_target->*m_method)(tasks); } private: T *m_target; Method m_method; }; //============================================================================== class DependedList : public TWidget { TTextList *m_depList; TButton *m_add; TButton *m_remove; map m_tasks; public: DependedList(TWidget *parent); void configureNotify(const TDimension &size); void onAdd(); void onRemove(); void clearAll(); void setList(const map &tasks); void AddItems(const vector &tasksId); }; //============================================================================== class DependedPopup : public TModalPopup { public: DependedPopup(TWidget *parent); void configureNotify(const TDimension &d); TDimension getPreferredSize() const; void onOk(); void setList(const vector &tasks); void setOkAction(TGenericDependedPopupAction *action); private: TTextList *m_submitList; TButton *m_ok; TButton *m_cancel; TGenericDependedPopupAction *m_okAction; }; #endif