/** * @file XTPControlExt.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(__XTPCONTROLEXT_H__) # define __XTPCONTROLEXT_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPTabClientWnd; class CXTPMarkupUIElement; /** * @brief * CXTPControlWindowList is a CXTPControlButton derived class. * It is used internally to create window list items. */ class _XTP_EXT_CLASS CXTPControlWindowList : public CXTPControlButton { protected: /** * @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, * CXTPControl, CXTPControlWorkspaceActions, CXTPControlToolbars, * CXTPControlOleItems, CXTPControlRecentFileList, CXTPControlSelector, * CXTPControlListBox */ virtual void OnCalcDynamicSize(DWORD dwMode); /** * @brief * The implementation may implement a custom drag over handling logic in this method. * @param pCommandBar Pointer to a CXTPCommandBar object. * @param point Mouse position. * @param dropEffect DROPEFFECT enumerator. * @return * TRUE if custom implementation handles drag over, otherwise FALSE. */ virtual BOOL DoCustomDragOver(CXTPCommandBar* pCommandBar, CPoint point, DROPEFFECT& dropEffect); public: /** * @brief * Adds the number and an ampersand "&" before the caption of an item that * appears in the Windows List. * @param lpszTitle Text string to display in Windows List. This text will be appended * after the number. * @param nIndex Position within the Windows list that the item should appear. * @return * Returns the text string containing the entire string that will appear in * the Windows List. */ static CString AFX_CDECL ConstructCaption(const CString& lpszTitle, int nIndex); public: static UINT m_nFistMDIChild; /**< First MDI child ID. */ static UINT m_nItemCount; /**< Maximum allowed items. */ static BOOL m_bShowRadioButtons; /**< TRUE to show Radio buttons. */ private: DECLARE_XTP_CONTROL(CXTPControlWindowList) }; /** * @brief * CXTPControlWorkspaceActions is a CXTPControlButton derived class. * It used internally to add workspace actions to a window menu. */ class _XTP_EXT_CLASS CXTPControlWorkspaceActions : public CXTPControlButton { protected: /** * @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, CXTPControl, CXTPControlToolbars, * CXTPControlOleItems, CXTPControlRecentFileList, CXTPControlSelector, * CXTPControlListBox */ virtual void OnCalcDynamicSize(DWORD dwMode); /** * @brief * Adds an action command to parent controls. * @param pClient Pointer to MDI tabbed client * @param nID Specifies the object's child-window ID. * @param nIndex Index to add. */ void AddCommand(CXTPTabClientWnd* pClient, UINT nID, int& nIndex); private: DECLARE_XTP_CONTROL(CXTPControlWorkspaceActions) }; /** * @brief * CXTPControlToolbars is a CXTPControlButton derived class. * It is used internally to create toolbars list items. */ class _XTP_EXT_CLASS CXTPControlToolbars : public CXTPControlButton { public: /** * @brief * Constructs a CXTPControlToolbars object. */ CXTPControlToolbars(); /** * @brief * Represents a single toolbar item. */ class CXTPControlToolbar : public CXTPControlButton { /** * @brief * This method is called when the control is executed. */ virtual void OnExecute(); }; /** * @brief * Creates a list of toolbars for the CommandBars Context Menu. * @param pPopupBar Pointer to a CXTPCommandBar object. * @param nInsert Position to start inserting items in the context menu. * @param nID ID to assign the menu items in the context menu. * @param bAddCustomize TRUE to add the "Customize..." option at the bottom of the * menu that allows the Toolbar Customization dialog to be opened. * @param bBeginGroup TRUE to start a new group. * @return * @details * This is the context menu that appears when a toolbar is right-clicked. * It lists all the toolbars and allows them to be hidden/displayed. */ static void AFX_CDECL CreateToolbarMenu(CXTPCommandBar* pPopupBar, int nInsert, int nID, BOOL bAddCustomize, BOOL bBeginGroup = FALSE); protected: /** * @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, CXTPControl, * CXTPControlOleItems, CXTPControlRecentFileList, CXTPControlSelector, * CXTPControlListBox */ virtual void OnCalcDynamicSize(DWORD dwMode); /** * @brief * The implementation may implement a custom drag over handling logic in this method. * @param pCommandBar Pointer to a CXTPCommandBar object. * @param point Mouse position. * @param dropEffect DROPEFFECT enumerator. * @return * TRUE if custom implementation handles drag over, otherwise FALSE. */ virtual BOOL DoCustomDragOver(CXTPCommandBar* pCommandBar, CPoint point, DROPEFFECT& dropEffect); private: DECLARE_XTP_CONTROL(CXTPControlToolbars) }; /** * @brief * CXTPControlOleItems is a CXTPControlButton derived class. * It is used internally to create ole items. */ class _XTP_EXT_CLASS CXTPControlOleItems : public CXTPControlButton { protected: /** * @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, * CXTPControl, CXTPControlRecentFileList, CXTPControlSelector, * CXTPControlListBox */ virtual void OnCalcDynamicSize(DWORD dwMode); /** * @brief * The implementation may implement a custom drag over handling logic in this method. * @param pCommandBar Pointer to a CXTPCommandBar object. * @param point Mouse position. * @param dropEffect DROPEFFECT enumerator. * @return * TRUE if custom implementation handles drag over, otherwise FALSE. */ virtual BOOL DoCustomDragOver(CXTPCommandBar* pCommandBar, CPoint point, DROPEFFECT& dropEffect); private: DECLARE_XTP_CONTROL(CXTPControlOleItems) }; /** * @brief * CXTPControlRecentFileList is a CXTPControlButton derived class. * It is used internally to create recent items list. */ class _XTP_EXT_CLASS CXTPControlRecentFileList : public CXTPControlButton { protected: /** * @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, CXTPControl, CXTPControlSelector, * CXTPControlListBox */ virtual void OnCalcDynamicSize(DWORD dwMode); /** * @brief * The implementation may implement a custom drag over handling logic in this method. * @param pCommandBar Pointer to a CXTPCommandBar object. * @param point Mouse position. * @param dropEffect DROPEFFECT enumerator. * @return * TRUE if custom implementation handles drag over, otherwise FALSE. */ virtual BOOL DoCustomDragOver(CXTPCommandBar* pCommandBar, CPoint point, DROPEFFECT& dropEffect); protected: /** * @brief * Call this member to get a pointer to the recent file list collection. * @return * Pointer to the recent file list collection. */ virtual CRecentFileList* GetRecentFileList(); /** * @brief * Call this member to get ID_FILE_MRU_FILE1. * @return * ID_FILE_MRU_FILE1. */ virtual int GetFirstMruID(); private: DECLARE_XTP_CONTROL(CXTPControlRecentFileList) }; /** * @brief * XTP_SLN_SELCHANGE is sent to the parent command bar when the * number of selected items has changed in the control selector. * @details * The number of selected items changes as the mouse is moved * over the controls in the control selector. * * XTP_SLN_SELCHANGE is sent in CXTPControlSelector::SetItemsActive. * * Example: * Here is an example of how an application would process the XTP_LBN_SELCHANGE * message. *
* BEGIN_MESSAGE_MAP(CExtendedControlsView, CEditView)
* //{{AFX_MSG_MAP(CExtendedControlsView)
* ON_NOTIFY(XTP_SLN_SELCHANGE, ID_INSERT_COLUMNS, OnColumnsSelChange)
* //}}AFX_MSG_MAP
* END_MESSAGE_MAP()
*
* void CExtendedControlsView::OnColumnsSelChange(NMHDR* pNMHDR, LRESULT* pRes)
* {
* _ASSERTE(pNMHDR != NULL);
* _ASSERTE(pRes != NULL);
*
* CControlColumns* pControlColumns = DYNAMIC_DOWNCAST(CControlColumns,
* ((NMXTPCONTROL*)pNMHDR)->pControl);
* if (pControlColumns)
* {
*
* CXTPControlStatic* pInfo = FindInfoControl(pControlColumns);
* if (pInfo)
* {
* int nCount = pControlColumns->m_szItemsActive.cx;
*
* CString str = _T("Cancel");
* if (nCount != 0)
* {
* str.Format(_T("%i Columns"), nCount);
* }
*
* pInfo->SetWidth(pControlColumns->m_szItem.cx *
* pControlColumns->m_szItemsVisible.cx);
*
*
* pInfo->SetCaption(str);
* pInfo->DelayRedrawParent();
* }
*
* *pRes = 1;
* }
* }
*
* @see
* CXTPControlSelector::SetItemsActive
*/
const UINT XTP_SLN_SELCHANGE = 0x1006;
/**
* @brief
* CXTPControlSelector is a CXTPControl derived class that represents
* a control selector.
* @details
* A control selector is an x by y grid of controls of which can be
* selected by the user. This control is like the "Insert Table" and
* "Insert Column" controls seen in Microsoft Word.
*
* When the control selector is created, m_szItemsCount holds the number
* items that will initially be shown. By clicking and dragging inside
* the control selector, up to m_szItemsMax items can be shown. For example,
* if m_szItemsCount = CSize(5, 4) and m_szItemsMax = CSize(12, 12), then
* the control selector will always display a 5x4 grid of items unless the
* mouse is clicked and dragged to expand the grid up to 12x12.
*
* The size of the items is set by m_szItem, all items in the grid will
* be sized according to m_szItem.
*
* The current number of active items (highlighted items) is stored in
* m_szItemsActive. OnLButtonUp will store the number of selected items
* in m_szResult.
*
* When the number of selected (active/highlighted) items changes,
* XTP_SLN_SELCHANGE is sent in a message to the parent command bar. The
* message is sent while in the SetItemsActive function.
*
* The Office 2003 GUI sample illustrates how to use this class.
*/
class _XTP_EXT_CLASS CXTPControlSelector : public CXTPControl
{
/** @cond */
DECLARE_XTP_CONTROL(CXTPControlSelector)
/** @endcond */
public:
/**
* @brief
* Constructs a CXTPControlSelector object.
*/
CXTPControlSelector();
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.
*/
CSize GetSize(CDC* pDC);
/**
* @brief
* This method is called to draw the control.
* @param pDC Pointer to a valid device context.
*/
void Draw(CDC* pDC);
/**
* @brief
* This member is called when the mouse cursor moves.
* @param point Specifies the x- and y- coordinates of the cursor.
*/
void OnMouseMove(CPoint point);
/**
* @brief
* This method is called when the control becomes selected.
* @param bSelected TRUE if the control becomes selected.
* @return
* TRUE if successful, otherwise FALSE.
*/
BOOL OnSetSelected(int bSelected);
/**
* @brief
* This member is called when the user releases the left mouse button.
* @param point Specifies the x- and y- coordinates of the cursor.
*/
void OnLButtonUp(CPoint point);
/**
* @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, CXTPControl,
* CXTPControlListBox
*/
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.
*/
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.
*/
void DoPropExchange(CXTPPropExchange* pPX);
protected:
/**
* @brief
* This member is called to set the number of active items.
* @param szActive Number of active items (on screen). If m_szItemsActive
* is not equal to szActive, then SetItemsActive will
* set m_szItemsActive = szActive.
* @param bNotify TRUE to send XTP_SLN_SELCHANGE message to parent
* commandbar even if m_szItemsActive = szActive. This
* is necessary when the number of items has changed and
* m_szItemsActive = szActive, which occurs when the mouse
* is clicked and dragged to select items more items than
* are currently visible.
* @details
* Active items are the items that are currently highlighted in the
* control selector.
* @see
* XTP_SLN_SELCHANGE
*/
void SetItemsActive(CSize szActive, BOOL bNotify = FALSE);
/**
* @brief
* This member is called when a control item in the control
* selector is drawn.
* @param pDC Pointer to a valid device context.
* @param rcItem Bounding rectangle of item being drawn.
* @param clrText Color to use when drawing.
* @details
* Override this member to draw your own custom control. In
* the Office 2003 GUI sample, this is used to draw the column
* lines in the column selector control.
*/
virtual void OnDrawItem(CDC* pDC, CRect rcItem, COLORREF clrText);
public:
CSize m_szItemsCount; /**< Number of items to draw in the control selector's view. By clicking
and dragging the mouse, the number of items drawn can be up to
m_szItemsMax.*/
CSize m_szItemsMax; /**< Maximum number of items to draw in the control selector. */
CSize m_szItemsActive; /**< Number of items currently "active". This is current number of items
that are highlighted as the mouse moves across the control
selector.*/
CSize m_szItem; /**< Size of the items. */
CSize m_szResult; /**< Number of items that were selected from the control selector. */
CSize m_szItemsVisible; /**< Number of items currently visible. Item range is from
m_szItemsCount to m_szItemsMax. */
private:
BOOL m_bLockUpdate;
};
/**
* @brief
* CXTPControlLabel is a CXTPControl derived class.
* It represents a label control.
*/
class _XTP_EXT_CLASS CXTPControlLabel : public CXTPControl
{
DECLARE_XTP_CONTROL(CXTPControlLabel)
public:
/**
* @brief
* Constructs a CXTPControlLabel object.
*/
CXTPControlLabel()
{
m_dwFlags = xtpFlagSkipFocus | xtpFlagNoMovable | xtpFlagManualUpdate;
m_controlType = xtpControlLabel;
}
/**
* @brief
* Call this member to get the state of the control.
* @return
* TRUE if the control is selected, otherwise FALSE. Controls of
* type CXTPControlLabel can not receive focus so this will always
* return FALSE.
*/
int GetSelected() const
{
return FALSE;
}
/**
* @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
* CXTPControlCheckBox is a CXTPControlButton derived class.
* It represents a checkbox control.
*/
class _XTP_EXT_CLASS CXTPControlCheckBox : public CXTPControlButton
{
/** @cond */
DECLARE_XTP_CONTROL(CXTPControlCheckBox)
/** @endcond */
public:
/**
* @brief
* Constructs a CXTPControlCheckBox object.
*/
CXTPControlCheckBox();
protected:
/**
* @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.
*/
BOOL OnHookKeyDown(UINT nChar, LPARAM lParam);
/**
* @brief
* Call this member to get the focused state of the control.
* @return
* TRUE if the control has focus, otherwise FALSE.
*/
BOOL IsFocused() const;
# ifdef _XTP_COMMANDBARS_ACTIVEX
/** @cond */
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
DECLARE_OLETYPELIB_EX(CXTPControlCheckBox);
afx_msg long OleGetChecked();
afx_msg void OleSetChecked(long);
/** @endcond */
# endif
};
/**
* @brief
* CXTPControlRadioButton is a CXTPControlButton derived class.
* It represents a radio button control.
*/
class _XTP_EXT_CLASS CXTPControlRadioButton : public CXTPControlButton
{
/** @cond */
DECLARE_XTP_CONTROL(CXTPControlRadioButton)
/** @endcond */
public:
/**
* @brief
* Constructs a CXTPControlRadioButton object.
*/
CXTPControlRadioButton();
protected:
/**
* @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.
*/
BOOL OnHookKeyDown(UINT nChar, LPARAM lParam);
/**
* @brief
* Call this member to get the focused state of the control.
* @return
* TRUE if the control has focus, otherwise FALSE.
*/
BOOL IsFocused() const;
};
/**
* @brief
* CXTPControlMarkupLabel is a CXTPControlLabel derived class.
* It can be used to draw markup text
*/
class _XTP_EXT_CLASS CXTPControlMarkupLabel : public CXTPControlLabel
{
DECLARE_XTP_CONTROL(CXTPControlMarkupLabel);
public:
/**
* @brief
* Constructs a CXTPControlMarkupLabel object.
*/
CXTPControlMarkupLabel();
/**
* @brief
* Destroys a CXTPControlMarkupLabel object, handles cleanup and deallocation.
*/
~CXTPControlMarkupLabel();
protected:
/**
* @brief
* This method is called when the control's caption is changed.
*/
void OnCaptionChanged();
virtual void OnThemeChanged();
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);
protected:
CXTPMarkupUIElement* m_pMarkupUIElement; /**< Markup element */
private:
void RebuildMarkup();
};
/**
* @brief
* CXTPControlHyperlink is a CXTPControl derived class.
* It can be used to add hyperlink text.
*/
class _XTP_EXT_CLASS CXTPControlHyperlink : public CXTPControl
{
DECLARE_XTP_CONTROL(CXTPControlHyperlink);
public:
/**
* @brief
* Constructs a CXTPControlHyperlink object.
*/
CXTPControlHyperlink();
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 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 when the control is executed.
*/
void OnExecute();
/**
* @brief
* This member is called when the mouse cursor moves.
* @param point Specifies the x- and y- coordinates of the cursor.
*/
void OnMouseMove(CPoint point);
protected:
HCURSOR m_hCursor; /**< Cursor display when item is hovered. */
};
/**
* @brief
* CXTPControlBitmap is a CXTPControlLabel derived class.
* It can be used to add a bitmap to a toolbar.
*/
class _XTP_EXT_CLASS CXTPControlBitmap : public CXTPControlLabel
{
DECLARE_XTP_CONTROL(CXTPControlBitmap);
public:
/**
* @brief
* Constructs a CXTPControlBitmap object.
*/
CXTPControlBitmap();
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);
};
/** @cond */
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
#endif // #if !defined(__XTPCONTROLEXT_H__)
/** @endcond */