]> git.saurik.com Git - wxWidgets.git/commitdiff
forward port from 2.8
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 9 Nov 2007 20:35:17 +0000 (20:35 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 9 Nov 2007 20:35:17 +0000 (20:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
include/wx/mac/carbon/app.h
include/wx/mac/carbon/chkconf.h
include/wx/mac/carbon/dataform.h
include/wx/mac/carbon/dataobj.h
include/wx/mac/carbon/font.h
include/wx/mac/carbon/menu.h
include/wx/mac/carbon/menuitem.h
include/wx/mac/carbon/metafile.h
include/wx/mac/carbon/popupwin.h
include/wx/mac/carbon/private.h
include/wx/mac/carbon/radiobox.h
include/wx/mac/carbon/textctrl.h
include/wx/mac/carbon/uma.h
include/wx/mac/carbon/window.h

index 00d42f2ad8eb353041eb47bf293512786dee3b45..323ba1f98b6d6c84039be81b5a625d7998f16790 100644 (file)
@@ -78,6 +78,7 @@ public:
     // adding a CFType object to be released only at the end of the current event cycle (increases the
     // refcount of the object passed), needed in case we are in the middle of an event concering an object
     // we want to delete and cannot do it immediately
+    // TODO change semantics to be in line with cocoa (make autrelease NOT increase the count)
     void                  MacAddToAutorelease( void* cfrefobj );
 public:
     static wxWindow*      s_captureWindow ;
index ec1bfa37ff09bcb981281b675ff9530c3ec3d5b1..25ab6194ee3f3ed15aec8a704085b21c2586e13b 100644 (file)
     #define wxMAC_USE_NATIVE_TOOLBAR 1
 #endif
 
+/*
+ * using mixins of cocoa functionality
+ */
+#ifndef wxMAC_USE_COCOA
+    #define wxMAC_USE_COCOA 0
+#endif
+
 #endif
     /* _WX_MAC_CHKCONF_H_ */
 
index 7fa7cb6e0c9b5e4d710ad97151ebd27a16f65c22..96a108c335c1ea6a208531ff6263fbaec9ed37b5 100644 (file)
@@ -19,8 +19,11 @@ public:
 
     wxDataFormat();
     wxDataFormat(wxDataFormatId vType);
+    wxDataFormat(const wxDataFormat& rFormat);
     wxDataFormat(const wxString& rId);
+    wxDataFormat(const wxChar* pId);
     wxDataFormat(NativeFormat vFormat);
+    ~wxDataFormat();
 
     wxDataFormat& operator=(NativeFormat vFormat)
         { SetId(vFormat); return *this; }
@@ -34,6 +37,8 @@ public:
     bool operator!=(wxDataFormatId format) const
         { return m_type != (wxDataFormatId)format; }
 
+    wxDataFormat& operator=(const wxDataFormat& format);
+
     // explicit and implicit conversions to NativeFormat which is one of
     // standard data types (implicit conversion is useful for preserving the
     // compatibility with old code)
index fa1aa17600971fed69260f958170b67ec243e87b..e5c0fda881b9fac8ae1f3722e4074a00163a1580 100644 (file)
@@ -25,6 +25,12 @@ public:
 #endif
 
     virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
+    void AddToPasteboard( void * pasteboardRef , int itemID );
+    // returns true if the passed in format is present in the pasteboard
+    static bool IsFormatInPasteboard( void * pasteboardRef, const wxDataFormat &dataFormat );
+    // returns true if any of the accepted formats of this dataobj is in the pasteboard
+    bool HasDataInPasteboard( void * pasteboardRef );
+    bool GetFromPasteboard( void * pasteboardRef );
 };
 
 #endif // _WX_MAC_DATAOBJ_H_
index 2113b7570981b7c165a7cae8ed232ccfdf172996..9fc1171abbde4bbe91779e588d559912d6a3f9fa 100644 (file)
@@ -51,6 +51,9 @@ public:
     bool Create(const wxNativeFontInfo& info);
 
     bool MacCreateThemeFont( wxUint16 themeFontID ) ;
+#ifdef __LP64__
+       bool MacCreateUIFont( wxUint32 coreTextFontType );
+#endif
     
     virtual ~wxFont();
 
@@ -84,19 +87,24 @@ public:
 
     // Mac-specific, risks to change, don't use in portable code
     
+#ifndef __LP64__    
     // 'old' Quickdraw accessors
-    
     short MacGetFontNum() const;
     short MacGetFontSize() const;
     wxByte  MacGetFontStyle() const;
     
     // 'new' ATSUI accessors
-    
     wxUint32 MacGetATSUFontID() const;
     wxUint32 MacGetATSUAdditionalQDStyles() const;
     wxUint16 MacGetThemeFontID() const ;
+
     // Returns an ATSUStyle not ATSUStyle*
     void* MacGetATSUStyle() const ; 
+#else
+    const void * MacGetCTFont() const;
+    // soon to be removed for 64bit, Returns an ATSUStyle not ATSUStyle*
+    void* MacGetATSUStyle() const ; 
+#endif
     
 private:
     void Unshare();
index 634ee2fe87be341b618a7c684532e2a9b7f7b875..1b78b376493b471c4ebf0c949e757719829edd1d 100644 (file)
@@ -61,6 +61,9 @@ public:
 
     short MacGetMenuId() { return m_macMenuId ; }
 
+    wxInt32 MacHandleCommandProcess( wxMenuItem* item, int id, wxWindow* targetWindow = NULL );
+    wxInt32 MacHandleCommandUpdateStatus( wxMenuItem* item, int id, wxWindow* targetWindow = NULL);
+
 protected:
     virtual wxMenuItem* DoAppend(wxMenuItem *item);
     virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
index a5b087cb5aaea22aed6f3bc07091bbd5551666f2..4be07df17b40ebc0a699b9a92dd4ad6197acdd5c 100644 (file)
@@ -54,6 +54,8 @@ public:
     void SetRadioGroupEnd(int end);
 
 private:
+    void DoUpdateItemBitmap( WXHMENU menu, wxUint16 index) ;
+
     void UncheckRadio() ;
 
     // the positions of the first and last items of the radio group this item
index d6f7fe2cb7a4fa4aacdd3142f31a5400ae01bd9c..d0056405066fe53d7b0e32e863a34e282afd3b55 100644 (file)
@@ -57,6 +57,10 @@ public:
     // Implementation
     WXHMETAFILE GetHMETAFILE() const ;
     void SetHMETAFILE(WXHMETAFILE mf) ;
+    // Since the native metafile format is PDF for Quartz
+    // we need a call that allows setting PICT content for
+    // backwards compatibility
+    void SetPICT(void* pictHandle) ;
 };
 
 class WXDLLEXPORT wxMetafileDC: public wxDC
