tahoma2d/toonz/sources/toonzfarm/tfarmclient/dependedlist.h

82 lines
1.8 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef DEPENDEDLIST_H
#define DEPENDEDLIST_H
#include "tw/popup.h"
#include "tw/button.h"
#include "tw/mainshell.h"
#include "textlist.h"
#include <map>
class TaskShortInfo;
//-------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class TGenericDependedPopupAction {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
virtual ~TGenericDependedPopupAction() {}
virtual void sendCommand(const vector<string> &) = 0;
2016-03-19 06:57:51 +13:00
};
//-------------------------------------------------------------------
template <class T>
2016-06-15 18:43:10 +12:00
class TDependedPopupAction : public TGenericDependedPopupAction {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
typedef void (T::*Method)(const vector<string> &);
TDependedPopupAction(T *target, Method method)
: m_target(target), m_method(method) {}
void sendCommand(const vector<string> &tasks) {
(m_target->*m_method)(tasks);
}
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
T *m_target;
Method m_method;
2016-03-19 06:57:51 +13:00
};
//==============================================================================
2016-06-15 18:43:10 +12:00
class DependedList : public TWidget {
TTextList *m_depList;
TButton *m_add;
TButton *m_remove;
map<string, string> m_tasks;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
DependedList(TWidget *parent);
void configureNotify(const TDimension &size);
void onAdd();
void onRemove();
void clearAll();
void setList(const map<string, string> &tasks);
void AddItems(const vector<string> &tasksId);
2016-03-19 06:57:51 +13:00
};
//==============================================================================
2016-06-15 18:43:10 +12:00
class DependedPopup : public TModalPopup {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
DependedPopup(TWidget *parent);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void configureNotify(const TDimension &d);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TDimension getPreferredSize() const;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void onOk();
void setList(const vector<TaskShortInfo> &tasks);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void setOkAction(TGenericDependedPopupAction *action);
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
TTextList *m_submitList;
TButton *m_ok;
TButton *m_cancel;
TGenericDependedPopupAction *m_okAction;
2016-03-19 06:57:51 +13:00
};
#endif