GME  13
AnnotatorDecorator.cpp
Go to the documentation of this file.
00001 //################################################################################################
00002 //
00003 // Annotator decorator class
00004 //      AnnotatorDecorator.cpp
00005 //
00006 //################################################################################################
00007 
00008 #include "StdAfx.h"
00009 #include "AnnotatorDecorator.h"
00010 #include "AnnotatorCompositePart.h"
00011 
00012 
00013 namespace AnnotatorDecor {
00014 
00015 //################################################################################################
00016 //
00017 // CLASS : AnnotatorDecorator
00018 //
00019 //################################################################################################
00020 
00021 AnnotatorDecorator::AnnotatorDecorator(CComPtr<IMgaCommonDecoratorEvents>& eventSink):
00022         m_part(NULL),
00023         m_eventSink(eventSink)
00024 {
00025 }
00026 
00027 AnnotatorDecorator::~AnnotatorDecorator()
00028 {
00029 }
00030 
00031 void AnnotatorDecorator::Initialize(CComPtr<IMgaProject>& pProject, CComPtr<IMgaMetaPart>& pPart, CComPtr<IMgaFCO>& pFCO)
00032 {
00033         m_part->Initialize(pProject, pPart, pFCO);
00034 }
00035 
00036 void AnnotatorDecorator::Destroy()
00037 {
00038         if (m_part) {
00039                 m_part->Destroy();
00040                 delete m_part;
00041                 m_part = NULL;
00042         }
00043 }
00044 
00045 CString AnnotatorDecorator::GetMnemonic(void) const
00046 {
00047         return m_part->GetMnemonic();
00048 }
00049 
00050 feature_code AnnotatorDecorator::GetFeatures(void) const
00051 {
00052         return m_part->GetFeatures();
00053 }
00054 
00055 void AnnotatorDecorator::SetParam(const CString& strName, VARIANT vValue)
00056 {
00057         m_strName = strName;
00058         m_vValue = vValue;
00059 }
00060 
00061 void AnnotatorDecorator::GetParam(const CString& strName, VARIANT* pvValue)
00062 {
00063         m_part->GetParam(strName, pvValue);
00064 }
00065 
00066 void AnnotatorDecorator::SetActive(bool bIsActive)
00067 {
00068         m_part->SetActive(bIsActive);
00069 }
00070 
00071 CSize AnnotatorDecorator::GetPreferredSize(void) const
00072 {
00073         return m_part->GetPreferredSize();
00074 }
00075 
00076 
00077 void AnnotatorDecorator::SetLocation(const CRect& location)
00078 {
00079         m_part->SetLocation(location);
00080 }
00081 
00082 CRect AnnotatorDecorator::GetLocation(void) const
00083 {
00084         return m_part->GetLocation();
00085 }
00086 
00087 CRect AnnotatorDecorator::GetLabelLocation(void) const
00088 {
00089         return m_part->GetLabelLocation();
00090 }
00091 
00092 CRect AnnotatorDecorator::GetPortLocation(CComPtr<IMgaFCO>& fco) const
00093 {
00094         return m_part->GetPortLocation(fco);
00095 }
00096 
00097 void AnnotatorDecorator::GetPorts(CComPtr<IMgaFCOs>& portFCOs) const
00098 {
00099         m_part->GetPorts(portFCOs);
00100 }
00101 
00102 void AnnotatorDecorator::Draw(CDC* pDC, Gdiplus::Graphics* gdip)
00103 {
00104         m_part->Draw(pDC, gdip);
00105 }
00106 
00107 void AnnotatorDecorator::SaveState()
00108 {
00109         m_part->SaveState();
00110 }
00111 
00112 // New functions
00113 void AnnotatorDecorator::InitializeEx(CComPtr<IMgaProject>& pProject, CComPtr<IMgaMetaPart>& pPart, CComPtr<IMgaFCO>& pFCO,
00114                                                                           HWND parentWnd)
00115 {
00116         AnnotatorCompositePart* annotatorComposite = new AnnotatorCompositePart(NULL, m_eventSink);
00117         m_part = annotatorComposite;
00118         m_part->SetParam(m_strName, m_vValue);
00119 
00120         annotatorComposite->InitializeEx(pProject, pPart, pFCO, parentWnd);
00121 }
00122 
00123 void AnnotatorDecorator::SetSelected(bool bIsSelected)
00124 {
00125         m_part->SetSelected(bIsSelected);
00126 }
00127 
00128 bool AnnotatorDecorator::MouseMoved(UINT nFlags, const CPoint& point, HDC transformHDC)
00129 {
00130         return m_part->MouseMoved(nFlags, point, transformHDC);
00131 }
00132 
00133 bool AnnotatorDecorator::MouseLeftButtonDown(UINT nFlags, const CPoint& point, HDC transformHDC)
00134 {
00135         return m_part->MouseLeftButtonDown(nFlags, point, transformHDC);
00136 }
00137 
00138 bool AnnotatorDecorator::MouseLeftButtonUp(UINT nFlags, const CPoint& point, HDC transformHDC)
00139 {
00140         return m_part->MouseLeftButtonUp(nFlags, point, transformHDC);
00141 }
00142 
00143 bool AnnotatorDecorator::MouseLeftButtonDoubleClick(UINT nFlags, const CPoint& point, HDC transformHDC)
00144 {
00145         return m_part->MouseLeftButtonDoubleClick(nFlags, point, transformHDC);
00146 }
00147 
00148 bool AnnotatorDecorator::MouseRightButtonDown(HMENU hCtxMenu, UINT nFlags, const CPoint& point, HDC transformHDC)
00149 {
00150         return m_part->MouseRightButtonDown(hCtxMenu, nFlags, point, transformHDC);
00151 }
00152 
00153 bool AnnotatorDecorator::MouseRightButtonUp(UINT nFlags, const CPoint& point, HDC transformHDC)
00154 {
00155         return m_part->MouseRightButtonUp(nFlags, point, transformHDC);
00156 }
00157 
00158 bool AnnotatorDecorator::MouseRightButtonDoubleClick(UINT nFlags, const CPoint& point, HDC transformHDC)
00159 {
00160         return m_part->MouseRightButtonDoubleClick(nFlags, point, transformHDC);
00161 }
00162 
00163 bool AnnotatorDecorator::MouseMiddleButtonDown(UINT nFlags, const CPoint& point, HDC transformHDC)
00164 {
00165         return m_part->MouseMiddleButtonDown(nFlags, point, transformHDC);
00166 }
00167 
00168 bool AnnotatorDecorator::MouseMiddleButtonUp(UINT nFlags, const CPoint& point, HDC transformHDC)
00169 {
00170         return m_part->MouseMiddleButtonUp(nFlags, point, transformHDC);
00171 }
00172 
00173 bool AnnotatorDecorator::MouseMiddleButtonDoubleClick(UINT nFlags, const CPoint& point, HDC transformHDC)
00174 {
00175         return m_part->MouseMiddleButtonDoubleClick(nFlags, point, transformHDC);
00176 }
00177 
00178 bool AnnotatorDecorator::MouseWheelTurned(UINT nFlags, short distance, const CPoint& point, HDC transformHDC)
00179 {
00180         return m_part->MouseWheelTurned(nFlags, distance, point, transformHDC);
00181 }
00182 
00183 bool AnnotatorDecorator::DragEnter(DROPEFFECT* dropEffect, COleDataObject* pDataObject, DWORD dwKeyState, const CPoint& point, HDC transformHDC)
00184 {
00185         return m_part->DragEnter(dropEffect, pDataObject, dwKeyState, point, transformHDC);
00186 }
00187 
00188 bool AnnotatorDecorator::DragOver(DROPEFFECT* dropEffect, COleDataObject* pDataObject, DWORD dwKeyState, const CPoint& point, HDC transformHDC)
00189 {
00190         return m_part->DragOver(dropEffect, pDataObject, dwKeyState, point, transformHDC);
00191 }
00192 
00193 bool AnnotatorDecorator::Drop(COleDataObject* pDataObject, DROPEFFECT dropEffect, const CPoint& point, HDC transformHDC)
00194 {
00195         return m_part->Drop(pDataObject, dropEffect, point, transformHDC);
00196 }
00197 
00198 bool AnnotatorDecorator::DropFile(HDROP p_hDropInfo, const CPoint& point, HDC transformHDC)
00199 {
00200         return m_part->DropFile(p_hDropInfo, point, transformHDC);
00201 }
00202 
00203 bool AnnotatorDecorator::MenuItemSelected(UINT menuItemId, UINT nFlags, const CPoint& point, HDC transformHDC)
00204 {
00205         return m_part->MenuItemSelected(menuItemId, nFlags, point, transformHDC);
00206 }
00207 
00208 bool AnnotatorDecorator::OperationCanceledByGME(void)
00209 {
00210         return m_part->OperationCanceledByGME();
00211 }
00212 
00213 }; // namespace AnnotatorDecor