ResizableGrip.h 2.3 KB

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