]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/pen.h
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxPen class 
   4 // Author:      Stefan Csomor 
   8 // Copyright:   (c) Stefan Csomor 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  15 #if defined(__GNUG__) && !defined(__APPLE__) 
  16 #pragma interface "pen.h" 
  19 #include "wx/gdiobj.h" 
  20 #include "wx/colour.h" 
  21 #include "wx/bitmap.h" 
  23 class WXDLLEXPORT wxPen
; 
  25 class WXDLLEXPORT wxPenRefData
: public wxGDIRefData
 
  27     friend class WXDLLEXPORT wxPen
; 
  30     wxPenRefData(const wxPenRefData
& data
); 
  33     wxPenRefData
& operator=(const wxPenRefData
& data
); 
  44 /* TODO: implementation 
  49 #define M_PENDATA ((wxPenRefData *)m_refData) 
  52 class WXDLLEXPORT wxPen
: public wxGDIObject
 
  54   DECLARE_DYNAMIC_CLASS(wxPen
) 
  57   wxPen(const wxColour
& col
, int width 
= 1, int style 
= wxSOLID
); 
  58   wxPen(const wxBitmap
& stipple
, int width
); 
  59   wxPen(const wxPen
& pen
) 
  64   inline wxPen
& operator = (const wxPen
& pen
) { if (*this == pen
) return (*this); Ref(pen
); return *this; } 
  65   inline bool operator == (const wxPen
& pen
) { return m_refData 
== pen
.m_refData
; } 
  66   inline bool operator != (const wxPen
& pen
) { return m_refData 
!= pen
.m_refData
; } 
  68   virtual bool Ok() const { return (m_refData 
!= NULL
) ; } 
  70   // Override in order to recreate the pen 
  71   void SetColour(const wxColour
& col
) ; 
  72   void SetColour(unsigned char r
, unsigned char g
, unsigned char b
)  ; 
  74   void SetWidth(int width
)  ; 
  75   void SetStyle(int style
)  ; 
  76   void SetStipple(const wxBitmap
& stipple
)  ; 
  77   void SetDashes(int nb_dashes
, const wxDash 
*dash
)  ; 
  78   void SetJoin(int join
)  ; 
  79   void SetCap(int cap
)  ; 
  81   inline wxColour
& GetColour() const { return (M_PENDATA 
? M_PENDATA
->m_colour 
: wxNullColour
); }; 
  82   inline int GetWidth() const { return (M_PENDATA 
? M_PENDATA
->m_width 
: 0); }; 
  83   inline int GetStyle() const { return (M_PENDATA 
? M_PENDATA
->m_style 
: 0); }; 
  84   inline int GetJoin() const { return (M_PENDATA 
? M_PENDATA
->m_join 
: 0); }; 
  85   inline int GetCap() const { return (M_PENDATA 
? M_PENDATA
->m_cap 
: 0); }; 
  86   inline int GetDashes(wxDash 
**ptr
) const { 
  87      *ptr 
= (M_PENDATA 
? M_PENDATA
->m_dash 
: (wxDash
*) NULL
); return (M_PENDATA 
? M_PENDATA
->m_nbDash 
: 0); 
  90   inline wxBitmap 
*GetStipple() const { return (M_PENDATA 
? (& M_PENDATA
->m_stipple
) : (wxBitmap
*) NULL
); }; 
  94   // Useful helper: create the brush resource 
  95   bool RealizeResource(); 
  97   // When setting properties, we must make sure we're not changing