00001 // ===================================================================================== 00002 // Filename: InputContext.h 00003 // Description: 00004 // Created: 02/15/2007 08:47:46 PM EST 00005 // Revision: none 00006 // Compiler: gcc 3.4.6 00007 // 00008 // Author: John P. Feltz 00009 // Email: jfeltz@gmail.com 00010 // License: Copyright (c) 2006-2007, John P. Feltz 00011 // This program is free software; you can redistribute it and/or 00012 // modify it under the terms of the GNU General Public License as 00013 // published by the Free Software Foundation, version 2 of the 00014 // License. 00015 // This program is distributed in the hope that it will be 00016 // useful, but WITHOUT ANY WARRANTY; without even the implied 00017 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00018 // PURPOSE. 00019 // See the GNU General Public License version 2 for more details. 00020 // 00021 // ===================================================================================== 00022 00023 00024 namespace cmil { 00026 class InputContext : public Logger { 00027 public: 00028 virtual std::string getName() const = 0; 00029 00030 virtual void captureNormal( ModAction* action ) = 0; 00031 virtual Ev::Sequence* getCaptured() const = 0; 00032 virtual bool addCombo(const Ev& event) = 0; 00033 virtual bool addNormal(const Ev& event) = 0; 00034 virtual bool removeNormal(const Ev& event) = 0; 00035 //TODO removeCombo 00036 00037 virtual void update(const InputData& input) = 0; 00038 virtual void update(const ModData& input) = 0; 00039 }; 00040 00042 class defaultContext : public InputContext { 00043 public: 00045 defaultContext(System* const sys) : m_sequencer(new NodeSequencer(sys)) {}; 00046 00047 virtual ~defaultContext() { 00048 delete m_sequencer; 00049 } 00050 00051 std::string getName() const; 00052 00053 void captureNormal( ModAction* action ); 00054 Ev::Sequence* getCaptured() const; 00055 00056 bool addCombo(const Ev& event); 00057 bool addNormal(const Ev& event); 00058 bool removeNormal(const Ev& event); 00059 00060 //TODO removeCombo 00061 void update(const InputData& input); 00062 void update(const ModData& input); 00063 00064 private: 00065 InputSequencer* const m_sequencer; 00066 }; 00067 };