Click here to Skip to main content
15,886,797 members
Articles / Web Development / HTML

A Comprehensive CE Class Library to Replace ATL and MFC

Rate me:
Please Sign up or sign in to vote.
4.48/5 (14 votes)
4 Oct 2000CPOL 279.1K   998   70  
A collection of classes for CE that do not use ATL or MFC, plus an FTP client, database viewer, and sample application that solves beam deflection equations.
#if !defined(AFX_IMAGECOMBOBOX_H__AE816235_47FB_11D2_A344_00A024141570__INCLUDED_)
#define AFX_IMAGECOMBOBOX_H__AE816235_47FB_11D2_A344_00A024141570__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ImageComboBox.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CImageComboBox window

class CImageComboBox : public CComboBox
{
private:
	////////////////////////////////////////////////////////////////////////////////
	// Structure used to hold additional information about a list item
	////////////////////////////////////////////////////////////////////////////////
	struct CIconIndent
	{
	public:
		CIconIndent(int nSteps, int nImage, DWORD dwData = 0)
		{
			m_nIndentSteps = nSteps;
			m_nImageIndex = nImage;
			m_dwItemData = dwData;
		}

		int m_nIndentSteps;
		int m_nImageIndex;
		DWORD m_dwItemData;      // Replaces direct item data
	};


// Construction
public:
	CImageComboBox();

// Attributes
public:
    CImageList* m_pImages;

// Operations
public:
    CImageList* GetImageList() const { return m_pImages; }
    void SetImageList(CImageList* pImages) { m_pImages = pImages; }

	DWORD GetItemData(int nIndex) const;
	void* GetItemDataPtr(int nIndex) const;
	int SetItemData(int nIndex, DWORD dwItemData);
	int SetItemDataPtr(int nIndex, void* pData);

    // New function to help populate the list
    AddString(LPCTSTR lpszString,		// The string
					int nImage=-1,			// Image index
					int nSteps=0,			// Number of steps indented
					DWORD dwData=0);	// Item data

    InsertString(int nIndex,			// Position index
					LPCTSTR lpszString,	// The string
					int nImage=-1,		// Image index
					int nSteps=0,		// Number of steps indented
					DWORD dwData=0);	// Item data

public:
	virtual BOOL DestroyWindow();

protected:
//	virtual void PreSubclassWindow();

// Overridables (must override draw, measure and compare for owner draw)
//	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
//	virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
//	virtual int CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);
//	virtual void DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct);

	virtual void OnMessage();

	virtual void OnDeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct);
	virtual void OnDrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual void OnMeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);

// Implementation
public:
	virtual ~CImageComboBox();

	// Generated message map functions
protected:
	//{{AFX_MSG(CImageComboBox)
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

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

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_IMAGECOMBOBOX_H__AE816235_47FB_11D2_A344_00A024141570__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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions