Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cWndToolTip.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cWndToolTip_H
7 #define _INC_cWndToolTip_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #if ! defined(_MFC_VER) && defined(_WIN32) && ! defined(UNDER_CE)
13 
14 // lib comctl32.lib
15 #include "cWindow.h"
16 #include "../WinAPI/cWinResource.h"
17 #include "../Image/cSurfaceInfo.h"
18 
19 #include <commctrl.h>
20 
21 namespace GrayLib
22 {
23  class GRAYLIB_LINK cWndToolTip : public cWndHandle
24  {
28 
29  private:
30  void FillInToolInfo(_GTN(TTTOOLINFO)& ti, HWND hWndCtrl, RESOURCEID_t nIDTool = 0) const;
31 
32  public:
33  bool CreateTooltips(HWND hWndParent, DWORD dwStyle = WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP);
34  void SetupTooltips();
35 
36  void SetMaxWidth(PIXELS_t iPixels)
37  {
39  ASSERT(IsWindow());
40  SendMessageX(TTM_SETMAXTIPWIDTH, 0, iPixels);
41  }
42 
43  void ActivateTooltips(bool bActivate = true)
44  {
45  ASSERT(IsWindow());
46  SendMessageX(TTM_ACTIVATE, bActivate, 0L);
47  }
48  int GetToolCount() const
49  {
51  return (int)SendMessageX(TTM_GETTOOLCOUNT, 0, 0L);
52  }
53 
54  int GetDelayTime(WPARAM eParam = TTDT_INITIAL) const
55  {
57  return (int)SendMessageX(TTM_GETDELAYTIME, eParam, 0L);
58  }
59  void SetDelayTime(TIMESYS_t iTime = -1, WPARAM eParam = TTDT_INITIAL)
60  {
63  SendMessageX(TTM_SETDELAYTIME, eParam, MAKELPARAM(iTime, 0));
64  }
65 
66  bool AddTool(HWND hWnd, const GChar_t* lpszText, const RECT* lpRectTool = nullptr, RESOURCEID_t nIDTool = 0);
67  void DelTool(HWND hWnd, RESOURCEID_t nIDTool = 0);
68  bool AddToolForControl(HWND hWnd, RESOURCEID_t nIDTool = 0);
69  };
70 };
71 #endif
72 #endif
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define _GTN(c)
_WIN32 name has a A or W for UTF8 or UNICODE (like _FNF)
Definition: StrConst.h:28
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: cMesh.h:22
int PIXELS_t
Count of pixels in a dimension of some image/surface.
Definition: cSurfaceInfo.h:20
WORD RESOURCEID_t
A resource in .RC attached to a file/module. like MAKEINTRESOURCE(). https://docs....
Definition: cResourceBase.h:19
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
UINT32 TIMESYS_t
TIMESYS_t = The normal system tick timer. milli-seconds since start of system/app ?
Definition: cTimeSys.h:27