Choreonoid  1.8
TaskView.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BASE_TASK_VIEW_H
7 #define CNOID_BASE_TASK_VIEW_H
8 
9 #include <cnoid/View>
10 #include <cnoid/AbstractTaskSequencer>
11 #include <vector>
12 #include "exportdecl.h"
13 
14 namespace cnoid {
15 
16 class TaskViewImpl;
17 
18 class CNOID_EXPORT TaskView : public View, public AbstractTaskSequencer
19 {
20 public:
21  static void initializeClass(ExtensionManager* ext);
22  static TaskView* instance();
23 
24  TaskView();
25  ~TaskView();
26 
27  virtual void activate(bool on = true);
28  virtual bool isActive();
29  virtual void addTask(Task* task);
30  virtual bool updateTask(Task* task);
31  virtual bool removeTask(Task* task);
32  virtual SignalProxy<void(Task* task)> sigTaskAdded();
33  virtual SignalProxy<void(Task* task)> sigTaskRemoved();
34  virtual void clearTasks();
35  virtual int numTasks() const;
36  virtual Task* task(int index);
37  virtual int currentTaskIndex() const;
38  virtual bool setCurrentTask(int taskIndex);
39  virtual SignalProxy<void()> sigCurrentTaskChanged();
40  virtual int currentPhaseIndex() const;
41  virtual void setCurrentPhase(int phaseIndex);
42  virtual SignalProxy<void()> sigCurrentPhaseChanged();
43  virtual int currentCommandIndex() const;
44  virtual void executeCommand(int commandIndex);
45  virtual SignalProxy<void()> sigCurrentCommandChanged();
46  virtual bool isBusy() const;
47  virtual SignalProxy<void()> sigBusyStateChanged();
48  virtual void cancelCurrentCommand();
49  virtual SignalProxy<void()> sigCurrentCommandCanceled();
50  virtual bool isAutoMode() const;
51  virtual void setAutoMode(bool on);
52  virtual SignalProxy<void(bool isAutoMode)> sigAutoModeToggled();
53  virtual void serializeTasks(const std::vector<std::string>& tasks);
54 
55  void setNoExecutionMode(bool on);
56  bool isNoExecutionMode() const;
57  void setCurrentCommand(int commandIndex, bool doExecution);
58  void setBusyState(bool on);
59 
60  void executeMenuItem(int index);
61  void checkMenuItem(int index, bool on);
62  std::vector<bool> menuItemCheckStates() const;
63 
64  // valid for the no execution mode
65  SignalProxy<void()> sigMenuRequest();
66  void showMenu(std::vector<bool> checkStates);
67  SignalProxy<void(int index)> sigMenuItemTriggered();
68  SignalProxy<void(int index, bool on)> sigMenuItemToggled();
69 
70 protected:
71  virtual bool storeState(Archive& archive);
72  virtual bool restoreState(const Archive& archive);
73 
74 private:
75  TaskViewImpl* impl;
76 };
77 
78 }
79 
80 #endif
cnoid::ExtensionManager
Definition: ExtensionManager.h:23
cnoid::View
Definition: View.h:27
cnoid::Archive
Definition: Archive.h:22
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::TaskView
Definition: TaskView.h:18
cnoid::Task
Definition: Task.h:202
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::AbstractTaskSequencer
Definition: AbstractTaskSequencer.h:14