GME
13
|
00001 // AggregateTreeCtrl.h: interface for the CAggregateTreeCtrl class. 00002 // 00004 00005 #if !defined(AFX_AGGREGATETREECTRL_H__BAA3D537_E504_4801_B793_6F96B703380C__INCLUDED_) 00006 #define AFX_AGGREGATETREECTRL_H__BAA3D537_E504_4801_B793_6F96B703380C__INCLUDED_ 00007 00008 #if _MSC_VER > 1000 00009 #pragma once 00010 #endif // _MSC_VER > 1000 00011 00012 #include "MgaMappedTreeCtrl.h" 00013 00014 #include <GdiPlus.h> 00015 #include <memory> 00016 #include <map> 00017 #include <unordered_map> 00018 00019 struct CComBSTR_hashfunc : public stdext::hash_compare<CComBSTR> 00020 { 00021 size_t operator()(const CComBSTR &p_ob) const 00022 { 00023 size_t c = 0; 00024 for(unsigned int i = 0; i < p_ob.Length(); i+= 3) c += p_ob[i]; 00025 return c; 00026 } 00027 bool operator()(const CComBSTR &p_ob1, const CComBSTR &p_ob2) const 00028 { 00029 return p_ob1 < p_ob2; 00030 } 00031 }; 00032 00033 struct CAggregateMgaObjectProxy : public CMgaObjectProxy 00034 { 00035 CAggregateMgaObjectProxy() : CMgaObjectProxy() { }; 00036 CAggregateMgaObjectProxy(const CMgaObjectProxy& proxy) : CMgaObjectProxy(proxy) {}; 00037 CAggregateMgaObjectProxy(LPUNKNOWN pMgaObject, objtype_enum type) : 00038 CMgaObjectProxy(pMgaObject, type) {}; 00039 }; 00040 00041 class CAggregateTreeCtrl : public CMgaMappedTreeCtrl<CAggregateMgaObjectProxy> 00042 { 00043 friend class CAggregatePropertyPage; 00044 friend class CAggregateContextMenu; 00045 00046 CMapStringToString m_StateBuffer; 00047 00048 BOOL m_bIsStateStored; 00049 public: 00050 BOOL IsLibrary(LPUNKNOWN pUnknown, bool *p_ptrIsDependent = 0); 00051 static bool IsUngroupedLibrary(CComPtr<IMgaFolder> ptr); 00052 00053 00054 void SetItemProperties(HTREEITEM hItem, int p_fileLatentState=0, CAggregateMgaObjectProxy* insertedProxy=nullptr); 00055 std::map<_bstr_t, int> treeIcons; 00056 std::unordered_map<CComBSTR, int, CComBSTR_hashfunc> m_highlightedObjects; 00057 void GetCustomTreeIcon(IMgaObject* ccpMgaObject, TVITEM& tvItem); 00058 BOOL DoDrop(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point); 00059 BOOL DoDropWithoutChecking(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point); 00060 void MakeSureGUIDIsUniqueForSmartCopy( CComPtr<IMgaFCO>& fco); 00061 BOOL IsRelevantDropTarget(CPoint point,CImageList*); 00062 void RestoreState(); 00063 void StoreState(); 00064 void MaintainRegistry(); 00065 void SortItems(HTREEITEM hItem=NULL); 00066 static int CALLBACK ItemCompareProc(LPARAM lParamItem1, LPARAM lParamItem2, LPARAM lParamSort); 00067 void SaveTreeStateToRegistry(CString&); 00068 void LoadTreeStateFromRegistry(CString&); 00069 void LoadItemStateFromRegistry(CString& strProjectName, HTREEITEM hItem); 00070 HTREEITEM InsertItem(HTREEITEM hParent, CString strObjectName, LPUNKNOWN pUnknown, objtype_enum otObjectType, bool update=false); 00071 HTREEITEM InsertItemUpdate(HTREEITEM hParent, CString strObjectName, LPUNKNOWN pUnknown, objtype_enum otObjectType); 00072 00073 CAggregateTreeCtrl(); 00074 virtual ~CAggregateTreeCtrl(); 00075 00076 }; 00077 00078 #endif // !defined(AFX_AGGREGATETREECTRL_H__BAA3D537_E504_4801_B793_6F96B703380C__INCLUDED_)