00001 //--------------------------------------------------------------------------- 00002 /// \file CATCommand.h 00003 /// \brief Generalized command construct for tracking commands 00004 /// \ingroup CATGUI 00005 /// 00006 /// Copyright (c) 2003-2008 by Michael Ellison. 00007 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00008 /// 00009 // $Author: mikeellison $ 00010 // $Date: 2008-01-23 01:43:25 -0600 (Wed, 23 Jan 2008) $ 00011 // $Revision: $ 00012 // $NoKeywords: $ 00013 00014 #ifndef CATCommand_H_ 00015 #define CATCommand_H_ 00016 00017 #include "CATInternal.h" 00018 #include "CATString.h" 00019 00020 /// \class CATCommand 00021 /// \brief Generalized command construct for tracking commands 00022 /// \ingroup CATGUI 00023 /// 00024 /// Commands represent an action requested by the user. 00025 /// CATCommand represents a command by a command string associated with 00026 /// a floating point value and a string parameter. 00027 /// 00028 class CATCommand 00029 { 00030 public: 00031 CATCommand(); 00032 00033 /// CATCommand constructor 00034 /// 00035 /// Typically, all of these will come from a control and its 00036 /// skin script. 00037 /// 00038 /// \param cmdString - the command string to be sent 00039 /// \param cmdVal - the value from the control or 00040 /// other source sending the command 00041 /// \param cmdStrParam - a string parameter for the command. 00042 /// \param cmdTarget - used to target another control specifically 00043 CATCommand( const CATString& cmdString, 00044 CATFloat32 cmdVal, 00045 const CATString& cmdStrParam = "", 00046 const CATString& cmdTarget = "", 00047 const CATString& cmdType = ""); 00048 00049 /// CATCommand destructor 00050 virtual ~CATCommand(); 00051 00052 /// CATCommand copy operator 00053 CATCommand& operator=(const CATCommand& cmd); 00054 //------------------------------------------------------------------- 00055 // Command execution info 00056 //------------------------------------------------------------------- 00057 00058 /// GetValue() retrieves the value in the command 00059 /// \return CATFloat32 - floating point value 00060 /// (generally of the control sending it) 00061 CATFloat32 GetValue(); 00062 00063 /// GetCmdString() retrieves the command string itself. 00064 /// 00065 /// This string is used to identify the action the application 00066 /// should take. 00067 /// 00068 /// \return CATString - command string. 00069 CATString GetCmdString(); 00070 00071 /// GetStringParam() retrieves the string parameter of the command. 00072 /// 00073 /// \return CATString - parameter string for the command, if any. 00074 CATString GetStringParam(); 00075 00076 /// GetTarget() retrieves the target of the command. 00077 /// If it's empty, then the command is generally targetted (all) 00078 CATString GetTarget(); 00079 00080 /// GetType() retrieves the type of command. 00081 /// Generally, this is an empty string. 00082 /// In VST apps, "VSTParam" indicates that it is a VST parameter. 00083 CATString GetType(); 00084 00085 protected: 00086 /// Command string to execute 00087 CATString fCmdString; 00088 00089 /// Value for command 00090 CATFloat32 fVal; 00091 00092 /// String parameter for command 00093 CATString fStrParam; 00094 00095 CATString fCmdType; 00096 00097 /// Optional target of command. 00098 /// Assumed to be all if not set. 00099 CATString fTarget; 00100 }; 00101 00102 #endif // CATCommand_H_