/src/thirdparty/ResizableLib/ResizableMsgSupport.h

https://github.com/clsid2/mpc-hc · C Header · 104 lines · 54 code · 23 blank · 27 comment · 3 complexity · f74e2dcc4acef568146cebc3d4e1f207 MD5 · raw file

  1. // ResizableMsgSupport.h: some declarations to support custom resizable wnds
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. //
  5. // This file is part of ResizableLib
  6. // https://github.com/ppescher/resizablelib
  7. //
  8. // Copyright (C) 2000-2015 by Paolo Messina
  9. // mailto:ppescher@hotmail.com
  10. //
  11. // The contents of this file are subject to the Artistic License 2.0
  12. // http://opensource.org/licenses/Artistic-2.0
  13. //
  14. // If you find this code useful, credits would be nice!
  15. //
  16. /////////////////////////////////////////////////////////////////////////////
  17. #if !defined(AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_)
  18. #define AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif // _MSC_VER > 1000
  22. typedef struct tagRESIZEPROPERTIES
  23. {
  24. // wether to ask for resizing properties every time
  25. BOOL bAskClipping;
  26. BOOL bAskRefresh;
  27. // otherwise, use the cached properties
  28. BOOL bCachedLikesClipping;
  29. BOOL bCachedNeedsRefresh;
  30. // initialize with valid data
  31. tagRESIZEPROPERTIES() : bAskClipping(TRUE), bAskRefresh(TRUE), bCachedLikesClipping(FALSE), bCachedNeedsRefresh(TRUE) {}
  32. } RESIZEPROPERTIES, *PRESIZEPROPERTIES, *LPRESIZEPROPERTIES;
  33. typedef struct tagCLIPPINGPROPERTY
  34. {
  35. BOOL bLikesClipping;
  36. // initialize with valid data
  37. tagCLIPPINGPROPERTY() : bLikesClipping(FALSE) {}
  38. } CLIPPINGPROPERTY, *PCLIPPINGPROPERTY, *LPCLIPPINGPROPERTY;
  39. typedef struct tagREFRESHPROPERTY
  40. {
  41. BOOL bNeedsRefresh;
  42. RECT rcOld;
  43. RECT rcNew;
  44. // initialize with valid data
  45. tagREFRESHPROPERTY() : bNeedsRefresh(TRUE), rcOld(), rcNew() {}
  46. } REFRESHPROPERTY, *PREFRESHPROPERTY, *LPREFRESHPROPERTY;
  47. // registered message to communicate with the library
  48. extern const UINT WMU_RESIZESUPPORT;
  49. // if the message is implemented the returned value must be non-zero
  50. // the default window procedure returns zero for unhandled messages
  51. // wParam is one of the following RSZSUP_* values, lParam as specified
  52. enum ResizeSupport
  53. {
  54. RSZSUP_QUERYPROPERTIES = 101, // lParam = LPRESIZEPROPERTIES
  55. RSZSUP_LIKESCLIPPING = 102, // lParam = LPCLIPPINGPROPERTY
  56. RSZSUP_NEEDSREFRESH = 103, // lParam = LPREFRESHPROPERTY
  57. RSZSUP_SHEETPAGEEXHACK = 104, // lParam = HWND (source prop.page)
  58. };
  59. /////////////////////////////////////////////////////////////////////////////
  60. // utility functions
  61. inline BOOL Send_QueryProperties(HWND hWnd, LPRESIZEPROPERTIES pResizeProperties)
  62. {
  63. return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT,
  64. RSZSUP_QUERYPROPERTIES, (LPARAM)pResizeProperties));
  65. }
  66. inline BOOL Send_LikesClipping(HWND hWnd, LPCLIPPINGPROPERTY pClippingProperty)
  67. {
  68. return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT,
  69. RSZSUP_LIKESCLIPPING, (LPARAM)pClippingProperty));
  70. }
  71. inline BOOL Send_NeedsRefresh(HWND hWnd, LPREFRESHPROPERTY pRefreshProperty)
  72. {
  73. return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT,
  74. RSZSUP_NEEDSREFRESH, (LPARAM)pRefreshProperty));
  75. }
  76. inline void Post_SheetPageExHack(HWND hWndSheet, HWND hWndPage)
  77. {
  78. PostMessage(hWndSheet, WMU_RESIZESUPPORT,
  79. RSZSUP_SHEETPAGEEXHACK, (LPARAM)hWndPage);
  80. }
  81. #endif // !defined(AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_)