00001 /* -*- myth -*- */ 00024 #ifndef ACTIONSET_H 00025 #define ACTIONSET_H 00026 00027 // Qt headers 00028 #include <qstringlist.h> 00029 #include <qmap.h> 00030 #include <qdict.h> 00031 00037 class ActionSet 00038 { 00039 public: 00041 ActionSet() {} 00042 00043 // Commands 00044 bool AddAction(const ActionID &id, 00045 const QString &description, 00046 const QString &keys); 00047 bool Add(const ActionID &id, const QString &key); 00048 bool Remove(const ActionID &id, const QString &key); 00049 bool Replace(const ActionID &id, 00050 const QString &newkey, 00051 const QString &oldkey); 00052 00053 // Sets 00054 bool SetModifiedFlag(const ActionID &id, bool modified); 00055 00056 // Gets 00057 QStringList GetContextStrings(void) const; 00058 QStringList GetActionStrings(const QString &context_name) const; 00059 QString GetKeyString(const ActionID &id) const; 00060 QStringList GetKeys(const ActionID &id) const; 00061 QStringList GetContextKeys(const QString &context_name) const; 00062 QStringList GetAllKeys(void) const; 00063 QString GetDescription(const ActionID &id) const; 00064 const ActionList& GetActions(const QString &key) const; 00067 const ActionList &GetModified(void) const { return m_modified; } 00069 bool HasModified(void) const { return !m_modified.isEmpty(); } 00071 bool IsModified(const ActionID &id) const 00072 { return m_modified.contains(id); } 00073 00074 protected: 00075 Action *GetAction(const ActionID &id) const; 00076 Context *GetContext(const QString &name) const; 00077 00078 public: 00080 static const QString kJumpContext; 00082 static const QString kGlobalContext; 00083 00084 private: 00085 QMap<QString, ActionList> m_keyToActionMap; 00086 QDict<Context> m_contexts; 00087 ActionList m_modified; 00088 }; 00089 00090 #endif /* ACTIONSET_H */
1.5.5