Click here to Skip to main content
15,891,529 members
Articles / Desktop Programming / MFC

Property list ActiveX control

Rate me:
Please Sign up or sign in to vote.
3.88/5 (23 votes)
4 Nov 20043 min read 190.4K   7K   58  
Property list similar to VB.NET, implemented as ActiveX control.
#if !defined(AFX_MYLIST_H__3A71A0DB_C6AB_4D90_8AB5_6E9DAD91C9FF__INCLUDED_)
#define AFX_MYLIST_H__3A71A0DB_C6AB_4D90_8AB5_6E9DAD91C9FF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyList.h : header file
//
#include "Category.h"
/////////////////////////////////////////////////////////////////////////////
// CMyList window
#define MOUSE_SELECT		0
#define MOUSE_MOVE_COLUMN	1

#define ITEM_CAPTION	0x0002
#define ITEM_BUTTON		0x0004
#define ITEM_COLUMN		0x0008
#define ITEM_IMAGE		0x0010

class CMyList : public CListBox
{
// Construction
public:
	CMyList();

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMyList)
	protected:
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	HRESULT SetValue(LPCTSTR PropertyName, const VARIANT FAR& Value);
	void Clear();
	void SwitchCategory(int itemId);
	int HitTest(CPoint pt,UINT &nFlags);
	int m_mouseAction;
	int m_captionWidth;
	CListItem* GetItem(LPCTSTR caption,int& index);
	CListItem* GetItem(int index);
	void AddProperty(LPCTSTR Category, LPCTSTR Caption, const VARIANT FAR& Value, LPCTSTR Description, short ButtonType, BOOL IsEnabled);
	virtual ~CMyList();
	CStatic* info;

	// Generated message map functions
protected:
	//{{AFX_MSG(CMyList)
	afx_msg void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 
	afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnDblclk();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

private:
	void DeactivateCurrent();
	BOOL OnColumn();
	CList <CListItem*,CListItem*> m_items;
	CBitmap bmCatLeft;
	CBitmap bmCatOnDn;
	CBitmap bmCatOnUp;
	CFont fntBold;
	CFont fntReg;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MYLIST_H__3A71A0DB_C6AB_4D90_8AB5_6E9DAD91C9FF__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) RDV Systems
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions