#if !defined(AFX_PROPERTYGRID_H__6072C617_4253_4B1E_8492_96177CB31D64__INCLUDED_)
#define AFX_PROPERTYGRID_H__6072C617_4253_4B1E_8492_96177CB31D64__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "items.h"
#include "notifications.h"
#import <msxml3.dll>
// PropertyGrid.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CPropertyGrid window
// In-place controls ID
const UINT IDC_PROPERTYGRID_EDIT = 1;
const UINT IDC_PROPERTYGRID_DATETIME = 2;
const UINT IDC_PROPERTYGRID_COMBOBOX = 3;
const UINT IDC_PROPERTYGRID_HOTKEY = 4;
// UI stuff
const UINT BORDER_WIDTH = 16;
const UINT CATEGORY_FOCUS_RECT_LEFT_INDENT = 3;
const UINT CATEGORY_FOCUS_RECT_RIGHT_INDENT = 3;
const UINT CATEGORY_FOCUS_RECT_TOP_SPACING = 2;
const UINT CATEGORY_FOCUS_RECT_BOTTOM_SPACING = 2;
const UINT CATEGORY_TEXT_LEFT_INDENT = 20;
const UINT CATEGORY_TEXT_TOP_INDENT = 2;
const UINT ELEMENT_TEXT_LEFT_INDENT = 20;
const UINT ELEMENT_TEXT_TOP_INDENT = 2;
const UINT VALUE_TEXT_LEFT_INDENT = 5;
const UINT VALUE_TEXT_TOP_INDENT = 2;
const UINT COMBOBOX_DROPDOWN = 80;
class CPropertyGrid : public CListCtrl
{
// Construction
public:
CPropertyGrid();
BOOL LoadPropertyGridContents(MSXML2::IXMLDOMElementPtr pXML); // Must have propertyGrid as a root element
BOOL LoadPropertyGridTheme(MSXML2::IXMLDOMElementPtr pXML); // Must have propertyGridTheme as a root element
BOOL AcceptEdit();
BOOL CancelEdit();
void SetNotificationReciever(IPropertyGridNotification *pNotificationReciever) { m_pNotificationReciever = pNotificationReciever; }
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CPropertyGrid)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
// Implementation
public:
BOOL SetEditBoxLong(long lID, long lValue);
long GetEditBoxLong(long lID);
BOOL SetHotKey(long lID, WORD wHotKey);
WORD GetHotKey(long lID);
BOOL SetElementValue(long lID, const CString& strValue);
CString GetElementValue(long lID);
BOOL SetComboBoxValue(long lID, long lValue);
long GetComboBoxItemData(long lID);
virtual ~CPropertyGrid();
// Generated message map functions
protected:
//{{AFX_MSG(CPropertyGrid)
afx_msg void OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnGetinfotip(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnReturn(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CString FindComboBoxString(PropertyGrid::ELEMENT &elm, long lValue);
void UninitializeGdiObjects();
void InitializeGdiObjects();
void LoadThemeElement(MSXML2::IXMLDOMNodePtr pNode);
COLORREF LoadThemeColor(MSXML2::IXMLDOMNodePtr pNode);
BYTE LoadThemeColorComponent(MSXML2::IXMLDOMNamedNodeMapPtr pMap, LPCTSTR pszAttribute);
void DrawFocusRect(HDC hDC, const CRect &rcRect, const CString &strText);
void InitComboBox(PropertyGrid::ELEMENT &elm);
BOOL LoadComboBoxString(MSXML2::IXMLDOMNodePtr pNode, PropertyGrid::ELEMENT &elm);
BOOL LoadComboBoxEntries(MSXML2::IXMLDOMNodeListPtr pNodes, PropertyGrid::ELEMENT &elm);
BOOL LoadElement(MSXML2::IXMLDOMNodePtr pNode, PropertyGrid::ELEMENT &elm);
void LoadElements(MSXML2::IXMLDOMNodeListPtr pNodes, PropertyGrid::CATEGORY &ctg);
void LoadCategory(MSXML2::IXMLDOMNamedNodeMapPtr pMap, PropertyGrid::CATEGORY &ctg);
void LoadCategory(MSXML2::IXMLDOMNodePtr pNode);
void DrawElementGrid(HDC hDC, const CRect& rcRect);
void DrawElementSection(HDC hDC, const CRect &rcRect, const CString& strText, const CString& strValue, BOOL bSelected, BOOL bChanged, BOOL bReadOnly);
void DrawCategorySection(HDC hDC, const CRect& rcRect, const CString& strText, BOOL bSelected, BOOL bExpanded);
CString CompactString(HDC hDC, const CString& rString, int cx);
virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
BOOL BeginEdit(PropertyGrid::LELEMENT::iterator lei, int nItem);
BOOL m_bSizing;
BOOL m_bSize;
BOOL Between(int nValue, int nSample, int nDelta);
int GetItem(int nItem, PropertyGrid::VCATEGORY::iterator& vci, PropertyGrid::LELEMENT::iterator& lei); // returns 1 if lei valid, otherwise 0
int GetExpandedCount();
CImageList m_imgList;
COLORREF m_crCategory;
COLORREF m_crCategoryFont;
COLORREF m_crCategoryTopBorder;
COLORREF m_crSubcategory;
COLORREF m_crSubcategoryFont;
COLORREF m_crElement;
COLORREF m_crElementFont;
COLORREF m_crElementSelected;
COLORREF m_crElementSelectedFont;
HBRUSH m_brCategory;
HBRUSH m_brSubcategory;
HBRUSH m_brElement;
HPEN m_pnDot;
HPEN m_pnLines;
HFONT m_hNormal;
HFONT m_hBold;
HCURSOR m_hSize;
HCURSOR m_hArrow;
CEdit m_ctrlEdit;
CDateTimeCtrl m_ctrlDateTime;
CComboBox m_ctrlCombo;
CHotKeyCtrl m_ctrlHotKey;
PropertyGrid::VCATEGORY m_vCategories;
PropertyGrid::EDITEDITEM m_eiItem;
CRect m_rcClient;
int m_nNameColumn, m_nValueColumn;
IPropertyGridNotification *m_pNotificationReciever;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PROPERTYGRID_H__6072C617_4253_4B1E_8492_96177CB31D64__INCLUDED_)