GME  13
PartBrowserPane.h
Go to the documentation of this file.
00001 #if !defined(AFX_PARTBROWSERPANE_H__B9443F67_C8F4_11D3_91EB_00104B98EAD9__INCLUDED_)
00002 #define AFX_PARTBROWSERPANE_H__B9443F67_C8F4_11D3_91EB_00104B98EAD9__INCLUDED_
00003 
00004 #if _MSC_VER > 1000
00005 #pragma once
00006 #endif // _MSC_VER > 1000
00007 // PartBrowserPane.h : header file
00008 //
00009 
00010 #include "StdAfx.h"
00011 #include <vector>
00012 #include <Gdiplus.h>
00013 
00014 
00016 // PartWithDecorator helper class
00017 
00018 class PartWithDecorator
00019 {
00020 public:
00021         CComPtr<IMgaMetaPart>                                           part;
00022         CString                                                                         name;   // Calculated, cached for speedup
00023         CComPtr<IMgaDecorator>                                          decorator;
00024         CComPtr<IMgaElementDecorator>                           newDecorator;
00025 
00026         PartWithDecorator operator=(PartWithDecorator&& that)
00027         {
00028                 if (this != &that)
00029                 {
00030                         this->part = std::move(that.part);
00031                         this->name = std::move(that.name);
00032                         this->decorator = std::move(that.decorator);
00033                         this->newDecorator = std::move(that.newDecorator);
00034                 }
00035                 return *this;
00036         }
00037         PartWithDecorator(PartWithDecorator&& that)
00038                 : part(std::move(that.part)),
00039                 name(std::move(that.name)),
00040                 decorator(std::move(that.decorator)),
00041                 newDecorator(std::move(that.newDecorator))
00042         {
00043         }
00044         PartWithDecorator() {}
00045 };
00046 
00047 
00049 // CPartBrowserPane window
00050 
00051 class CPartBrowserPane : public CWnd
00052 {
00053 // Construction
00054 public:
00055         CPartBrowserPane();
00056         virtual ~CPartBrowserPane();
00057 
00058 private:
00059 // Operations
00060         CComBSTR        GetDecoratorProgId(IMgaMetaFCO* metaFCO);
00061         bool            IsPartDisplayable(CComPtr<IMgaMetaPart> metaPart);
00062         bool            FindObject(CPoint &pt, PartWithDecorator& pdt);
00063         void            CreateDecorators(CComPtr<IMgaMetaParts> metaParts);
00064         void            DestroyDecorators(void);
00065 
00066 // Attributes
00067 protected:
00068         CComPtr<IMgaProject>                                                    mgaProject;
00069         CComPtr<IMgaMetaModel>                                                  mgaMetaModel;
00070         COLORREF                                                                                backgroundColor;
00071         std::vector<std::vector<PartWithDecorator> >    pdts;
00072         int                                                                                             currentAspectIndex;
00073         CSize                                                                                   maxSize;
00074         bool                                                                                    omitPaintMessages;
00075         CFont                                                                                   txtMetricFont;
00076         static Gdiplus::SmoothingMode                                   m_eEdgeAntiAlias;               // Edge smoothing mode
00077         static Gdiplus::TextRenderingHint                               m_eFontAntiAlias;               // Text renndering hint mode
00078 
00079 public:
00080 // Operations
00081         void Resize(CRect r);
00082 
00083 // Get/Set methods
00084         void SetCurrentProject(CComPtr<IMgaProject> project);
00085         void SetMetaModel(CComPtr<IMgaMetaModel> meta);
00086         void SetBgColor(COLORREF bgColor);
00087         void ChangeAspect(int index);
00088 
00089 // Overrides
00090         // ClassWizard generated virtual function overrides
00091         //{{AFX_VIRTUAL(CPartBrowserPane)
00092         //}}AFX_VIRTUAL
00093 
00094 // Implementation
00095 
00096         // Generated message map functions
00097 protected:
00098         //{{AFX_MSG(CPartBrowserPane)
00099         afx_msg void OnPaint();
00100         afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00101         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00102         //}}AFX_MSG
00103         DECLARE_MESSAGE_MAP()
00104 };
00105 
00107 
00108 //{{AFX_INSERT_LOCATION}}
00109 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
00110 
00111 #endif // !defined(AFX_PARTBROWSERPANE_H__B9443F67_C8F4_11D3_91EB_00104B98EAD9__INCLUDED_)