ResizableGrip.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // This file is part of ResizableLib
  4. // https://github.com/ppescher/resizablelib
  5. //
  6. // Copyright (C) 2000-2015 by Paolo Messina
  7. // mailto:ppescher@hotmail.com
  8. //
  9. // The contents of this file are subject to the Artistic License 2.0
  10. // http://opensource.org/licenses/Artistic-2.0
  11. //
  12. // If you find this code useful, credits would be nice!
  13. //
  14. /////////////////////////////////////////////////////////////////////////////
  15. /*!
  16. * @file
  17. * @brief Interface for the CResizableGrip class.
  18. */
  19. #if !defined(AFX_RESIZABLEGRIP_H__INCLUDED_)
  20. #define AFX_RESIZABLEGRIP_H__INCLUDED_
  21. #if _MSC_VER > 1000
  22. #pragma once
  23. #endif // _MSC_VER > 1000
  24. /*! @addtogroup CoreComponents
  25. * @{
  26. */
  27. //! @brief brief_description
  28. /*!
  29. * long_description
  30. */
  31. class CResizableGrip
  32. {
  33. private:
  34. class CSizeGrip : public CScrollBar
  35. {
  36. public:
  37. CSizeGrip()
  38. {
  39. m_bTransparent = FALSE;
  40. m_bTriangular = FALSE;
  41. }
  42. void SetTriangularShape(BOOL bEnable);
  43. void SetTransparency(BOOL bActivate);
  44. BOOL IsRTL(); // right-to-left layout support
  45. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  46. SIZE m_size; // holds grip size
  47. protected:
  48. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  49. BOOL m_bTriangular; // triangular shape active
  50. BOOL m_bTransparent; // transparency active
  51. // memory DCs and bitmaps for transparent grip
  52. CDC m_dcGrip, m_dcMask;
  53. CBitmap m_bmGrip, m_bmMask;
  54. };
  55. CSizeGrip m_wndGrip; // grip control
  56. int m_nShowCount; // support for hiding the grip
  57. protected:
  58. // create a size grip, with options
  59. BOOL CreateSizeGrip(BOOL bVisible = TRUE,
  60. BOOL bTriangular = TRUE, BOOL bTransparent = FALSE);
  61. BOOL IsSizeGripVisible(); // TRUE if grip is set to be visible
  62. void SetSizeGripVisibility(BOOL bVisible); // set default visibility
  63. void UpdateSizeGrip(); // update the grip's visibility and position
  64. void ShowSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp show the size grip
  65. void HideSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp hide the size grip
  66. BOOL SetSizeGripBkMode(int nBkMode); // like CDC::SetBkMode
  67. void SetSizeGripShape(BOOL bTriangular);
  68. virtual CWnd* GetResizableWnd() const = 0;
  69. public:
  70. CResizableGrip();
  71. virtual ~CResizableGrip();
  72. };
  73. // @}
  74. #endif // !defined(AFX_RESIZABLEGRIP_H__INCLUDED_)