GME  13
MgaMappedTreeCtrl.cpp
Go to the documentation of this file.
00001 // MgaMappedTreeCtrl.cpp: implementation of the CMgaMappedTreeCtrl class.
00002 //
00004 
00005 #include "stdafx.h"
00006 #include "gmeactivebrowser.h"
00007 #include "MgaMappedTreeCtrl.h"
00008 
00009 #ifdef _DEBUG
00010 #undef THIS_FILE
00011 static char THIS_FILE[]=__FILE__;
00012 #define new DEBUG_NEW
00013 #endif
00014 
00016 // Construction/Destruction
00018 
00019 BOOL CMgaMappedTreeCtrlBase::SetItemState(HTREEITEM hItem, UINT nState)
00020 {
00021 
00022         if(nState&TVIS_BOLD)CTreeCtrl::SetItemState(hItem,TVIS_BOLD,TVIS_BOLD); 
00023         if(nState&TVIS_SELECTED)CTreeCtrlEx::SelectItemEx(hItem);
00024         if(nState&TVIS_EXPANDED)Expand(hItem,TVE_EXPAND );
00025 
00026         return TRUE;
00027 }
00028 
00029 // Recursively deletes every child
00030 void CMgaMappedTreeCtrlBase::DeleteAllChildren(HTREEITEM hParent)
00031 {
00032         if (ItemHasChildren(hParent)) // this may indicate true and the GetChildItem may give at the same time back 0x00000000 since that children may not have htreeitem inserted for it
00033         {
00034            HTREEITEM hItem = GetChildItem(hParent);
00035 
00036            while (hItem != NULL)
00037            {
00038                         DeleteAllChildren(hItem);
00039 
00040                         HTREEITEM hNextItem = GetNextSiblingItem(hItem);                
00041                         // Consistently removes item from map and the tree ctrl
00042                         DeleteItem(hItem);
00043                         hItem=hNextItem;
00044 
00045            }
00046         }
00047 
00048 }
00049 
00050 void CMgaMappedTreeCtrlBase::ExpandAllChildren(HTREEITEM hParent,UINT nCode)
00051 {
00052 
00053         if (ItemHasChildren(hParent))
00054         {
00055            HTREEITEM hItem = GetChildItem(hParent);
00056 
00057            while (hItem != NULL)
00058            {               
00059                    Expand(hItem,nCode);
00060                    hItem = GetNextSiblingItem(hItem);                                           
00061            }
00062         }
00063 
00064 }
00065 
00066 
00067 BOOL CMgaMappedTreeCtrlBase::IsRelevantDropTarget(CPoint point, CImageList*)
00068 {
00069         return FALSE;
00070 }
00071 
00072 void CMgaMappedTreeCtrlBase::RegisterDropTarget()
00073 {
00074 
00075         m_DropTarget.Register(this);
00076 }
00077 
00078 BOOL CMgaMappedTreeCtrlBase::DoDrop(eDragOperation, COleDataObject*, CPoint)
00079 {
00080         return FALSE;
00081 }