/** * @file XTPMiniToolBar.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(__XTPMINITOOLBAR_H__) # define __XTPMINITOOLBAR_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" ///////////////////////////////////////////////////////////////////////////// // CXTPMiniToolBar window /** * @brief * Represents a MiniToolbar object. * @details * MiniToolBar is an Office 2007 style context toolbar which has many * uses. For example, you might want to display a MiniToolbar presenting some * of the more commonly used commands that a user would probably want to use * in a given situation like selecting text. For example, this can save the * user a lot of time by making font related tasks available without fumbling * through tabs or menus. So, to effectively use a MiniToolbar, you would * place all commands that the user would most probably want to use when * performing a given action. */ class _XTP_EXT_CLASS CXTPMiniToolBar : public CXTPPopupToolBar { DECLARE_XTP_COMMANDBAR(CXTPMiniToolBar); public: /** * @brief * Call this method to create a CXTPMiniToolBar class. * @param pCommandBars Pointer to owner CXTPCommandBars. * @return * Pointer to the newly created CXTPMiniToolBar object. */ static CXTPMiniToolBar* AFX_CDECL CreateMiniToolBar(CXTPCommandBars* pCommandBars); protected: /** * @brief * Constructs a CXTPMiniToolBar object. */ CXTPMiniToolBar(); /** * @brief * Destroys a CXTPMiniToolBar object, handles cleanup and * deallocation. */ virtual ~CXTPMiniToolBar(); public: /** * @brief * Call this method to show the minibar in a specific position. * @param nFlags Reserved, currently not used. * @param xPos Specifies the horizontal position (in screen coordinates) * of the minibar. * @param yPos Specifies the vertical position (in screen coordinates) * of the top of the minibar. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL TrackMiniBar(UINT nFlags, int xPos, int yPos); /** * @brief * Call this member to display a floating pop-up menu at the specified location. * @param pPopupMenu Pointer to a CXTPPopupBar object. * @param nFlags Reserved, currently not used. * @param xPos Specifies the horizontal position (in screen coordinates) * of the pop-up menu. * @param yPos Specifies the vertical position (in screen coordinates) * of the top of the menu on the screen. * @return * TRUE if successful, otherwise FALSE. */ virtual BOOL TrackPopupMenu(CXTPPopupBar* pPopupMenu, UINT nFlags, int xPos, int yPos); /** * @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 * Call this method to enable/disable keyboard interaction with custom controls. * @param bInteract TRUE to enable keyboard interaction with custom controls. * @details * xtpControlCustom is disabled by default. * The MiniToolbar closes when keyboard events occur within a custom control. */ void SetCustomControlKeyboardInteraction(BOOL bInteract = TRUE); BOOL IsCustomControlKeyboardInteraction() const; protected: /** * @brief * Translates all messages in the message queue. */ virtual void PumpMessage(); /** * @brief * Updates the opacity of the mini toolbar and pop-up menu. */ virtual void UpdateOpacity(); /** * @brief * Specifies whether the mouse cursor is hovered over the mini toolbar. * @return * TRUE if the mouse cursor is hovered over the mini toolbar, otherwise FALSE. */ BOOL CursorInWindow() const; /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPMiniToolBar) virtual void Animate(); virtual BOOL SetTrackingMode(int bMode, BOOL bSelectFirst = TRUE, BOOL bKeyboard = FALSE); virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const; virtual int OnHookMessage(HWND hWnd, UINT nMessage, WPARAM& wParam, LPARAM& lParam, LRESULT& lResult); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPMiniToolBar) //}}AFX_MSG /** @endcond */ # ifdef _XTP_COMMANDBARS_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_OLETYPELIB_EX(CXTPMiniToolBar); DECLARE_INTERFACE_MAP() long OlePopupMiniToolBar(const VARIANT& varFlags, const VARIANT& x, const VARIANT& y); long OlePopupContextMenu(LPDISPATCH lpDispatch, const VARIANT& varFlags, const VARIANT& x, const VARIANT& y); /** @endcond */ # endif protected: /** * @brief * UpdateLayeredWindow declaration. * @param LPFNUPDATELAYEREDWINDOW Struct that contains the position, size, shape, * content, and translucency of a layered window. * @details * Required for transparent Windows, but they are not present in the VC6 headers. * They are only present on Win2k or later. * @return * TRUE if successful, otherwise FALSE. */ typedef BOOL(WINAPI* LPFNUPDATELAYEREDWINDOW)(HWND hwnd, HDC hdcDst, POINT* pptDst, SIZE* psize, HDC hdcSrc, POINT* pptSrc, COLORREF crKey, BLENDFUNCTION* pblend, DWORD dwFlags); /** * @brief * SetLayeredWindowAttributes declaration. * @param PFNSETLAYEREDWINDOWATTRIBUTES Struct that contains the opacity and * transparency color key of a layered window. * @details * Required for transparent Windows, but they are not present in the VC6 headers. * They are only present on Win2k or later. * @return * TRUE if successful, otherwise FALSE. */ typedef BOOL(WINAPI* PFNSETLAYEREDWINDOWATTRIBUTES)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); PFNSETLAYEREDWINDOWATTRIBUTES m_pfnSetLayeredWindowAttributes; /**< Point to Transparency proc in USER32.dll module. */ LPFNUPDATELAYEREDWINDOW m_pfnUpdateLayeredWindow; /**< Point to UpdateLayeredWindow proc in USER32.dll module. */ BOOL m_bActivated; /**< TRUE if the mini toolbar is activated. */ int m_nOpacity; /**< Opacity level. */ BOOL m_bTracking; /**< TRUE if the command bar is in tracking mode. */ CXTPPopupBar* m_pContextMenu; /**< Context menu that is displayed in customization mode when a user right-clicks on a control. */ BOOL m_bCustomControlKeyboardInteraction; }; /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPMINITOOLBAR_H__) /** @endcond */