index b3ec56577d8d78911fb5120a8024ff6333840ec0..c1590abc73619ee25e90086413072a2d790488f2 100644 (file)
@@ -20,6 +20,7 @@ class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase
 {
 public:
     wxPopupWindow() { }
+    ~wxPopupWindow();
 
     wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
         { (void)Create(parent, flags); }
@@ -28,9 +29,16 @@ public:
 
     virtual bool Show(bool show = true);
 
+    WXWindow MacGetPopupWindowRef() const ;
+
 protected:
     // popups handle the position like wxTopLevelWindow, not wxWindow
     virtual void DoGetPosition(int *x, int *y) const;
+    virtual void DoMoveWindow(int x, int y, int width, int height);
+    virtual void DoGetSize( int *width, int *height ) const;
+    virtual void DoGetClientSize( int *width, int *height ) const;
+    
+    WXWindow m_popupWindowRef ;
 
     DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow)
 };
index 65216bbcfb809a04893202f15f1e8579cc8714e3..53aaa10dc53e8271bd3a77c414f9ae8439e06062 100644 (file)
@@ -49,6 +49,7 @@
 
 #ifdef __WXMAC_CARBON__
 #include "wx/mac/corefoundation/cfstring.h"
+#include "wx/mac/corefoundation/cfdataref.h"
 #endif
 
 #ifndef FixedToInt
@@ -429,6 +430,11 @@ public :
 
     operator refType () const { return m_ref; }
 
+    wxMacCFRefHolder& operator=(refType r)
+    {
+        Set( r );
+        return *this;
+    }
 private :
     refType m_ref;
     bool m_release;
@@ -438,6 +444,40 @@ private :
 
 #if wxUSE_GUI
 
