Click here to Skip to main content
15,884,537 members
Articles / Desktop Programming / MFC

Be Sweet - a set of visual source code browsers

Rate me:
Please Sign up or sign in to vote.
4.85/5 (35 votes)
1 Jul 20038 min read 183.7K   4.9K   122  
A set of source code and project browsers to compliment Visual Studio.
/*!
	\file
*/
#if !defined(AFX_OPTIONLISTBOX_H__ED7E3015_515F_11D6_9C1E_00B0D0452EEC__INCLUDED_)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define AFX_OPTIONLISTBOX_H__ED7E3015_515F_11D6_9C1E_00B0D0452EEC__INCLUDED_
#endif

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

/////////////////////////////////////////////////////////////////////////////
// COptionListBox window
#include "OptionSheet.h"

/*!
	\brief	Child list window used by COptionSheet
*/
class COptionListBox : public CListBox, public COptionSheet::COptionList
{
// Construction
public:
	/*!
		\brief Default Constructor
	*/
	COptionListBox();

	/*!
		\brief	Create the control [window]

		The create method is called by COptionSheet in order to create
		the child list control.

		\param	pParentWnd	The parent window of the control. Cannot be NULL.
		\param	nID			The control ID.

		\return			The state of the operation.
		\retval	TRUE	The control was created.
		\retval FALSE	Creation of the control failed.
	*/
	virtual BOOL Create(COptionSheet *pParentWnd, UINT nID);

	/*!
		\brief Adds a group page to the control

		This member is called by COptionSheet to add a group to the list.

		\param	pPage	Pointer to a COptionPage object used as the group.

		\return			The state of the operation.
		\retval	TRUE	The page was added as a group.
		\retval FALSE	The page was not added as a group.
	*/
	virtual BOOL AddGroup(COptionPage *pPage);

	/*!
		\brief Adds a page to the control

		This member is called by COptionSheet to add a page to the list.

		\param	pPage		Pointer to a COptionPage object to add.
		\param	pGroupPage	Pointer to the group this page belongs to.
							If NULL, the page is added at the root level.

		\return			The state of the operation.
		\retval	TRUE	The page was added as a group.
		\retval FALSE	The page was not added as a group.
	*/
	virtual BOOL AddPage(COptionPage *page, COptionPage *pGroupPage);

  virtual BOOL RemovePage(int index);
	/*!
		\brief Selects a page as being active/

		This member is called by COptionSheet to show that the supplied
		page is active.

		\param	pPage		Pointer to a COptionPage object to show as active.

		\return			The state of the operation.
		\retval	TRUE	The page was added as a group.
		\retval FALSE	The page was not added as a group.
	*/
	virtual BOOL SetSelection(COptionPage *page);

	/*!
		\brief	Retrieves the active (highlighted) page 

		Retrieves the active (highlighted) page. If no page is selected,
		this method returns NULL.

		\return		Pointer to the active page or NULL if no page is active.
	*/
	virtual COptionPage *GetSelection();

	/*!
		\brief	Retrieves the CWnd derived object used for the control.

		\return	A pointer to the CWnd object of the control. This cannot be NULL.
	*/
	virtual CWnd *GetControlWnd();

// Attributes
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(COptionListBox)
	public:
	virtual void DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~COptionListBox();

	// Generated message map functions
protected:
	//{{AFX_MSG(COptionListBox)
	afx_msg void OnSelectionChange();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnDestroy();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
private:
	CImageList	m_ImageList;
	COptionPage* GetItemPage(int nIndex);
	COptionPage* GetItemGroup(int nIndex);
	BOOL AddItem(COptionPage *pPage, COptionPage *pGroup = NULL, int nIndex = -1, BOOL bGroup = FALSE);
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
#endif
};

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

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

#endif // !defined(AFX_OPTIONLISTBOX_H__ED7E3015_515F_11D6_9C1E_00B0D0452EEC__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
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions