// TXMLReaderView.h : interface of the CTXMLEditorView class
//
#pragma once
#include<afxcview.h>
#include "EditTreeCtrlEx.h"
class CTXMLEditorView;
class CXMLTreeCtrl : public CEditTreeCtrlEx
{
public:
CXMLTreeCtrl()
{
_bNewParent = false;
_bAttrib = false;
_view = NULL;
}
void SetParentView(CTXMLEditorView* view)
{
_view = view;
}
protected:
virtual void OnNewItem(HTREEITEM hItem);
virtual bool NewItem(TVINSERTSTRUCT& ins);
virtual bool DoDeleteItem(HTREEITEM hItem);
public:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
public:
afx_msg void OnTvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult);
private:
CTXMLEditorView* _view;
bool _bNewParent;
bool _bAttrib;
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
};
class CTXMLEditorView : public CView
{
protected: // create from serialization only
CTXMLEditorView();
DECLARE_DYNCREATE(CTXMLEditorView)
// Attributes
public:
CTXMLEditorDoc* GetDocument() const;
CXMLTreeCtrl& GetTreeCtrl()
{
return m_treeCtrl;
}
void SetModified(BOOL modified);
// Operations
public:
void PopulateTreeCtrl(TXMLParser& parser, TXMLNode* curNode, HTREEITEM hParent);
// Overrides
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
// Implementation
public:
virtual ~CTXMLEditorView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
CXMLTreeCtrl m_treeCtrl;
void UpdateXMLDocument();
// Generated message map functions
protected:
DECLARE_MESSAGE_MAP()
public:
virtual BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, LPVOID lpParam = NULL);
public:
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
afx_msg void OnFilePrintPreview();
public:
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
public:
afx_msg void OnPaint();
protected:
virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/);
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
public:
afx_msg void OnSize(UINT nType, int cx, int cy);
public:
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
public:
virtual void OnFinalRelease();
public:
afx_msg void OnFileSave();
public:
afx_msg void OnFileSaveAs();
public:
afx_msg void OnUpdateFileSaveAs(CCmdUI *pCmdUI);
public:
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
void FormXMLDocFromTree(HTREEITEM hParent, TXMLNode* parent);
};
#ifndef _DEBUG // debug version in TXMLReaderView.cpp
inline CTXMLReaderDoc* CTXMLEditorView::GetDocument() const
{ return reinterpret_cast<CTXMLReaderDoc*>(m_pDocument); }
#endif