+class wxMacToolTipTimer ;
+
+class wxMacToolTip
+{
+public :
+    wxMacToolTip() ;
+    ~wxMacToolTip() ;
+
+    void Setup( WindowRef window , const wxString& text , const wxPoint& localPosition ) ;
+    void Draw() ;
+    void Clear() ;
+
+    long GetMark()
+    { return m_mark ; }
+
+    bool IsShown()
+    { return m_shown ; }
+
+private :
+    wxString    m_label ;
+    wxPoint m_position ;
+    Rect            m_rect ;
+    WindowRef    m_window ;
+    PicHandle    m_backpict ;
+    bool        m_shown ;
+    long        m_mark ;
+#if wxUSE_TIMER 
+    wxMacToolTipTimer* m_timer ;
+#endif
+#if TARGET_CARBON
+    wxMacCFStringHolder m_helpTextRef ;
+#endif
+} ;
+
 /*
 GWorldPtr         wxMacCreateGWorld( int width , int height , int depth );
 void                 wxMacDestroyGWorld( GWorldPtr gw );
@@ -448,6 +488,7 @@ CTabHandle         wxMacCreateColorTable( int numColors );
 */
 void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 );
 void wxMacReleaseBitmapButton( ControlButtonContentInfo*info );
+CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap );
 
 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
@@ -1085,6 +1126,26 @@ public:
 // graphics implementation
 // ============================================================================
 
+// make sure we all use one class for all conversions from wx to native colour
+
+class wxMacCoreGraphicsColour
+{
+public:
+    wxMacCoreGraphicsColour();
+    wxMacCoreGraphicsColour(const wxBrush &brush);
+    ~wxMacCoreGraphicsColour();
+    
+     void Apply( CGContextRef cgContext );
+protected:
+    void Init();
+    wxMacCFRefHolder<CGColorRef> m_color;
+    wxMacCFRefHolder<CGColorSpaceRef> m_colorSpace;
+
+    bool m_isPattern;
+    wxMacCFRefHolder<CGPatternRef> m_pattern;
+    CGFloat* m_patternColorComponents;
+} ;
+
 #if wxMAC_USE_CORE_GRAPHICS && !wxUSE_GRAPHICS_CONTEXT
 
 class WXDLLEXPORT wxMacCGPath : public wxGraphicPath
@@ -1225,9 +1286,13 @@ public:
 
     // returns a Pict from the bitmap content
     PicHandle     GetPictHandle();
+#if wxMAC_USE_CORE_GRAPHICS
+    CGContextRef  GetBitmapContext() const;
+#else
     GWorldPtr     GetHBITMAP(GWorldPtr * mask = NULL ) const;
     void          UpdateAlphaMask() const;
-
+#endif
+    int           GetBytesPerRow() const { return m_bytesPerRow; }
 private :
     bool Create(int width , int height , int depth);
     void Init();
@@ -1245,10 +1310,14 @@ private :
 #endif
     IconRef       m_iconRef;
     PicHandle     m_pictHandle;
+#if wxMAC_USE_CORE_GRAPHICS
+    CGContextRef  m_hBitmap;
+#else
     GWorldPtr     m_hBitmap;
     GWorldPtr     m_hMaskBitmap;
     wxMemoryBuffer m_maskMemBuf;
     int            m_maskBytesPerRow;
+#endif
 };
 
 class WXDLLEXPORT wxIconRefData : public wxGDIRefData
@@ -1276,6 +1345,16 @@ private :
 
 // toplevel.cpp
 
+class wxMacDeferredWindowDeleter : public wxObject
+{
+public :
+    wxMacDeferredWindowDeleter( WindowRef windowRef );
+    virtual ~wxMacDeferredWindowDeleter();
+
+protected :
+    WindowRef m_macWindow ;
+} ;
+
 ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow, const Point& location , WindowRef window , ControlPartCode *outPart );
 
 #ifndef __LP64__
@@ -1331,5 +1410,78 @@ void wxMacGlobalToLocal( WindowRef window , Point*pt );
 
 #endif
 
+//---------------------------------------------------------------------------
+// cocoa bridging utilities
+//---------------------------------------------------------------------------
+
+bool wxMacInitCocoa();
+
+class wxMacAutoreleasePool
+{
+public :
+    wxMacAutoreleasePool();
+    ~wxMacAutoreleasePool();
+private :
+    void* m_pool;
+};
+
+// NSObject
+
+void wxMacCocoaRelease( void* obj );
+void wxMacCocoaAutorelease( void* obj );
+void wxMacCocoaRetain( void* obj );
+
+#if wxMAC_USE_COCOA
+
+// NSCursor
+
+WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type );
+WX_NSCursor  wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY );
+void  wxMacCocoaSetCursor( WX_NSCursor cursor );
+void  wxMacCocoaHideCursor();
+void  wxMacCocoaShowCursor();
+
+typedef struct tagClassicCursor
+{
+    wxUint16 bits[16];
+    wxUint16 mask[16];
+    wxInt16 hotspot[2];
+}ClassicCursor;
+
+#else // !wxMAC_USE_COCOA
+
+// non Darwin
+
+typedef Cursor ClassicCursor;
+
+#endif // wxMAC_USE_COCOA
+
+// -------------
+// Common to all
+// -------------
+
+// Cursor support
+
+const short kwxCursorBullseye = 0;
+const short kwxCursorBlank = 1;
+const short kwxCursorPencil = 2;
+const short kwxCursorMagnifier = 3;
+const short kwxCursorNoEntry = 4;
+const short kwxCursorPaintBrush = 5;
+const short kwxCursorPointRight = 6;
+const short kwxCursorPointLeft = 7;
+const short kwxCursorQuestionArrow = 8;
+const short kwxCursorRightArrow = 9;
+const short kwxCursorSizeNS = 10;
+const short kwxCursorSize = 11;
+const short kwxCursorSizeNESW = 12;
+const short kwxCursorSizeNWSE = 13;
+const short kwxCursorRoller = 14;
+const short kwxCursorLast = kwxCursorRoller;
+
+// exposing our fallback cursor map
+
+extern ClassicCursor gMacCursors[];
+
 #endif
     // _WX_PRIVATE_H_
index 177d4a17c8e66d7c0f906e2d733a51b0bc0a2a8d..c7e6e4bd0e48e2207ffa88f085698280339d9bd2 100644 (file)
@@ -57,20 +57,12 @@ public:
     // Enabling
     virtual bool Enable(bool enable = true);
     virtual bool Enable(unsigned int item, bool enable = true);
-    virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const
-    {
-        /* TODO */
-        return true;
-    }
+    virtual bool IsItemEnabled(unsigned int item) const;
 
     // Showing
     virtual bool Show(bool show = true);
     virtual bool Show(unsigned int item, bool show = true);
-    virtual bool IsItemShown(unsigned int WXUNUSED(n)) const
-    {
-        /* TODO */
-        return true;
-    }
+    virtual bool IsItemShown(unsigned int item) const;
 
     // Specific functions (in wxWidgets2 reference)
     virtual void SetSelection(int item);
index 0c0bb754641d7c098c4c87ce9811980a5e581da6..39cf86c3dcfed990760318ad7c43e4d9b57e2c1b 100644 (file)
@@ -18,6 +18,9 @@
     // has more features (backgrounds etc.), but may show redraw artefacts and other
     // problems depending on your usage; hence, the default is 'false'.
     #define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte")
+    // set this to 'true' if you want editable text controls to have spell checking turned
+    // on by default, you can change this setting individually on a control using MacCheckSpelling
+    #define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker")
 #endif
 
 #include "wx/control.h"
index 23bb3d31ce78d02ca3ec5c7ee695103b1db46b22..641b26eb1434facb3959937890ceed94e5356952 100644 (file)
@@ -109,11 +109,12 @@ OSStatus UMAGetHelpMenuDontCreate(
 
 OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ;
 
-// Clipboard support
+#define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )
 
-OSStatus UMAPutScrap( Size size , OSType type , void *data ) ;
+// Quartz 
 
-#define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn )
+CGDataProviderRef UMACGDataProviderCreateWithCFData( CFDataRef data );
+CGDataConsumerRef UMACGDataConsumerCreateWithCFData( CFMutableDataRef data );
 
 #endif // wxUSE_GUI
 
index 53b40f6f5fdec4ba9ca72f15740ffeecca441066..2ea9b499908a8e60307faf8b57885fd27871e03f 100644 (file)
@@ -145,7 +145,7 @@ public:
 
     void MacOnScroll( wxScrollEvent&event );
 
-    bool AcceptsFocus() const;
+    virtual bool AcceptsFocus() const;
 
     virtual bool IsDoubleBuffered() const { return true; }
 
@@ -170,6 +170,7 @@ public:
     // because it is called from its destructor via DeleteChildren
     virtual void        RemoveChild( wxWindowBase *child );
     virtual void        MacPaintBorders( int left , int top ) ;
+    void                MacPaintGrowBox();
 
     // invalidates the borders and focus area around the control;
     // must not be virtual as it will be called during destruction
@@ -321,11 +322,13 @@ protected:
 
     virtual bool        MacIsChildOfClientArea( const wxWindow* child ) const ;
 
+    bool                MacHasScrollBarCorner() const;
     void                MacCreateScrollBars( long style ) ;
     void                MacRepositionScrollBars() ;
     void                MacUpdateControlFont() ;
 
     void                MacPropagateVisibilityChanged() ;
+    void                MacPropagateEnabledStateChanged() ;
     void                MacPropagateHiliteChanged() ;
 
     // implement the base class pure virtuals