1
0

commandLink.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef NULLOSFT_DROPBOX_PLUGIN_COMMANDLINK_HEADER
  2. #define NULLOSFT_DROPBOX_PLUGIN_COMMANDLINK_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #define NWC_COMMANDLINKA "NullsoftCommandLink"
  8. #define NWC_COMMANDLINKW L"NullsoftCommandLink"
  9. #ifdef UNICODE
  10. #define NWC_COMMANDLINK NWC_COMMANDLINKW
  11. #else
  12. #define NWC_COMMANDLINK NWC_COMMANDLINKA
  13. #endif // !UNICODE
  14. // styles
  15. #define CLS_HOTTRACK 0x0001
  16. #define CLS_TRACKVISITED 0x0002
  17. #define CLS_DEFAULTCOLORS 0x0008
  18. #define CLS_ALWAYSUNDERLINE 0x0010
  19. #define CLS_HIGHLIGHTCOLOR 0x0020 // enables CLM_SETHIGHLIGHTCOLOR/CLM_GETHIGHLIGHTCOLOR
  20. // states
  21. #define CLIS_VISITED 0x0001
  22. #define CLIS_HOT 0x0002
  23. #define CLIS_PRESSED 0x0004
  24. #define CLIS_FOCUSED 0x0008
  25. #define CLIS_HIDEFOCUS 0x0010
  26. #define CommandLink_CreateWindow(__windowStyleEx, __linkText, __windowStyle, __x, __y, __cx, __cy, __parentWindow, __controlId)\
  27. CreateWindowEx((__windowStyleEx), NWC_COMMANDLINK, (__linkText), (__windowStyle),\
  28. (__x), (__y), (__cx), (__cy), (__parentWindow), (HMENU)(INT_PTR)(__controlId), NULL, 0)
  29. #define CLM_FIRST (WM_USER + 1)
  30. #define CLM_GETIDEALHEIGHT (CLM_FIRST + 0)
  31. #define CommandLink_GetIdealHeight(/*HNWD*/__hwnd)\
  32. ((INT)SendMessageW((__hwnd), CLM_GETIDEALHEIGHT, 0, 0L))
  33. #define CLM_GETIDEALSIZE (CLM_FIRST + 1)
  34. #define CommandLink_GetIdealSize(/*HNWD*/ __hwnd, /*LPSIZE*/ __sizeOut)\
  35. ((BOOL)SendMessageW((__hwnd), CLM_GETIDEALSIZE, 0, (LPARAM)(__sizeOut)))
  36. #define CLM_RESETVISITED (CLM_FIRST + 2)
  37. #define CommandLink_ResetVisited(/*HNWD*/__hwnd)\
  38. (SendMessageW((__hwnd), CLM_RESETVISITED, 0, 0L))
  39. #define CLM_GETMARGINS (CLM_FIRST + 3) //lParam = (RECT*)*margins; Return TRUE on success
  40. #define CommandLink_GetMargins(/*HNWD*/ __hwnd, /*LPRECT*/ __rectOut)\
  41. ((BOOL)SendMessageW((__hwnd), CLM_GETMARGINS, 0, (LPARAM)(__rectOut)))
  42. #define CLM_SETMARGINS (CLM_FIRST + 4) //lParam = (RECT*)*margins; Return TRUE on success
  43. #define CommandLink_SetMargins(/*HNWD*/ __hwnd, /*LPCRECT*/ __rectIn)\
  44. ((BOOL)SendMessageW((__hwnd), CLM_SETMARGINS, 0, (LPARAM)(__rectIn)))
  45. #define CLM_SETBACKCOLOR (CLM_FIRST + 5) //lParam = (LPARAM)rgb; Return TRUE on success
  46. #define CommandLink_SetBackColor(/*HNWD*/ __hwnd, /*COLORREF*/ __rgb)\
  47. ((BOOL)SendMessageW((__hwnd), CLM_SETBACKCOLOR, 0, (LPARAM)(__rgb)))
  48. #define CLM_GETBACKCOLOR (CLM_FIRST + 6) //Return COLORREF
  49. #define CommandLink_GetBackColor(/*HNWD*/ __hwnd)\
  50. ((COLORREF)SendMessageW((__hwnd), CLM_GETBACKCOLOR, 0, 0L))
  51. #define CLM_SETTEXTCOLOR (CLM_FIRST + 7) //lParam = (LPARAM)rgb; Return TRUE on success
  52. #define CommandLink_SetTextColor(/*HNWD*/ __hwnd, /*COLORREF*/ __rgb)\
  53. ((BOOL)SendMessageW((__hwnd), CLM_SETTEXTCOLOR, 0, (LPARAM)(__rgb)))
  54. #define CLM_GETTEXTCOLOR (CLM_FIRST + 8) //Return COLORREF
  55. #define CommandLink_GetTextColor(/*HNWD*/ __hwnd)\
  56. ((COLORREF)SendMessageW((__hwnd), CLM_GETTEXTCOLOR, 0, 0L))
  57. #define CLM_SETVISITEDCOLOR (CLM_FIRST + 9) //lParam = (LPARAM)rgb; Return TRUE on success
  58. #define CommandLink_SetVisitedColor(/*HNWD*/ __hwnd, /*COLORREF*/ __rgb)\
  59. ((BOOL)SendMessageW((__hwnd), CLM_SETVISITEDCOLOR, 0, (LPARAM)(__rgb)))
  60. #define CLM_GETVISITEDCOLOR (CLM_FIRST + 10) //Return COLORREF
  61. #define CommandLink_GetVisitedColor(/*HNWD*/ __hwnd)\
  62. ((COLORREF)SendMessageW((__hwnd), CLM_GETVISITEDCOLOR, 0, 0L))
  63. #define CLM_SETHIGHLIGHTCOLOR (CLM_FIRST + 11) //lParam = (LPARAM)rgb; Return TRUE on success
  64. #define CommandLink_SetHighlightColor(/*HNWD*/ __hwnd, /*COLORREF*/ __rgb)\
  65. ((BOOL)SendMessageW((__hwnd), CLM_SETHIGHLIGHTCOLOR, 0, (LPARAM)(__rgb)))
  66. #define CLM_GETHIGHLIGHTCOLOR (CLM_FIRST + 12) //Return COLORREF
  67. #define CommandLink_GetHighlightColor(/*HNWD*/ __hwnd)\
  68. ((COLORREF)SendMessageW((__hwnd), CLM_GETHIGHLIGHTCOLOR, 0, 0L))
  69. // notifications
  70. // NM_CLICK
  71. // NM_SETFOCUS
  72. // NM_KILLFOCUS
  73. // internal call ( do not use)
  74. EXTERN_C BOOL CommandLink_RegisterClass(HINSTANCE hInstance);
  75. #endif //NULLOSFT_DROPBOX_PLUGIN_COMMANDLINK_HEADER