// 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 ;
#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_ */
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; }
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)
#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_
bool Create(const wxNativeFontInfo& info);
bool MacCreateThemeFont( wxUint16 themeFontID ) ;
+#ifdef __LP64__
+ bool MacCreateUIFont( wxUint32 coreTextFontType );
+#endif
virtual ~wxFont();
// 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();
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);
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
// 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
{
public:
wxPopupWindow() { }
+ ~wxPopupWindow();
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
{ (void)Create(parent, flags); }
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)
};
#ifdef __WXMAC_CARBON__
#include "wx/mac/corefoundation/cfstring.h"
+#include "wx/mac/corefoundation/cfdataref.h"
#endif
#ifndef FixedToInt
operator refType () const { return m_ref; }
+ wxMacCFRefHolder& operator=(refType r)
+ {
+ Set( r );
+ return *this;
+ }
private :
refType m_ref;
bool m_release;
#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 );
*/
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))
// 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
// 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();
#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
// 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__
#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_
// 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);
// 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"
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
void MacOnScroll( wxScrollEvent&event );
- bool AcceptsFocus() const;
+ virtual bool AcceptsFocus() const;
virtual bool IsDoubleBuffered() const { return true; }
// 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
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