00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(INGREDIENTS_H)
00023 #define INGREDIENTS_H
00024
00025 #include "Root.h"
00026 #include "BaseClasses.h"
00027 #include "Actions.h"
00028 #include "BaseActions.h"
00029 #include <qstring.h>
00030
00031 class MHParseNode;
00032
00033
00034 class MHIngredient : public MHRoot
00035 {
00036 public:
00037 MHIngredient();
00038 MHIngredient(const MHIngredient &ref);
00039 virtual ~MHIngredient() {}
00040 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00041 virtual void PrintMe(FILE *fd, int nTabs) const;
00042 virtual bool InitiallyActive() { return m_fInitiallyActive; }
00043 virtual bool InitiallyAvailable() { return false; }
00044 virtual bool IsShared() { return m_fShared; }
00045
00046
00047 virtual void Preparation(MHEngine *engine);
00048 virtual void Destruction(MHEngine *engine);
00049 virtual void ContentPreparation(MHEngine *engine);
00050
00051
00052 virtual void SetData(const MHOctetString &included, MHEngine *engine);
00053 virtual void SetData(const MHContentRef &referenced, bool fSizeGiven, int size, bool fCCGiven, int cc, MHEngine *engine);
00054 virtual void Preload(MHEngine *engine) { Preparation(engine); }
00055 virtual void Unload(MHEngine *engine) { Destruction(engine); }
00056
00057
00058 virtual void ContentArrived(const unsigned char *, int, MHEngine *) { }
00059
00060 protected:
00061 bool m_fInitiallyActive;
00062 int m_nContentHook;
00063 bool m_fShared;
00064
00065
00066 enum { IN_NoContent, IN_IncludedContent, IN_ReferencedContent } m_ContentType;
00067 MHOctetString m_OrigIncludedContent;
00068 MHContentRef m_OrigContentRef;
00069 int m_nOrigContentSize;
00070 int m_nOrigCCPrio;
00071
00072 MHOctetString m_IncludedContent;
00073 MHContentRef m_ContentRef;
00074 int m_nContentSize;
00075 int m_nCCPrio;
00076 friend class MHEngine;
00077 };
00078
00079
00080 class MHFont : public MHIngredient
00081 {
00082 public:
00083 MHFont();
00084 virtual ~MHFont();
00085 virtual const char *ClassName() { return "Font"; }
00086 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00087 virtual void PrintMe(FILE *fd, int nTabs) const;
00088
00089 protected:
00090 };
00091
00092
00093 class MHCursorShape : public MHIngredient
00094 {
00095 public:
00096 MHCursorShape();
00097 virtual ~MHCursorShape();
00098 virtual const char *ClassName() { return "CursorShape"; }
00099 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00100 virtual void PrintMe(FILE *fd, int nTabs) const;
00101
00102 protected:
00103 };
00104
00105
00106 class MHPalette : public MHIngredient
00107 {
00108 public:
00109 MHPalette();
00110 virtual ~MHPalette();
00111 virtual const char *ClassName() { return "Palette"; }
00112 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00113 virtual void PrintMe(FILE *fd, int nTabs) const;
00114
00115 protected:
00116 };
00117
00118
00119
00120 class MHSetData: public MHElemAction
00121 {
00122 public:
00123 MHSetData(): MHElemAction(":SetData") {}
00124 virtual void Initialise(MHParseNode *p, MHEngine *engine);
00125 virtual void Perform(MHEngine *engine);
00126 virtual void PrintArgs(FILE *fd, int nTabs) const;
00127 protected:
00128
00129 bool m_fIsIncluded, m_fSizePresent, m_fCCPriorityPresent;
00130 MHGenericOctetString m_Included;
00131 MHGenericContentRef m_Referenced;
00132 MHGenericInteger m_ContentSize;
00133 MHGenericInteger m_CCPriority;
00134 };
00135
00136
00137 class MHPreload: public MHElemAction
00138 {
00139 public:
00140 MHPreload(): MHElemAction(":Preload") {}
00141 virtual void Perform(MHEngine *engine) { Target(engine)->Preload(engine); }
00142 };
00143
00144 class MHUnload: public MHElemAction
00145 {
00146 public:
00147 MHUnload(): MHElemAction(":Unload") {}
00148 virtual void Perform(MHEngine *engine) { Target(engine)->Unload(engine); }
00149 };
00150
00151
00152 class MHClone: public MHActionGenericObjectRef
00153 {
00154 public:
00155 MHClone(): MHActionGenericObjectRef(":Clone") {}
00156 virtual void CallAction(MHEngine *engine, MHRoot *pTarget, MHRoot *pRef);
00157 };
00158
00159 #endif