// XTPControlListBox.h : interface for the CXTPControlListBox class.
//
// This file is a part of the XTREME COMMANDBARS MFC class library.
// (c)1998-2012 Codejock Software, All Rights Reserved.
//
// THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
// RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
// CONSENT OF CODEJOCK SOFTWARE.
//
// THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
// IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
// YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
// SINGLE COMPUTER.
//
// CONTACT INFORMATION:
// support@codejock.com
// http://www.codejock.com
//
/////////////////////////////////////////////////////////////////////////////
//{{AFX_CODEJOCK_PRIVATE
#if !defined(__XTPCONTROLLISTBOX_H__)
#define __XTPCONTROLLISTBOX_H__
//}}AFX_CODEJOCK_PRIVATE
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//-----------------------------------------------------------------------
// Summary:
// The XTP_LBN_SELCHANGE is sent to active view when the selection of CXTPControlListBox
// is changed
// Example:
// Here is an example of how an application would process the XTP_LBN_SELCHANGE
// message.
//
// BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
// //{{AFX_MSG_MAP(CMainFrame)
// ON_NOTIFY(XTP_LBN_SELCHANGE, ID_EDIT_UNDO, OnListBoxControlSelChange)
// //}}AFX_MSG_MAP
// END_MESSAGE_MAP()
//
// void CMainFrame::OnListBoxControlSelChange(NMHDR* pNMHDR, LRESULT* pResult)
// {
// CXTPControlListBox* pControlListBox = DYNAMIC_DOWNCAST(CXTPControlListBox, ((NMXTPCONTROL*)pNMHDR)->pControl);
// if (pControlListBox)
// {
// *pResult = 1;
// }
// }
//
// See Also: CXTPControlListBox, XTP_LBN_POPUP
//-----------------------------------------------------------------------
const UINT XTP_LBN_SELCHANGE = 0x1003;
//-----------------------------------------------------------------------
// Summary:
// The XTP_LBN_POPUP is sent to active view when the CXTPControlListBox is about to become visible.
// Example:
// Here is an example of how an application would process the XTP_LBN_POPUP
// message.
//
// BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
// //{{AFX_MSG_MAP(CMainFrame)
// ON_NOTIFY(XTP_LBN_POPUP, ID_EDIT_UNDO, OnListBoxControlPopup)
// //}}AFX_MSG_MAP
// END_MESSAGE_MAP()
//
// void CMainFrame::OnListBoxControlPopup(NMHDR* pNMHDR, LRESULT* pResult)
// {
// CXTPControlListBox* pControlListBox = DYNAMIC_DOWNCAST(CXTPControlListBox, ((NMXTPCONTROL*)pNMHDR)->pControl);
// if (pControlListBox)
// {
// *pResult = 1;
// }
// }
//
// See Also: CXTPControlListBox, XTP_LBN_SELCHANGE
//-----------------------------------------------------------------------
const UINT XTP_LBN_POPUP = 0x1004;
//{{AFX_CODEJOCK_PRIVATE
class CXTPControlListBoxCtrl;
//}}AFX_CODEJOCK_PRIVATE
//===========================================================================
// Summary:
// CXTPControlComboBox is a CXTPControl derived class.
// It represents a list box control.
//===========================================================================
class _XTP_EXT_CLASS CXTPControlListBox : public CXTPControl
{
public:
//-----------------------------------------------------------------------
// Summary:
// Constructs a CXTPControlListBox object
//-----------------------------------------------------------------------
CXTPControlListBox();
//-----------------------------------------------------------------------
// Summary:
// Destroys a CXTPControlListBox object, handles cleanup and deallocation
//-----------------------------------------------------------------------
virtual ~CXTPControlListBox();
public:
//-----------------------------------------------------------------------
// Summary:
// Call this member to set the width of the control
// Parameters:
// nWidth - The width of the control
//-----------------------------------------------------------------------
void SetWidth(int nWidth);
//-----------------------------------------------------------------------
// Summary:
// Call this member to set the total minimum and maximum lines.
// Parameters:
// nMin - Minimum lines to be used.
// nMax - Maximum lines to be used
//-----------------------------------------------------------------------
void SetLinesMinMax(int nMin, int nMax);
//-----------------------------------------------------------------------
// Summary:
// Call this member to retrieve a pointer to the list control.
// Returns:
// Retrieves list control.
//-----------------------------------------------------------------------
CListBox* GetListCtrl() const;
//-----------------------------------------------------------------------
// Summary:
// Call this member to set the multiple selection style of the
// control.
// Parameters:
// bMultiplSel - TRUE to set multiple selection style.
//-----------------------------------------------------------------------
void SetMultiplSel(BOOL bMultiplSel);
//-----------------------------------------------------------------------
// Summary:
// This method is called when control enable state was changed
//-----------------------------------------------------------------------
void OnEnabledChanged();
protected:
//-----------------------------------------------------------------------
// Summary:
// Call this member to set the bounding rectangle of the control.
// Parameters:
// rcControl - Bounding rectangle of the control.
//-----------------------------------------------------------------------
virtual void SetRect(CRect rcControl);
//-----------------------------------------------------------------------
// Summary:
// This method is called to determine the size of the control.
// Parameters:
// pDC - Pointer to a valid device context
// Returns:
// Size of the control.
//-----------------------------------------------------------------------
virtual CSize GetSize(CDC* pDC);
//-----------------------------------------------------------------------
// Summary:
// This method is called to assign a parent command bar object.
// Parameters:
// pParent - Points to a CXTPCommandBar object
//-----------------------------------------------------------------------
virtual void SetParent(CXTPCommandBar* pParent);
//-----------------------------------------------------------------------
// Summary:
// This method is called to draw the control.
// Parameters:
// pDC - Pointer to a valid device context.
//-----------------------------------------------------------------------
virtual void Draw(CDC* pDC);
//-----------------------------------------------------------------------
// Summary:
// Call this member to get the focused state of the control.
// Returns:
// TRUE if the control has focus; otherwise FALSE.
//-----------------------------------------------------------------------
virtual BOOL IsFocused() const;
//-----------------------------------------------------------------------
// Summary:
// The framework calls this member function when a non-system key
// is pressed.
// Parameters:
// nChar - Specifies the virtual key code of the given key.
// lParam - Specifies additional message-dependent information.
// Returns:
// TRUE if key handled, otherwise returns FALSE
//-----------------------------------------------------------------------
virtual BOOL OnHookKeyDown(UINT nChar, LPARAM lParam);
//-----------------------------------------------------------------------
// Summary:
// This method is called when the control becomes selected.
// Parameters:
// bSelected - TRUE if the control becomes selected.
// Returns:
// TRUE if successful; otherwise returns FALSE
//-----------------------------------------------------------------------
virtual BOOL OnSetSelected(int bSelected);
//-----------------------------------------------------------------------
// Summary:
// This method is called when the user clicks the control.
// Parameters:
// bKeyboard - TRUE if the control is selected using the keyboard.
// pt - Mouse cursor position.
//-----------------------------------------------------------------------
virtual void OnClick(BOOL bKeyboard = FALSE, CPoint pt = CPoint(0, 0));
//-----------------------------------------------------------------------
// Summary:
// This method is called before recalculating the parent command
// bar size to calculate the dimensions of the control.
// Parameters:
// dwMode - Flags used to determine the height and width of the
// dynamic command bar. See Remarks section for a list of
// values.
// Remarks:
// The following predefined flags are used to determine the height and
// width of the dynamic command bar. Use the bitwise-OR (|) operator to
// combine the flags.