pen.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/pen.h
  3. // Purpose: wxPen class
  4. // Author: Julian Smart
  5. // Modified by: Vadim Zeitlin: fixed operator=(), ==(), !=()
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_PEN_H_
  11. #define _WX_PEN_H_
  12. #include "wx/gdiobj.h"
  13. #include "wx/gdicmn.h"
  14. // ----------------------------------------------------------------------------
  15. // Pen
  16. // ----------------------------------------------------------------------------
  17. class WXDLLIMPEXP_CORE wxPen : public wxPenBase
  18. {
  19. public:
  20. wxPen() { }
  21. wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID);
  22. #if FUTURE_WXWIN_COMPATIBILITY_3_0
  23. wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) );
  24. #endif
  25. wxPen(const wxBitmap& stipple, int width);
  26. virtual ~wxPen() { }
  27. bool operator==(const wxPen& pen) const;
  28. bool operator!=(const wxPen& pen) const { return !(*this == pen); }
  29. // Override in order to recreate the pen
  30. void SetColour(const wxColour& col);
  31. void SetColour(unsigned char r, unsigned char g, unsigned char b);
  32. void SetWidth(int width);
  33. void SetStyle(wxPenStyle style);
  34. void SetStipple(const wxBitmap& stipple);
  35. void SetDashes(int nb_dashes, const wxDash *dash);
  36. void SetJoin(wxPenJoin join);
  37. void SetCap(wxPenCap cap);
  38. wxColour GetColour() const;
  39. int GetWidth() const;
  40. wxPenStyle GetStyle() const;
  41. wxPenJoin GetJoin() const;
  42. wxPenCap GetCap() const;
  43. int GetDashes(wxDash** ptr) const;
  44. wxDash* GetDash() const;
  45. int GetDashCount() const;
  46. wxBitmap* GetStipple() const;
  47. #if FUTURE_WXWIN_COMPATIBILITY_3_0
  48. wxDEPRECATED_FUTURE( void SetStyle(int style) )
  49. { SetStyle((wxPenStyle)style); }
  50. #endif
  51. // internal: wxGDIObject methods
  52. virtual bool RealizeResource();
  53. virtual bool FreeResource(bool force = false);
  54. virtual WXHANDLE GetResourceHandle() const;
  55. virtual bool IsFree() const;
  56. protected:
  57. virtual wxGDIRefData* CreateGDIRefData() const;
  58. virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
  59. // same as FreeResource() + RealizeResource()
  60. bool Recreate();
  61. DECLARE_DYNAMIC_CLASS(wxPen)
  62. };
  63. #endif // _WX_PEN_H_