Mercurial > hg > svcore
annotate base/Command.h @ 44:701404725897
* Use commands for add/delete pane in main window
* Add compound command collection to command history (for add pane, import file
etc)
* Add hide/show pane and hidden pane list to PaneStack
* Various other fixes
author | Chris Cannam |
---|---|
date | Mon, 13 Mar 2006 17:55:19 +0000 |
parents | 2fb933f88604 |
children | bac8b14ab355 |
rev | line source |
---|---|
Chris@16 | 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@16 | 2 |
Chris@16 | 3 /* |
Chris@16 | 4 A waveform viewer and audio annotation editor. |
Chris@16 | 5 Chris Cannam, Queen Mary University of London, 2005-2006 |
Chris@16 | 6 |
Chris@16 | 7 This is experimental software. Not for distribution. |
Chris@16 | 8 */ |
Chris@16 | 9 |
Chris@16 | 10 #ifndef _COMMAND_H_ |
Chris@16 | 11 #define _COMMAND_H_ |
Chris@16 | 12 |
Chris@17 | 13 #include <QString> |
Chris@17 | 14 #include <vector> |
Chris@17 | 15 |
Chris@16 | 16 class Command |
Chris@16 | 17 { |
Chris@16 | 18 public: |
Chris@17 | 19 virtual ~Command() { } |
Chris@17 | 20 |
Chris@16 | 21 virtual void execute() = 0; |
Chris@16 | 22 virtual void unexecute() = 0; |
Chris@17 | 23 virtual QString getName() const = 0; |
Chris@17 | 24 }; |
Chris@17 | 25 |
Chris@17 | 26 class MacroCommand : public Command |
Chris@17 | 27 { |
Chris@17 | 28 public: |
Chris@17 | 29 MacroCommand(QString name); |
Chris@17 | 30 virtual ~MacroCommand(); |
Chris@17 | 31 |
Chris@17 | 32 virtual void addCommand(Command *command); |
Chris@17 | 33 virtual void deleteCommand(Command *command); |
Chris@17 | 34 virtual bool haveCommands() const { return !m_commands.empty(); } |
Chris@17 | 35 |
Chris@17 | 36 virtual void execute(); |
Chris@17 | 37 virtual void unexecute(); |
Chris@17 | 38 |
Chris@17 | 39 virtual QString getName() const { return m_name; } |
Chris@17 | 40 virtual void setName(QString name) { m_name = name; } |
Chris@17 | 41 |
Chris@17 | 42 protected: |
Chris@17 | 43 QString m_name; |
Chris@17 | 44 std::vector<Command *> m_commands; |
Chris@16 | 45 }; |
Chris@16 | 46 |
Chris@16 | 47 #endif |
Chris@16 | 48 |