]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/cocoa/dc.h
Fixed size problem due to wxMac window implementation difference
[wxWidgets.git] / include / wx / cocoa / dc.h
index 91e31313e42ab70de08c5d8fae93b7a1fa5a3612..f1bc6b4592f0bbc640367603f797222014c85321 100644 (file)
@@ -12,6 +12,9 @@
 #ifndef __WX_COCOA_DC_H__
 #define __WX_COCOA_DC_H__
 
+class WXDLLEXPORT wxDC;
+WX_DECLARE_LIST(wxDC, wxCocoaDCStack);
+
 //=========================================================================
 // wxDC
 //=========================================================================
@@ -19,17 +22,48 @@ class WXDLLEXPORT wxDC: public wxDCBase
 {
     DECLARE_DYNAMIC_CLASS(wxDC)
     DECLARE_NO_COPY_CLASS(wxDC)
+//-------------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------------
 public:
     wxDC();
     ~wxDC();
     
+//-------------------------------------------------------------------------
+// wxCocoa specifics
+//-------------------------------------------------------------------------
+public:
     static void CocoaInitializeTextSystem();
     static void CocoaShutdownTextSystem();
-    static wxDC *sm_focusedDC;
     static WX_NSTextStorage sm_cocoaNSTextStorage;
     static WX_NSLayoutManager sm_cocoaNSLayoutManager;
     static WX_NSTextContainer sm_cocoaNSTextContainer;
-
+protected:
+// DC stack
+    static wxCocoaDCStack sm_cocoaDCStack;
+    virtual bool CocoaLockFocus();
+    virtual bool CocoaUnlockFocus();
+    bool CocoaUnwindStackAndTakeFocus();
+    inline bool CocoaTakeFocus()
+    {
+        wxCocoaDCStack::compatibility_iterator node = sm_cocoaDCStack.GetFirst();
+        if(node && (node->GetData() == this))
+            return true;
+        return CocoaUnwindStackAndTakeFocus();
+    }
+    void CocoaUnwindStackAndLoseFocus();
+// DC flipping/transformation
+    void CocoaApplyTransformations();
+    float m_cocoaHeight;
+    bool m_cocoaFlipped;
+// Blitting
+    virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest,
+        wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc,
+        int logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask);
+//-------------------------------------------------------------------------
+// Implementation
+//-------------------------------------------------------------------------
+public:
     // implement base class pure virtuals
     // ----------------------------------
 
@@ -45,7 +79,7 @@ public:
     virtual void SetPen(const wxPen& pen);
     virtual void SetBrush(const wxBrush& brush);
     virtual void SetBackground(const wxBrush& brush);
-    virtual void SetBackgroundMode(int mode) {}
+    virtual void SetBackgroundMode(int mode) { m_backgroundMode = mode; }
     virtual void SetPalette(const wxPalette& palette);
 
     virtual void DestroyClippingRegion();
@@ -126,7 +160,6 @@ protected:
     virtual void DoDrawPolygon(int n, wxPoint points[],
                                wxCoord xoffset, wxCoord yoffset,
                                int fillStyle = wxODDEVEN_RULE);
-
 };
 
 #endif // __WX_COCOA_DC_H__