GME  13
AnnotationNode.h
Go to the documentation of this file.
00001 // AnnotationNode.h: interface for the CAnnotationNode class.
00002 //
00004 
00005 #if !defined(AFX_ANNOTATIONNODE_H__A60720A0_33C3_4FFE_9995_8439D58246E8__INCLUDED_)
00006 #define AFX_ANNOTATIONNODE_H__A60720A0_33C3_4FFE_9995_8439D58246E8__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #include "..\Annotator\AnnotationDefs.h"
00013 #include <deque>
00014 
00015 class CAnnotationBrowserDlg;
00016 class CAnnotationAspect;
00017 class CAnnotationNode;
00018 
00019 typedef CTypedPtrList<CPtrList, CAnnotationNode *> CAnnotationNodeList;
00020 
00021 class CAnnotationAspect {
00022 public:
00023         bool    m_isVisible;
00024         CPoint  m_loc;
00025         bool    m_isLocDef;
00026 
00027         CAnnotationAspect() : m_isVisible(false), m_loc(0,0), m_isLocDef(true) {}
00028 };
00029 
00030 typedef CArray<CAnnotationAspect,CAnnotationAspect&> CAnnotationAspectArray;
00031 
00032 class CAnnotationNode  
00033 {
00034 public:
00035         CComPtr<IMgaRegNode> m_regNode;
00036         IMgaFCOPtr m_archetype;
00037         LOGFONT         m_logfont;
00038         COLORREF        m_color;
00039         COLORREF        m_bgcolor;
00040         COLORREF        m_crGradient;
00041         COLORREF        m_crShadow;
00042         CString         m_text;
00043         CString         m_name;
00044         bool            m_bGradientFill;
00045         int                     m_iGradientDirection;
00046         bool            m_bCastShadow;
00047         int                     m_iShadowDepth;
00048         int                     m_iShadowDirection;
00049         bool            m_bRoundCornerRect;
00050         int                     m_iRoundCornerRadius;
00051 
00052         bool            m_canBeRederived;       // the "broken_deriv" entry signals that
00053                                                                         // the annotation was once inherited,
00054                                                                         // so it could be rederived
00055         
00056         bool            m_inheritable;          // can be shown in subtypes/instances
00057         bool            m_hidden;                       // hide inherited annotation in this subtype/instance only
00058         CAnnotationAspectArray  m_aspects;
00059 
00060         CAnnotationNode(const CComPtr<IMgaRegNode> &regNode, IMgaFCOPtr& archetype);
00061         void Read(CAnnotationBrowserDlg *dlg);
00062         void Write(CAnnotationBrowserDlg *dlg);
00063 
00064         template<typename Func>
00065         void for_each_subnode(Func f)
00066         {
00067                 std::deque<IMgaRegNodePtr> regnodes;
00068                 regnodes.push_back(IMgaRegNodePtr(m_regNode.p));
00069                 while (regnodes.size())
00070                 {
00071                         IMgaRegNodePtr regnode = regnodes.front();
00072                         regnodes.pop_front();
00073                         f(regnode);
00074                         IMgaRegNodesPtr subnodes = regnode->GetSubNodes(VARIANT_FALSE);
00075                         for (int i = 1; i <= subnodes->Count; i++)
00076                         {
00077                                 auto subnode = subnodes->GetItem(i);
00078                                 if (regnode == m_regNode && wcscmp(subnode->Name, AN_HIDDEN) == 0)
00079                                 {
00080                                         continue;
00081                                 }
00082                                 regnodes.push_back(subnodes->GetItem(i));
00083                         }
00084                 }
00085         }
00086 
00087 
00088 public:
00089         static void InitializeClass();
00090         static bool classIsInitialized;
00091         static bool             defCanBeRederived;
00092         static bool             defInheritable;
00093         static bool             defHidden;
00094         static LOGFONT  defFont;
00095         static COLORREF defColor;
00096         static COLORREF defBgcolor;
00097         static COLORREF defShadowcolor;
00098         static COLORREF defGradientcolor;
00099         static bool             defGradientFill;
00100         static int              defGradientDirection;
00101         static bool             defCastShadow;
00102         static int              defShadowDepth;
00103         static int              defShadowDirection;
00104         static bool             defRoundCornerRect;
00105         static int              defRoundCornerRadius;
00106 };
00107 
00108 #endif // !defined(AFX_ANNOTATIONNODE_H__A60720A0_33C3_4FFE_9995_8439D58246E8__INCLUDED_)