pen.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/pen.h
  3. // Purpose: wxPen class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/10/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_PEN_H_
  11. #define _WX_PEN_H_
  12. #include "wx/gdiobj.h"
  13. #include "wx/bitmap.h"
  14. typedef long wxPMDash;
  15. // ----------------------------------------------------------------------------
  16. // Pen
  17. // ----------------------------------------------------------------------------
  18. class WXDLLIMPEXP_CORE wxPen : public wxPenBase
  19. {
  20. public:
  21. wxPen() { }
  22. wxPen( const wxColour& rColour
  23. ,int nWidth = 1
  24. ,wxPenStyle nStyle = wxPENSTYLE_SOLID
  25. );
  26. #if FUTURE_WXWIN_COMPATIBILITY_3_0
  27. wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) );
  28. #endif
  29. wxPen( const wxBitmap& rStipple
  30. ,int nWidth
  31. );
  32. virtual ~wxPen() { }
  33. bool operator == (const wxPen& rPen) const;
  34. inline bool operator != (const wxPen& rPen) const
  35. { return !(*this == rPen); }
  36. //
  37. // Override in order to recreate the pen
  38. //
  39. void SetColour(const wxColour& rColour);
  40. void SetColour(unsigned char cRed, unsigned char cGreen, unsigned char cBlue);
  41. void SetWidth(int nWidth);
  42. void SetStyle(wxPenStyle nStyle);
  43. void SetStipple(const wxBitmap& rStipple);
  44. void SetDashes( int nNbDashes
  45. ,const wxDash* pDash
  46. );
  47. void SetJoin(wxPenJoin nJoin);
  48. void SetCap(wxPenCap nCap);
  49. void SetPS(HPS hPS);
  50. wxColour GetColour(void) const;
  51. int GetWidth(void) const;
  52. wxPenStyle GetStyle(void) const;
  53. wxPenJoin GetJoin(void) const;
  54. wxPenCap GetCap(void) const;
  55. int GetPS(void) const;
  56. int GetDashes(wxDash **ptr) const;
  57. wxDash* GetDash() const;
  58. int GetDashCount() const;
  59. wxBitmap* GetStipple(void) const;
  60. #if FUTURE_WXWIN_COMPATIBILITY_3_0
  61. wxDEPRECATED_FUTURE( void SetStyle(int style) )
  62. { SetStyle((wxPenStyle)style); }
  63. #endif
  64. //
  65. // Implementation
  66. //
  67. //
  68. // Useful helper: create the brush resource
  69. //
  70. bool RealizeResource(void);
  71. bool FreeResource(bool bForce = false);
  72. virtual WXHANDLE GetResourceHandle(void) const;
  73. bool IsFree(void) const;
  74. private:
  75. LINEBUNDLE m_vLineBundle;
  76. AREABUNDLE m_vAreaBundle;
  77. protected:
  78. virtual wxGDIRefData* CreateGDIRefData() const;
  79. virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
  80. // same as FreeResource() + RealizeResource()
  81. bool Recreate();
  82. DECLARE_DYNAMIC_CLASS(wxPen)
  83. }; // end of CLASS wxPen
  84. extern int wx2os2PenStyle(wxPenStyle nWxStyle);
  85. #endif
  86. // _WX_PEN_H_