GME  13
GuiMeta.h
Go to the documentation of this file.
00001 #ifndef _GUIMETA_INCLUDED_
00002 #define _GUIMETA_INCLUDED_
00003 
00004 #include "stdafx.h"
00005 #include "GMEStd.h"
00006 #include "DynMenu.h"
00007 
00008 // "defined in" hierarchy not captured here! (we create meta objs using it though)
00009 // --> cannot be traversed standalone
00010 
00011 class CGuiMetaProject
00012 {
00013 public:
00014         CGuiMetaProject(CComPtr<IMgaMetaProject> &mgaPt);
00015         ~CGuiMetaProject();
00016 public:
00017         CString name;
00018         CString displayedName;
00019         CGuiMetaFolder *rootFolder;
00020         CGuiMetaBaseTable metaTable;
00021         CGuiMetaBaseList metaRemainingList;
00022         CComPtr<IMgaMetaProject> mgaMeta;
00023         int minMenuCmdID;
00024         int maxMenuCmdID;
00025 
00026         static CGuiMetaProject *theInstance;
00027 public:
00028         void RegisterMetaObject(metaref_type id, CGuiMetaBase *mobj);
00029         int GetNewMenuCmdID()           { ASSERT(maxMenuCmdID < DECORATOR_CTX_MENU_MINID - 1); return maxMenuCmdID++; };
00030         bool CmdIDInRange(int id);
00031         GMECommandCode CmdType(int id,CString &cmdName);
00032         bool FindCommand(int cmdId,CString &label);
00033         CGuiMetaBase *GetGuiMeta(metaref_type key);
00034         CGuiMetaAttribute *GetGuiMetaAttribute(metaref_type key);
00035         CGuiMetaFco *GetGuiMetaFco(metaref_type key);
00036         CGuiMetaModel *GetGuiMetaModel(metaref_type key);
00037 };
00038 
00039 class CGuiMetaBase
00040 {
00041 public:
00042         CGuiMetaBase() {}
00043         virtual ~CGuiMetaBase() {}
00044 public:
00045         metaref_type metaref;
00046         CString name;
00047         CString displayedName;
00048         CComPtr<IMgaMetaBase> mgaMeta;
00049 public:
00050         void Init(CComPtr<IMgaMetaBase> &mgaPt);                // init members + put in table
00051         void CreateFcos(CComPtr<IMgaMetaFCOs> &mmFcos);
00052 };
00053 
00054 class CGuiMetaFolder : public CGuiMetaBase
00055 {
00056 public:
00057         CGuiMetaFolder(CComPtr<IMgaMetaFolder> &mgaPt);
00058         virtual ~CGuiMetaFolder() {}
00059 public:
00060 public:
00061 };
00062 
00063 class CGuiMetaAttribute : public CGuiMetaBase
00064 {
00065 public:
00066         CGuiMetaAttribute(CComPtr<IMgaMetaAttribute> &mgaPt,CGuiMetaFco *o);
00067 public:
00068         CGuiMetaFco *owner;
00069         CString prompt;
00070 public:
00071 };
00072 
00073 class CGuiMetaFieldAttribute : public CGuiMetaAttribute
00074 {
00075 public:
00076         CGuiMetaFieldAttribute(CComPtr<IMgaMetaAttribute> &mgaPt,CGuiMetaFco *o);
00077         virtual ~CGuiMetaFieldAttribute() {}
00078 public:
00079 public:
00080 };
00081 
00082 class CGuiMetaMenuAttribute : public CGuiMetaAttribute
00083 {
00084 public:
00085         CGuiMetaMenuAttribute(CComPtr<IMgaMetaAttribute> &mgaPt,CGuiMetaFco *o);
00086         virtual ~CGuiMetaMenuAttribute() { }
00087 public:
00088 public:
00089 };
00090 
00091 class CGuiMetaToggleAttribute : public CGuiMetaAttribute
00092 {
00093 public:
00094         CGuiMetaToggleAttribute(CComPtr<IMgaMetaAttribute> &mgaPt,CGuiMetaFco *o);
00095         virtual ~CGuiMetaToggleAttribute() {}
00096 public:
00097 public:
00098 };
00099 
00100 class CGuiMetaFco : public CGuiMetaBase
00101 {
00102 public:
00103         CGuiMetaFco(CComPtr<IMgaMetaFCO> &mgaPt);
00104         CGuiMetaFco(CComPtr<IMgaMetaModel> &mgaPt);
00105         virtual ~CGuiMetaFco() {}
00106 public:
00107         CGuiMetaAttributeList attrs;
00108 public:
00109         void SetAttributes();
00110 };
00111 
00112 class CGuiMetaModel : public CGuiMetaFco
00113 {
00114 public:
00115         CGuiMetaModel(CComPtr<IMgaMetaModel> &mgaPt);
00116         virtual ~CGuiMetaModel();
00117 public:
00118         CGuiMetaAspectList aspects;
00119         bool partsSet;
00120 private:
00121         CGuiObjectList parts;                   // for part browser
00122 public:
00123         CGuiObjectList &GetParts();
00124         void DeleteParts();
00125         void ResetParts();
00126         void InitParts();
00127         void InitAspectBox(CComboBox *box);
00128         void InitAspectList(CListBox *list);
00129         CGuiMetaAspect *GetFirstAspect();
00130         CGuiMetaAspect *FindAspect(CString nm);
00131         CGuiMetaAspect *FindAspect(int ind);
00132         int NumberOfAspects();
00133         int MapAspect(CComPtr<IMgaMetaRole> &role,int index);
00134         bool GetPartByRole(CComPtr<IMgaMetaRole> &theRole,CComPtr<IMgaMetaAspect> &theAspect,CComPtr<IMgaMetaPart> &thePart);
00135 };
00136 
00137 class CGuiMetaAspect : public CGuiMetaBase
00138 {
00139 public:
00140         CGuiMetaAspect(CComPtr<IMgaMetaAspect>& mgaPt, CGuiMetaModel* o, int ind);
00141         virtual ~CGuiMetaAspect();
00142 public:
00143         CGuiMetaModel *owner;
00144         CDynMenu *insertModelMenu;
00145         CDynMenu *insertAtomMenu;
00146         CDynMenu *insertReferenceMenu;
00147         CDynMenu *insertSetMenu;
00148         int index;
00149         CGuiMetaAttributeList attrs;
00150 public:
00151         void GetMetaAspect(CComPtr<IMgaMetaAspect> &mAspect);
00152         void InitContextMenu(CMenu* menu, const CString& label, CDynMenu* dm);
00153         void InitContextMenu(CMenu* menu);
00154         void ResetContextMenu(CMenu* menu);
00155         bool FindCommand(int cmdId, CString &label);
00156         bool GetRoleByName(const CString& roleName, CComPtr<IMgaMetaRole>& theRole, bool dispName = false);
00157         bool GetPartByRole(CComPtr<IMgaMetaRole>& theRole, CComPtr<IMgaMetaPart>& thePart);
00158         bool IsLinkedRole(CComPtr<IMgaMetaRole>& theRole);
00159         bool IsPrimary(CComPtr<IMgaFCO> fco);
00160         bool IsPrimaryByRoleName(CComPtr<IMgaFCO> fco);
00161         bool IsPrimaryByRoleName(CComPtr<IMgaMetaRole> role);
00162         bool CheckFcosBeforeInsertion(CComPtr<IMgaFCOs> fcos);
00163 };
00164 
00165 #endif // whole file