1 //*******************************************************************************
4 // You may use this source code, compile or redistribute it as part of your application
5 // for free. You cannot redistribute it as a part of a software development
6 // library without the agreement of the author. If the sources are
7 // distributed along with the application, you should leave the original
8 // copyright notes in the source code without any changes.
9 // This code can be used WITHOUT ANY WARRANTIES at your own risk.
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
18 // TabClientView.cpp : implementation file
22 #include "UITreeView.h"
23 #include "UIMessages.h"
28 static char THIS_FILE[] = __FILE__;
31 /////////////////////////////////////////////////////////////////////////////
34 IMPLEMENT_DYNAMIC(CUITreeView, CView)
36 CUITreeView::CUITreeView(UINT nID) : m_nID(nID), m_pTreeCtrl(NULL)
38 m_Style = WS_VISIBLE | /*WS_BORDER |*/ WS_CHILD | LVS_REPORT;
41 CUITreeView::~CUITreeView()
46 CUITreeCtrl &CUITreeView::GetTreeCtrl()
52 void CUITreeView::CreateTreeCtrl()
54 m_pTreeCtrl = new CUITreeCtrl;
57 void CUITreeView::SelectionChanged(const CRefresh &Refresh)
61 BEGIN_MESSAGE_MAP(CUITreeView, CView)
62 //{{AFX_MSG_MAP(CUITreeView)
67 ON_MESSAGE(WM_APP_UPDATE_ALL_VIEWS, OnAppUpdateAllViews)
70 /////////////////////////////////////////////////////////////////////////////
71 // CUITreeView drawing
73 void CUITreeView::OnDraw(CDC* pDC)
75 CDocument* pDoc = GetDocument();
76 // TODO: add draw code here
79 /////////////////////////////////////////////////////////////////////////////
80 // CUITreeView diagnostics
83 void CUITreeView::AssertValid() const
88 void CUITreeView::Dump(CDumpContext& dc) const
94 /////////////////////////////////////////////////////////////////////////////
95 // CUITreeView message handlers
97 int CUITreeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
99 if (CView::OnCreate(lpCreateStruct) == -1)
104 if (GetTreeCtrl().Create(m_Style,CRect(0,0,0,0),this,m_nID) == -1)
110 BOOL CUITreeView::PreCreateWindow(CREATESTRUCT& cs)
112 // TODO: Add your specialized code here and/or call the base class
113 cs.lpszClass = AfxRegisterWndClass(
118 ASSERT(cs.lpszClass);
119 BOOL ret = CView::PreCreateWindow(cs);
120 cs.dwExStyle |= WS_EX_CLIENTEDGE;
124 void CUITreeView::OnSetFocus(CWnd* pOldWnd)
126 CView::OnSetFocus(pOldWnd);
128 // TODO: Add your message handler code here
129 GetTreeCtrl().SetFocus();
132 void CUITreeView::OnSize(UINT nType, int cx, int cy)
134 CView::OnSize(nType, cx, cy);
136 // TODO: Add your message handler code here
137 if (GetTreeCtrl().GetSafeHwnd())
138 GetTreeCtrl().MoveWindow(0,0,cx,cy);
141 LRESULT CUITreeView::OnAppUpdateAllViews( WPARAM wParam, LPARAM lParam )
144 GetDocument()->UpdateAllViews(NULL,wParam,(CObject*)lParam);
148 void CUITreeView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
150 // TODO: Add your specialized code here and/or call the base class
151 if (lHint == HINT_TREE_SEL_CHANGED)
154 ASSERT_KINDOF(CRefresh,pHint);
155 CRefresh *pRefresh = (CRefresh*)pHint;
156 SelectionChanged(*pRefresh);