class WXDLLEXPORT wxBrush;
+typedef enum
+{
+ kwxMacBrushColour ,
+ kwxMacBrushTheme ,
+ kwxMacBrushThemeBackground
+} wxMacBrushKind ;
+
class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
{
friend class WXDLLEXPORT wxBrush;
~wxBrushRefData();
protected:
+ wxMacBrushKind m_macBrushKind ;
int m_style;
wxBitmap m_stipple ;
wxColour m_colour;
- bool m_isMacTheme ;
+
ThemeBrush m_macThemeBrush ;
- bool m_isMacThemeBackground ;
+
ThemeBackgroundKind m_macThemeBackground ;
+ Rect m_macThemeBackgroundExtent ;
};
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
virtual void SetStyle(int style) ;
virtual void SetStipple(const wxBitmap& stipple) ;
virtual void SetMacTheme(ThemeBrush macThemeBrush) ;
- virtual void SetMacThemeBackground(ThemeBackgroundKind macThemeBackground ) ;
+ virtual void SetMacThemeBackground(ThemeBackgroundKind macThemeBackground , const Rect &extent) ;
inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
- inline bool IsMacTheme() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_isMacTheme : false); };
- inline bool IsMacThemeBackground() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_isMacThemeBackground : false); };
- inline ThemeBackgroundKind GetMacThemeBackground() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_isMacThemeBackground ? M_BRUSHDATA->m_macThemeBackground : 0) : 0); };
- inline ThemeBrush GetMacTheme() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_isMacTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); };
+ inline wxMacBrushKind MacGetBrushKind() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); };
+
+ ThemeBackgroundKind GetMacThemeBackground(Rect *extent) const ;
+ inline ThemeBrush GetMacTheme() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); };
inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };
inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); };
wxCoord XDEV2LOG(wxCoord x) const
{
- long new_x = x - m_deviceOriginX;
+ long new_x = x - m_deviceOriginX ;
if (new_x > 0)
return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
else
}
wxCoord YDEV2LOG(wxCoord y) const
{
- long new_y = y - m_deviceOriginY;
+ long new_y = y - m_deviceOriginY ;
if (new_y > 0)
return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
else
{
long new_x = x - m_logicalOriginX;
if (new_x > 0)
- return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
+ return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX ;
else
- return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
+ return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX ;
}
wxCoord XLOG2DEVREL(wxCoord x) const
{
}
wxCoord YLOG2DEV(wxCoord y) const
{
- long new_y = y - m_logicalOriginY;
+ long new_y = y - m_logicalOriginY ;
if (new_y > 0)
- return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
+ return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY ;
else
- return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
+ return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY ;
}
wxCoord YLOG2DEVREL(wxCoord y) const
{
else
return (wxCoord)((double)(y) * m_scaleY - 0.5);
}
+ wxCoord XLOG2DEVMAC(wxCoord x) const
+ {
+ long new_x = x - m_logicalOriginX;
+ if (new_x > 0)
+ return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.h ;
+ else
+ return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.h ;
+ }
+ wxCoord YLOG2DEVMAC(wxCoord y) const
+ {
+ long new_y = y - m_logicalOriginY ;
+ if (new_y > 0)
+ return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.v ;
+ else
+ return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.v ;
+ }
RgnHandle MacGetCurrentClipRgn() { return m_macCurrentClipRgn ; }
- static MacSetupBackgroundForCurrentPort(const wxBrush& background ) ;
+ static void MacSetupBackgroundForCurrentPort(const wxBrush& background ) ;
//
protected:
const wxString& name ) ;
static WindowRef MacGetWindowInUpdate() { return s_macWindowInUpdate ; }
virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) ;
- virtual void MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ;
virtual void Clear() ;
virtual ControlHandle MacGetContainerForEmbedding() ;
WindowRef MacGetWindowRef() { return m_macWindow ; }
virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ;
- virtual void MacPaintBorders() ;
+ virtual void MacPaintBorders( int left , int top ) ;
WindowRef MacGetRootWindow() const ;
wxTopLevelWindowMac* MacGetTopLevelWindow() const ;
// for compatibility
void MacUpdateImmediately() { Update() ; }
-/*
- bool MacSetupFocusPort() ;
- bool MacSetupDrawingPort() ;
- bool MacSetupFocusClientPort() ;
- bool MacSetupDrawingClientPort() ;
-*/
- virtual bool MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* rootwin ) ;
virtual bool MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* rootwin ) ;
virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) ;
virtual void MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ;
- virtual void MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ;
const wxBrush& MacGetBackgroundBrush() ;
const wxRegion& MacGetVisibleRegion() ;
bool MacIsWindowScrollbar( const wxScrollBar* sb ) { return (m_hScrollBar == sb || m_vScrollBar == sb) ; }
DECLARE_EVENT_TABLE()
};
-/*
-class wxMacFocusHelper
-{
-public :
- wxMacFocusHelper( wxWindowMac * theWindow ) ;
- ~wxMacFocusHelper() ;
- bool Ok() { return m_ok ; }
-
-private :
- GrafPtr m_formerPort ;
- GrafPtr m_currentPort ;
- bool m_ok ;
-} ;
-*/
-
class wxMacDrawingHelper
{
public :
- wxMacDrawingHelper( wxWindowMac * theWindow ) ;
+ wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
~wxMacDrawingHelper() ;
bool Ok() { return m_ok ; }
-
-private :
- GrafPtr m_formerPort ;
- GrafPtr m_currentPort ;
- PenState m_savedPenState ;
- bool m_ok ;
-} ;
-/*
-class wxMacFocusClientHelper
-{
-public :
- wxMacFocusClientHelper( wxWindowMac * theWindow ) ;
- ~wxMacFocusClientHelper() ;
- bool Ok() { return m_ok ; }
-
-private :
- GrafPtr m_formerPort ;
- GrafPtr m_currentPort ;
- bool m_ok ;
-} ;
-*/
-class wxMacDrawingClientHelper
-{
-public :
- wxMacDrawingClientHelper( wxWindowMac * theWindow ) ;
- ~wxMacDrawingClientHelper() ;
- bool Ok() { return m_ok ; }
-
+ void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
+ void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
+ void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
+ const Point& GetOrigin() { return m_origin ; }
private :
+ Point m_origin ;
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
PenState m_savedPenState ;