00001 #ifndef CSHADERFILE_H 00002 #define CSHADERFILE_H 00003 00004 /****************************************************************************\ 00005 * REQUIRED HEADERS * 00006 \****************************************************************************/ 00007 00008 //QT 00009 #include <QWidget> 00010 #include <QTextDocument> 00011 #include <QString> 00012 //OWN 00013 #include "Definitions.h" 00014 #include "Memory/mmgr.h" 00015 00016 /****************************************************************************\ 00017 * DEFINITIONS * 00018 \****************************************************************************/ 00019 00020 #define VERTEX_SHADER 0x8B31 00021 #define FRAGMENT_SHADER 0x8B30 00022 00023 class QFile; 00024 class CEditorProc; 00025 00026 /****************************************************************************\ 00027 * CLASS * 00028 \****************************************************************************/ 00029 class CShaderFile:public QTextDocument 00030 { 00031 static int nextID; 00032 00033 /**************************************************************************\ 00034 * PUBLIC CLASS FUNCTIONS * 00035 \**************************************************************************/ 00036 public: 00037 00038 CShaderFile(QObject *parent); 00039 ~CShaderFile(); 00040 00041 bool Create(int ShaderType); 00042 00043 int GetShaderType(){return shaderType;} 00044 uint GetShaderID(){return shaderID;} 00045 void SetShaderID(uint newID){shaderID = newID;} 00046 void SetAttached(bool tf){shaderAttached = tf;} 00047 bool GetAttached(){return shaderAttached;} 00048 void SetCompiled(bool tf){shaderCompiled = tf;} 00049 bool GetCompiled(){return shaderCompiled;} 00050 00051 QString GetFileName(); 00052 00053 int GetTabID(){return tabID;} 00054 void SetTabID(int newID){tabID = newID;} 00055 00056 bool isEditing(){return editing;} 00057 00058 bool isLoaded(); 00059 bool isUpToDate(); 00060 bool isModified(); 00061 bool load(QString & text); 00062 bool saveAs(QString & text); 00063 00064 bool StartEdit(QString & editorPath,QStringList & editorArgs); 00065 QString & StopEdit(); 00066 00067 /**************************************************************************\ 00068 * PRIVATE CLASS FUNCTIONS * 00069 \**************************************************************************/ 00070 private: 00071 00072 /**************************************************************************\ 00073 * PRIVATE CLASS MEMBERS * 00074 \**************************************************************************/ 00075 private: 00076 00077 QString currentFileName; 00078 CEditorProc *pEditProcess; 00079 QString editTextReceived; 00080 00081 bool editing; 00082 00083 QFile *pFile; 00084 int tabID; 00085 unsigned int shaderID; 00086 int shaderType; 00087 bool shaderAttached; 00088 bool shaderCompiled; 00089 }; 00090 00091 #endif // CSHADERFILE_H