/** * @file XTPControlListBox.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPCONTROLLISTBOX_H__) # define __XTPCONTROLLISTBOX_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * 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 * CXTPControlListBox, XTP_LBN_POPUP */ const UINT XTP_LBN_SELCHANGE = 0x1003; /** * @brief * 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 * CXTPControlListBox, XTP_LBN_SELCHANGE */ const UINT XTP_LBN_POPUP = 0x1004; /** @cond */ class CXTPControlListBoxCtrl; /** @endcond */ /** * @brief * CXTPControlComboBox is a CXTPControl derived class. * It represents a list box control. */ class _XTP_EXT_CLASS CXTPControlListBox : public CXTPControl { public: /** * @brief * Constructs a CXTPControlListBox object. */ CXTPControlListBox(); /** * @brief * Destroys a CXTPControlListBox object, handles cleanup and deallocation. */ virtual ~CXTPControlListBox(); public: /** * @brief * Call this member to set the width of the control. * @param nWidth The width of the control. */ void SetWidth(int nWidth); /** * @brief * Call this member to set the total minimum and maximum lines. * @param nMin Minimum lines to be used. * @param nMax Maximum lines to be used. */ void SetLinesMinMax(int nMin, int nMax); /** * @brief * Call this member to retrieve a pointer to the list control. * @return * Retrieves list control. */ CListBox* GetListCtrl() const; /** * @brief * Call this member to set the multiple selection style of the control. * @param bMultiplSel TRUE to set the multiple selection style. */ void SetMultiplSel(BOOL bMultiplSel); /** * @brief * This method is called when the control's enabled state is changed. */ void OnEnabledChanged(); protected: /** * @brief * Call this member to set the bounding rectangle of the control. * @param rcControl Bounding rectangle of the control. */ virtual void SetRect(CRect rcControl); /** * @brief * This method is called to determine the size of the control. * @param pDC Pointer to a valid device context. * @return * A CSize object containing the size of the control. */ virtual CSize GetSize(CDC* pDC); /** * @brief * This method is called to assign a parent command bar object. * @param pParent Pointer to a CXTPCommandBar object. */ virtual void SetParent(CXTPCommandBar* pParent); /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); /** * @brief * Call this member to get the focused state of the control. * @return * TRUE if the control has focus; otherwise FALSE. */ virtual BOOL IsFocused() const; /** * @brief * The framework calls this member function when a non-system key * is pressed. * @param nChar Specifies the virtual key code of the given key. * @param lParam Specifies additional message-dependent information. * @return * TRUE if the key was handled, otherwise FALSE. */ virtual BOOL OnHookKeyDown(UINT nChar, LPARAM lParam); /** * @brief * This method is called when the control becomes selected. * @param bSelected TRUE if the control becomes selected. * @return * TRUE if successful; otherwise FALSE. */ virtual BOOL OnSetSelected(int bSelected); /** * @brief * This method is called when the user clicks the control. * @param bKeyboard TRUE if the control is selected using the keyboard. * @param pt Mouse cursor position. */ virtual void OnClick(BOOL bKeyboard = FALSE, CPoint pt = CPoint(0, 0)); /** * @brief * This method is called before recalculating the parent command * bar size to calculate the dimensions of the control. * @param dwMode Flags used to determine the height and width of the * dynamic command bar. See Remarks section for a list of * values. * @details * 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.

* * LM_STRETCH: Indicates whether the command bar should be * stretched to the size of the frame. Set if the bar is * not a docking bar (not available for docking). Not set * when the bar is docked or floating (available for * docking). If set, LM_STRETCH returns dimensions based * on the LM_HORZ state. LM_STRETCH works similarly to * the the bStretch parameter used in CalcFixedLayout; * see that member function for more information about * the relationship between stretching and orientation. * LM_HORZ: Indicates that the bar is horizontally or * vertically oriented. Set if the bar is horizontally * oriented, and if it is vertically oriented, it is not * set. LM_HORZ works similarly to the the bHorz * parameter used in CalcFixedLayout; see that member * function for more information about the relationship * between stretching and orientation. * LM_MRUWIDTH: Most Recently Used Dynamic Width. Uses the * remembered most recently used width. * LM_HORZDOCK: Horizontal Docked Dimensions. Returns the * dynamic size with the largest width. * LM_VERTDOCK: Vertical Docked Dimensions. Returns the dynamic * size with the largest height. * LM_COMMIT: Resets LM_MRUWIDTH to the current width of the * floating command bar. * * The framework calls this member function to calculate the dimensions * of a dynamic command bar.

* * Override this member function to provide your own layout in classes * you derive from CXTPControl. XTP classes derived from CXTPControl, * such as CXTPControlComboBox, override this member function to provide * their own implementation. * @see * CXTPControlComboBox, CXTPControlCustom, CXTPControlEdit, * CXTPControlWindowList, CXTPControlWorkspaceActions, CXTPControlToolbars, * CXTPControlOleItems, CXTPControlRecentFileList, CXTPControlSelector, * CXTPControl */ virtual void OnCalcDynamicSize(DWORD dwMode); /** * @brief * This method is called to copy the control. * @param pControl Pointer to a source CXTPControl object. * @param bRecursive TRUE to copy recursively. */ virtual void Copy(CXTPControl* pControl, BOOL bRecursive = FALSE); /** * @brief * Either reads ths object from or writes this object to an archive. * @param pPX A CXTPPropExchange object to serialize to or from. */ virtual void DoPropExchange(CXTPPropExchange* pPX); protected: CXTPControlListBoxCtrl* m_pListBox; /**< List box control. */ int m_nListBoxLinesMin; /**< Minimum lines. */ int m_nListBoxLinesMax; /**< Maximum lines. */ BOOL m_bMultiplSel; /**< Multiple selection style. */ BOOL m_bMouseLocked; /**< TRUE to lock mouse events. */ /** @cond */ DECLARE_XTP_CONTROL(CXTPControlListBox) /** @endcond */ friend class CXTPControlListBoxCtrl; }; /** * @brief * CXTPControlStatic is a CXTPControl derived class. * It represents a static text control. */ class _XTP_EXT_CLASS CXTPControlStatic : public CXTPControl { public: /** * @brief * Constructs a CXTPControlStatic object. */ CXTPControlStatic(); public: /** * @brief * Call this member to set the width of the control. * @param nWidth The width of the control. */ void SetWidth(int nWidth); protected: /** * @brief * This method is called to determine the size of the control. * @param pDC Pointer to a valid device context. * @return * A CSize object containing the size of the control. */ virtual CSize GetSize(CDC* pDC); /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. */ virtual void Draw(CDC* pDC); /** * @brief * This method is called to copy the control. * @param pControl Pointer to a source CXTPControl object. * @param bRecursive TRUE to copy recursively. */ virtual void Copy(CXTPControl* pControl, BOOL bRecursive = FALSE); /** * @brief * Either reads this object from or writes this object to an archive. * @param pPX A CXTPPropExchange object to serialize to or from. */ virtual void DoPropExchange(CXTPPropExchange* pPX); private: DECLARE_XTP_CONTROL(CXTPControlStatic) }; /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPCONTROLLISTBOX_H__) /** @endcond */