soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
stooltip-i.h
Go to the documentation of this file.
1/**
2 * @file stooltip-i.h
3 * @brief Interface for Tooltip Objects
4 * @version v1.0
5 * @author SOUI group
6 * @date 2014/08/01
7 *
8 * @details This file defines the interfaces for tooltip objects and their factory.
9 */
10
11#ifndef __STOOLTIP_I__H__
12#define __STOOLTIP_I__H__
13
14#include <interface/obj-ref-i.h>
15#include <interface/SMsgLoop-i.h>
16
17SNSBEGIN
18
19/**
20 * @struct TIPID
21 * @brief Identifier for a tooltip
22 *
23 * @details This structure uniquely identifies a tooltip using two DWORD values and a boolean flag
24 * indicating whether it is a non-client area tooltip.
25 */
26typedef struct TIPID
27{
28 DWORD dwHi; //!< ID1, used to save a SWND.
29 DWORD dwLow; //!< ID2, used to save additional data.
30 BOOL bNcTip; //!< Flag indicating if the tooltip is for the non-client area.
31} TIPID;
32
33/**
34 * @enum TipAlign
35 * @brief Alignment options for tooltips
36 *
37 * @details These constants define the possible alignment options for tooltips, including horizontal and vertical alignments.
38 */
39typedef enum TipAlign
40{
41 TA_AUTO = 0, //!< Automatic alignment.
42 TA_X_LEFT = 1, //!< Align left horizontally.
43 TA_X_CENTER = 2, //!< Align center horizontally.
44 TA_X_RIGHT = 3, //!< Align right horizontally.
45 TA_X_MASK = 0x0f, //!< Mask for horizontal alignment.
46 TA_Y_TOP = 0x10, //!< Align top vertically.
47 TA_Y_CENTER = 0x20, //!< Align center vertically.
48 TA_Y_BOTTOM = 0x30, //!< Align bottom vertically.
49 TA_Y_MASK = 0xF0, //!< Mask for vertical alignment.
50} TipAlign;
51
52/**
53 * @struct IToolTip
54 * @brief Interface for Tooltip Objects
55 *
56 * @details This interface defines the methods for tooltip objects, which handle the display and management of tooltips.
57 */
58#undef INTERFACE
59#define INTERFACE IToolTip
60DECLARE_INTERFACE_(IToolTip, IMsgFilter)
61{
62 /**
63 * @brief Pre-translates messages for the tooltip.
64 *
65 * @param pMsg Pointer to the message to be translated.
66 * @return BOOL TRUE if the message is handled, FALSE otherwise.
67 */
68 STDMETHOD_(BOOL, PreTranslateMessage)(THIS_ MSG * pMsg) PURE;
69
70 /**
71 * @brief Updates the current tooltip.
72 *
73 * @param id Pointer to the tooltip ID.
74 * @param rc Rectangle defining the tooltip's感应 area.
75 * @param pszTip Tooltip string.
76 * @param nScale Current scaling factor.
77 */
78 STDMETHOD_(void, UpdateTip)(THIS_ const TIPID *id, RECT rc, LPCTSTR pszTip, int nScale) PURE;
79
80 /**
81 * @brief Displays the tooltip at a specified position.
82 *
83 * @param rc Rectangle defining the tooltip's display position relative to the container.
84 * @param tipAlign Tooltip alignment options.
85 * @param pszTip Tooltip content. If NULL, the fixed tooltip is exited.
86 * @param nScale Current scaling factor.
87 */
88 STDMETHOD_(void, SetToolTip)(THIS_ LPCRECT rc, UINT tipAlign, LPCTSTR pszTip, int nScale) PURE;
89
90 /**
91 * @brief Clears the current tooltip.
92 */
93 STDMETHOD_(void, ClearTip)(THIS) PURE;
94
95 /**
96 * @brief Relays mouse messages to the tooltip.
97 *
98 * @param pMsg Pointer to the mouse message.
99 */
100 STDMETHOD_(void, RelayEvent)(THIS_ const MSG *pMsg) PURE;
101};
102
103/**
104 * @struct IToolTipFactory
105 * @brief Interface for Tooltip Factory
106 *
107 * @details This interface defines the methods for creating and destroying tooltip objects.
108 */
109#undef INTERFACE
110#define INTERFACE IToolTipFactory
111DECLARE_INTERFACE_(IToolTipFactory, IObjRef)
112{
113 /**
114 * @brief Increments the reference count of the object.
115 *
116 * @return long The new reference count.
117 */
118 STDMETHOD_(long, AddRef)(THIS) PURE;
119
120 /**
121 * @brief Decrements the reference count of the object.
122 *
123 * @return long The new reference count.
124 */
125 STDMETHOD_(long, Release)(THIS) PURE;
126
127 /**
128 * @brief Final release of the object, performing cleanup if necessary.
129 */
130 STDMETHOD_(void, OnFinalRelease)(THIS) PURE;
131
132 /**
133 * @brief Creates a tooltip object.
134 *
135 * @param hHost Handle to the SOUI host window.
136 * @return IToolTip* Pointer to the created tooltip object.
137 *
138 * @details Do not use hHost as the owner of the tooltip to avoid potential runtime issues.
139 */
140 STDMETHOD_(IToolTip *, CreateToolTip)(THIS_ HWND hHost) PURE;
141
142 /**
143 * @brief Destroys a tooltip object.
144 *
145 * @param pToolTip Pointer to the tooltip object to be destroyed.
146 */
147 STDMETHOD_(void, DestroyToolTip)(THIS_ IToolTip * pToolTip) PURE;
148};
149
150SNSEND
151#endif // __STOOLTIP_I__H__
TipAlign
Alignment options for tooltips.
Definition stooltip-i.h:40
@ TA_Y_CENTER
Align center vertically.
Definition stooltip-i.h:47
@ TA_X_MASK
Mask for horizontal alignment.
Definition stooltip-i.h:45
@ TA_AUTO
Automatic alignment.
Definition stooltip-i.h:41
@ TA_Y_MASK
Mask for vertical alignment.
Definition stooltip-i.h:49
@ TA_X_RIGHT
Align right horizontally.
Definition stooltip-i.h:44
@ TA_X_LEFT
Align left horizontally.
Definition stooltip-i.h:42
@ TA_Y_BOTTOM
Align bottom vertically.
Definition stooltip-i.h:48
@ TA_Y_TOP
Align top vertically.
Definition stooltip-i.h:46
@ TA_X_CENTER
Align center horizontally.
Definition stooltip-i.h:43
Interface for message filtering.
Definition SMsgLoop-i.h:15
Interface for reference counting.
Definition obj-ref-i.h:19
Interface for Tooltip Factory.
Definition stooltip-i.h:112
IToolTip * CreateToolTip(HWND hHost) PURE
Creates a tooltip object.
long AddRef() PURE
Increments the reference count of the object.
void DestroyToolTip(IToolTip *pToolTip) PURE
Destroys a tooltip object.
void OnFinalRelease() PURE
Final release of the object, performing cleanup if necessary.
long Release() PURE
Decrements the reference count of the object.
Interface for Tooltip Objects.
Definition stooltip-i.h:61
void UpdateTip(const TIPID *id, RECT rc, LPCTSTR pszTip, int nScale) PURE
Updates the current tooltip.
void SetToolTip(LPCRECT rc, UINT tipAlign, LPCTSTR pszTip, int nScale) PURE
Displays the tooltip at a specified position.
void RelayEvent(const MSG *pMsg) PURE
Relays mouse messages to the tooltip.
void ClearTip() PURE
Clears the current tooltip.
BOOL PreTranslateMessage(MSG *pMsg) PURE
Pre-translates messages for the tooltip.
Identifier for a tooltip.
Definition stooltip-i.h:27
BOOL bNcTip
Flag indicating if the tooltip is for the non-client area.
Definition stooltip-i.h:30
DWORD dwLow
ID2, used to save additional data.
Definition stooltip-i.h:29
DWORD dwHi
ID1, used to save a SWND.
Definition stooltip-i.h:28