| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/cocoa/dcclient.h |
| 3 | // Purpose: wxClientDC, wxPaintDC and wxWindowDC classes |
| 4 | // Author: David Elliott |
| 5 | // Modified by: |
| 6 | // Created: 2003/04/01 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) 2003 David Elliott |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef __WX_COCOA_DCCLIENT_H__ |
| 13 | #define __WX_COCOA_DCCLIENT_H__ |
| 14 | |
| 15 | #include "wx/dc.h" |
| 16 | |
| 17 | // DFE: A while ago I stumbled upon the fact that retrieving the parent |
| 18 | // NSView of the content view seems to return the entire window rectangle |
| 19 | // (including decorations). Of course, that is not at all part of the |
| 20 | // Cocoa or OpenStep APIs, but it might be a neat hack. |
| 21 | class wxWindowDC: public wxDC |
| 22 | { |
| 23 | DECLARE_DYNAMIC_CLASS(wxWindowDC) |
| 24 | public: |
| 25 | wxWindowDC(void); |
| 26 | // Create a DC corresponding to a window |
| 27 | wxWindowDC(wxWindow *win); |
| 28 | virtual ~wxWindowDC(void); |
| 29 | |
| 30 | protected: |
| 31 | wxWindow *m_window; |
| 32 | WX_NSView m_lockedNSView; |
| 33 | // DC stack |
| 34 | virtual bool CocoaLockFocus(); |
| 35 | virtual bool CocoaUnlockFocus(); |
| 36 | bool CocoaLockFocusOnNSView(WX_NSView nsview); |
| 37 | bool CocoaUnlockFocusOnNSView(); |
| 38 | virtual bool CocoaGetBounds(void *rectData); |
| 39 | }; |
| 40 | |
| 41 | class wxClientDC: public wxWindowDC |
| 42 | { |
| 43 | DECLARE_DYNAMIC_CLASS(wxClientDC) |
| 44 | public: |
| 45 | wxClientDC(void); |
| 46 | // Create a DC corresponding to a window |
| 47 | wxClientDC(wxWindow *win); |
| 48 | virtual ~wxClientDC(void); |
| 49 | protected: |
| 50 | // DC stack |
| 51 | virtual bool CocoaLockFocus(); |
| 52 | virtual bool CocoaUnlockFocus(); |
| 53 | }; |
| 54 | |
| 55 | class wxPaintDC: public wxWindowDC |
| 56 | { |
| 57 | DECLARE_DYNAMIC_CLASS(wxPaintDC) |
| 58 | public: |
| 59 | wxPaintDC(void); |
| 60 | // Create a DC corresponding to a window |
| 61 | wxPaintDC(wxWindow *win); |
| 62 | virtual ~wxPaintDC(void); |
| 63 | protected: |
| 64 | // DC stack |
| 65 | virtual bool CocoaLockFocus(); |
| 66 | virtual bool CocoaUnlockFocus(); |
| 67 | }; |
| 68 | |
| 69 | #endif |
| 70 | // __WX_COCOA_DCCLIENT_H__ |