00001
00002
00003
00004 #ifndef CONTROL_SIMPLECOMMAND_H
00005 #define CONTROL_SIMPLECOMMAND_H
00006
00007 #include "gui/Command.h"
00008
00009 namespace gui {
00010
00011 template <class Receiver>
00012 class SimpleCommand : public Command {
00013
00014
00015
00016 public:
00017 typedef void (Receiver::* Action)();
00018
00019 SimpleCommand(Receiver* r, Action a):m_receiver(r),m_action(a){};
00020
00021
00022 virtual void execute();
00023
00024
00025 private:
00026 Receiver* m_receiver;
00027 Action m_action;
00028
00029 };
00030
00031 template <class Receiver> inline
00032 void SimpleCommand<Receiver>::execute(){
00033 (m_receiver->*m_action)();
00034 }
00035
00036 }
00037
00038 #endif // CONTROL_SIMPLECOMMAND_H