X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c6eb3a84be918dcfed2496d014549e13af0f0e9..032e024c1c6ab6a20226604baab9d00558620e72:/include/wx/osx/carbon/private.h diff --git a/include/wx/osx/carbon/private.h b/include/wx/osx/carbon/private.h index 2b9a27e04d..e63edd4891 100644 --- a/include/wx/osx/carbon/private.h +++ b/include/wx/osx/carbon/private.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/private.h +// Name: wx/osx/carbon/private.h // Purpose: Private declarations: as this header is only included by // wxWidgets itself, it may contain identifiers which don't start // with "wx". @@ -14,13 +14,10 @@ #ifndef _WX_PRIVATE_H_ #define _WX_PRIVATE_H_ -#include "wx/defs.h" +#include "wx/osx/core/private.h" #include -#include "wx/mac/corefoundation/cfstring.h" -#include "wx/mac/corefoundation/cfdataref.h" - #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 typedef UInt32 URefCon; typedef SInt32 SRefCon; @@ -28,28 +25,12 @@ typedef SInt32 SRefCon; #if wxUSE_GUI -#include "wx/listbox.h" -#include "wx/mac/carbon/dc.h" -#include "wx/mac/carbon/dcclient.h" -#include "wx/mac/carbon/dcmemory.h" - -class WXDLLIMPEXP_CORE wxMacCGContextStateSaver -{ - DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver) +#include "wx/osx/uma.h" -public: - wxMacCGContextStateSaver( CGContextRef cg ) - { - m_cg = cg; - CGContextSaveGState( cg ); - } - ~wxMacCGContextStateSaver() - { - CGContextRestoreGState( m_cg ); - } -private: - CGContextRef m_cg; -}; +#include "wx/listbox.h" +#include "wx/osx/dc.h" +#include "wx/osx/dcclient.h" +#include "wx/osx/dcmemory.h" // app.h @@ -57,6 +38,8 @@ private: bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec); #endif +// TODO REMOVE WXDLLIMPEXP_CORE wxNonOwnedWindow* wxFindWindowFromWXWindow( WXWindow inWindow ); + #endif // wxUSE_GUI // filefn.h @@ -72,6 +55,7 @@ WXDLLIMPEXP_BASE wxString wxMacFindFolder(short vRefNum, Boolean createFolder); template EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ); return 0; } +template<> inline EventParamType wxMacGetEventParamType() { return typeHIShapeRef; } template<> inline EventParamType wxMacGetEventParamType() { return typeQDRgnHandle; } template<> inline EventParamType wxMacGetEventParamType() { return typeControlRef; } template<> inline EventParamType wxMacGetEventParamType() { return typeWindowRef; } @@ -217,30 +201,6 @@ protected : bool m_release; }; -// -// helper class for allocating and deallocating Universal Proc Ptrs -// - -template class wxMacUPP -{ -public : - wxMacUPP( procType WXUNUSED(proc) ) - { - m_upp = NULL; - m_upp = (*newUPP)( NULL ); - } - ~wxMacUPP() - { - if ( m_upp ) - disposeUPP( m_upp ); - } - operator uppType() { return m_upp; } -private : - uppType m_upp; -}; - -typedef wxMacUPP wxMacNMUPP; - #if wxUSE_GUI class WXDLLIMPEXP_FWD_CORE wxMacToolTipTimer ; @@ -279,12 +239,6 @@ private : WXDLLIMPEXP_CORE void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ); WXDLLIMPEXP_CORE void wxMacReleaseBitmapButton( ControlButtonContentInfo*info ); -WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap ); - -WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data ); -WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data ); -WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf ); - #define MAC_WXHBITMAP(a) (GWorldPtr(a)) #define MAC_WXHMETAFILE(a) (PicHandle(a)) @@ -309,17 +263,14 @@ WXDLLIMPEXP_CORE void wxMacNativeToRect( const Rect *n , wxRect* wx ); WXDLLIMPEXP_CORE void wxMacPointToNative( const wxPoint* wx , Point *n ); WXDLLIMPEXP_CORE void wxMacNativeToPoint( const Point *n , wxPoint* wx ); -WXDLLIMPEXP_CORE wxWindow * wxFindControlFromMacControl(ControlRef inControl ); -WXDLLIMPEXP_CORE wxNonOwnedWindow* wxFindWinFromMacWindow( WindowRef inWindow ); WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef); WXDLLIMPEXP_CORE int wxMacCommandToId( UInt32 macCommandId ); WXDLLIMPEXP_CORE UInt32 wxIdToMacCommand( int wxId ); WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacCommand( const HICommand &macCommandId , wxMenuItem* &item ); -extern wxWindow* g_MacLastWindow; WXDLLIMPEXP_CORE pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ); -WXDLLIMPEXP_CORE Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ); +WXDLLIMPEXP_CORE Rect wxMacGetBoundsForControl( wxWindowMac* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ); ControlActionUPP GetwxMacLiveScrollbarActionProc(); @@ -331,29 +282,76 @@ enum { }; #endif -class WXDLLIMPEXP_CORE wxMacControl : public wxObject +class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl { public : - wxMacControl( wxWindow* peer , bool isRootControl = false ); - wxMacControl( wxWindow* peer , ControlRef control ); - wxMacControl( wxWindow* peer , WXWidget control ); + wxMacControl( wxWindowMac* peer , bool isRootControl = false ); wxMacControl() ; virtual ~wxMacControl(); void Init(); - virtual void Dispose(); - - bool Ok() const { return IsOk(); } - bool IsOk() const { return GetControlRef() != NULL; } - void SetReferenceInNativeControl(); static wxMacControl* GetReferenceFromNativeControl(ControlRef control); virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } virtual ControlRef GetControlRef() const { return m_controlRef; } - virtual void SetReference( URefCon data ); + virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; } + + virtual bool IsVisible() const; + + virtual void Raise(); + + virtual void Lower(); + + virtual void ScrollRect( const wxRect *rect, int dx, int dy ); + + virtual void GetContentArea( int &left , int &top , int &width , int &height ) const; + virtual void Move(int x, int y, int width, int height); + virtual void GetPosition( int &x, int &y ) const; + virtual void GetSize( int &width, int &height ) const; + virtual void SetControlSize( wxWindowVariant variant ) ; + + // where is in native window relative coordinates + virtual void SetNeedsDisplay( const wxRect* where = NULL ); + virtual bool GetNeedsDisplay() const; + + virtual bool CanFocus() const; + // return true if successful + virtual bool SetFocus(); + virtual bool HasFocus() const; + + void RemoveFromParent(); + void Embed( wxWidgetImpl *parent ); + + void SetDefaultButton( bool isDefault ); + void PerformClick(); + void SetLabel( const wxString& title, wxFontEncoding encoding ); + + void SetCursor( const wxCursor & cursor ); + void CaptureMouse(); + void ReleaseMouse(); + + wxInt32 GetValue() const; + void SetValue( wxInt32 v ); + wxBitmap GetBitmap() const; + void SetBitmap( const wxBitmap& bitmap ); + void SetBitmapPosition( wxDirection dir ); + void SetupTabs( const wxNotebook ¬ebook ); + + void GetBestRect( wxRect *r ) const; + bool IsEnabled() const; + void Enable( bool enable ); + bool ButtonClickDidStateChange() { return false ;} + void SetMinimum( wxInt32 v ); + void SetMaximum( wxInt32 v ); + void PulseGauge() ; + void SetScrollThumb( wxInt32 value, wxInt32 thumbSize ); + + // temp convenience methods + + void GetBestRect( Rect *r ) const; /* void operator= (ControlRef c) { m_controlRef = c; } operator ControlRef () { return m_controlRef; } @@ -369,22 +367,12 @@ public : virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 ); - virtual SInt32 GetValue() const; - virtual SInt32 GetMaximum() const; - virtual SInt32 GetMinimum() const; - - virtual void SetValue( SInt32 v ); - virtual void SetMinimum( SInt32 v ); - virtual void SetMaximum( SInt32 v ); + virtual wxInt32 GetMaximum() const; + virtual wxInt32 GetMinimum() const; virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ); virtual void SetRange( SInt32 minimum , SInt32 maximum ); - virtual OSStatus SetFocus( ControlFocusPart focusPart ); - virtual bool HasFocus() const; - virtual bool NeedsFocusRect() const; - virtual void SetNeedsFocusRect( bool needs ); - // templated helpers Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const @@ -438,71 +426,42 @@ public : } // Flash the control for the specified amount of time - virtual void Flash( ControlPartCode part , UInt32 ticks = 8 ); virtual void VisibilityChanged( bool shown ); virtual void SuperChangedPosition(); - virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ); + virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); virtual void SetBackgroundColour( const wxColour& col ); virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ); void SetActionProc( ControlActionUPP actionProc ); - void SetViewSize( SInt32 viewSize ); SInt32 GetViewSize() const; - virtual bool IsVisible() const; - virtual void SetVisibility( bool visible , bool redraw ); - virtual bool IsEnabled() const; + virtual void SetVisibility( bool visible ); + virtual bool IsActive() const; - virtual void Enable( bool enable ); // invalidates this control and all children virtual void InvalidateWithChildren(); virtual void SetDrawingEnabled( bool enable ); - virtual bool GetNeedsDisplay() const; - - // where is in native window relative coordinates - virtual void SetNeedsDisplay( RgnHandle where ); - // where is in native window relative coordinates - virtual void SetNeedsDisplay( Rect* where = NULL ); - - // if rect = NULL, entire view - virtual void ScrollRect( wxRect *rect , int dx , int dy ); // in native parent window relative coordinates - virtual void GetRect( Rect *r ); - - // in native parent window relative coordinates - virtual void SetRect( Rect *r ); virtual void GetRectInWindowCoords( Rect *r ); - virtual void GetBestRect( Rect *r ); - virtual void SetLabel( const wxString &title ); - // converts from Toplevel-Content relative to local - static void Convert( wxPoint *pt , wxMacControl *convert , wxMacControl *to ); - virtual void GetFeatures( UInt32 *features ); - virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region ); - virtual OSStatus SetZOrder( bool above , wxMacControl* other ); - bool IsRootControl() { return m_isRootControl; } - - wxWindow* GetPeer() const - { - return m_peer; - } + virtual void GetFeatures( UInt32 *features ); - // to be moved into a tab control class + // to be moved into a tab control class virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ); + + virtual void InstallEventHandler( WXWidget control = NULL ); protected : + WXEVENTHANDLERREF m_macControlEventHandler ; ControlRef m_controlRef; wxFont m_font; long m_windowStyle; - wxWindow* m_peer; - bool m_needsFocusRect; - bool m_isRootControl; DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacControl) }; @@ -607,6 +566,8 @@ public : OSStatus SetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ); OSStatus SetDisclosureColumn( DataBrowserPropertyID property , Boolean expandableRows ); + + OSStatus GetItemPartBounds( DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect * bounds ); protected : static pascal void DataBrowserItemNotificationProc( @@ -666,36 +627,21 @@ const DataBrowserPropertyID kMinColumnId = 1050; // base API for high-level databrowser operations -class WXDLLIMPEXP_CORE wxMacListControl -{ -public: - virtual void MacDelete( unsigned int n ) = 0; - virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 ) = 0; - // returns index of newly created line - virtual int MacAppend( const wxString& item ) = 0; - virtual void MacSetString( unsigned int n, const wxString& item ) = 0; - virtual void MacClear() = 0; - virtual void MacDeselectAll() = 0; - virtual void MacSetSelection( unsigned int n, bool select, bool multi ) = 0; - virtual int MacGetSelection() const = 0; - virtual int MacGetSelections( wxArrayInt& aSelections ) const = 0; - virtual bool MacIsSelected( unsigned int n ) const = 0; - virtual void MacScrollTo( unsigned int n ) = 0; - virtual wxString MacGetString( unsigned int n) const = 0; - virtual unsigned int MacGetCount() const = 0; - - virtual void MacSetClientData( unsigned int n, void * data) = 0; - virtual void * MacGetClientData( unsigned int) const = 0; - - virtual ~wxMacListControl() { } -}; - // base class for databrowser items enum DataItemType { DataItem_Text }; +/* +class WXDLLIMPEXP_CORE wxMacDataItem +{ +public : + wxMacDataItem(); + virtual ~wxMacDataItem(); +} ; +*/ + class WXDLLIMPEXP_CORE wxMacDataItem { public : @@ -716,24 +662,11 @@ public : DataBrowserItemNotification message, DataBrowserItemDataRef itemData ) const; - void SetLabel( const wxString& str); - const wxString& GetLabel() const; - void SetOrder( SInt32 order ); SInt32 GetOrder() const; - void SetData( void* data); - void* GetData() const; - - void SetColumn( short col ); - short GetColumn(); - protected : - wxString m_label; - wxCFStringRef m_cfLabel; - void * m_data; SInt32 m_order; - DataBrowserPropertyID m_colId; }; @@ -745,18 +678,17 @@ enum ListSortOrder { typedef wxMacDataItem* wxMacDataItemPtr; const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL; +typedef void * wxListColumnId ; WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxMacDataItemPtr, wxArrayMacDataItemPtr, class WXDLLIMPEXP_CORE); -class WXDLLIMPEXP_CORE wxMacDataItemBrowserControl : public wxMacDataBrowserControl, public wxMacListControl +class WXDLLIMPEXP_CORE wxMacDataItemBrowserControl : public wxMacDataBrowserControl { public : wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style); wxMacDataItemBrowserControl() {} // create a list item (can be a subclass of wxMacListBoxItem) - virtual wxMacDataItem* CreateItem(); - unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const; void GetItems(const wxMacDataItem* container, bool recurse , DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const; @@ -793,56 +725,23 @@ public : void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const; - // item aware methods, to be used in subclasses - - virtual Boolean CompareItems(const wxMacDataItem* itemOneID, - const wxMacDataItem* itemTwoID, - DataBrowserPropertyID sortProperty); - - virtual OSStatus GetSetItemData(wxMacDataItem* itemID, - DataBrowserPropertyID property, - DataBrowserItemDataRef itemData, - Boolean changeValue ); - - virtual void ItemNotification( - const wxMacDataItem* itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData); - - // as we are getting the same events for human and API selection we have to suppress - // events in the latter case, since this will be used from many subclasses we keep it here - - bool IsSelectionSuppressed() const { return m_suppressSelection; } - bool SuppressSelection( bool suppress ); - - - // wxMacListControl Methods // add and remove virtual void MacDelete( unsigned int n ); - virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 ); - virtual int MacAppend( const wxString& item ); + virtual void MacInsert( unsigned int n, wxMacDataItem* item); virtual void MacClear(); - // selecting - - virtual void MacDeselectAll(); - virtual void MacSetSelection( unsigned int n, bool select, bool multi = false ); - virtual int MacGetSelection() const; - virtual int MacGetSelections( wxArrayInt& aSelections ) const; - virtual bool MacIsSelected( unsigned int n ) const; + // accessing content - // display + virtual unsigned int MacGetCount() const; - virtual void MacScrollTo( unsigned int n ); +public : - // accessing content + // as we are getting the same events for human and API selection we have to suppress + // events in the latter case, since this will be used from many subclasses we keep it here - virtual void MacSetString( unsigned int n, const wxString& item ); - virtual void MacSetClientData( unsigned int n, void * data); - virtual wxString MacGetString( unsigned int n) const; - virtual void * MacGetClientData( unsigned int) const; - virtual unsigned int MacGetCount() const; + bool IsSelectionSuppressed() const { return m_suppressSelection; } + bool SuppressSelection( bool suppress ); // client data @@ -906,28 +805,115 @@ public : virtual ~wxMacListBoxItem(); + virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner , + DataBrowserPropertyID property, + DataBrowserItemDataRef itemData, + bool changeValue ); + virtual void Notification(wxMacDataItemBrowserControl *owner , DataBrowserItemNotification message, DataBrowserItemDataRef itemData ) const; +protected : }; -class WXDLLIMPEXP_CORE wxMacDataBrowserListControl : public wxMacDataItemBrowserControl +class WXDLLIMPEXP_CORE wxMacDataBrowserColumn : public wxListWidgetColumn +{ +public : + wxMacDataBrowserColumn( DataBrowserPropertyID propertyId, DataBrowserPropertyType colType, bool editable ) + : m_property(propertyId), m_editable(editable), m_type( colType ) + { + } + ~wxMacDataBrowserColumn() + { + } + DataBrowserPropertyID GetProperty() const { return m_property ; } + + bool IsEditable() const { return m_editable; } + + DataBrowserPropertyType GetType() const { return m_type; } + +protected : + DataBrowserPropertyID m_property; + bool m_editable; + DataBrowserPropertyType m_type; +} ; + +WX_DEFINE_ARRAY_PTR(wxMacDataBrowserColumn *, wxArrayMacDataBrowserColumns); + + +class WXDLLIMPEXP_CORE wxMacDataBrowserCellValue : public wxListWidgetCellValue +{ +public : + wxMacDataBrowserCellValue(DataBrowserItemDataRef data) : m_data(data) {} + virtual ~wxMacDataBrowserCellValue() {} + + virtual void Set( CFStringRef value ); + virtual void Set( const wxString& value ); + virtual void Set( int value ) ; + virtual void Check( bool check ); + + virtual int GetIntValue() const ; + virtual wxString GetStringValue() const ; +protected : + DataBrowserItemDataRef m_data; +} ; + + +class WXDLLIMPEXP_CORE wxMacDataBrowserListControl : public wxMacDataItemBrowserControl, public wxListWidgetImpl { public: wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style ); wxMacDataBrowserListControl() {} virtual ~wxMacDataBrowserListControl(); - virtual wxMacDataItem* CreateItem(); + // wxListWidgetImpl Methods - virtual void ItemNotification( - const wxMacDataItem* itemID, - DataBrowserItemNotification message, - DataBrowserItemDataRef itemData); + wxListWidgetColumn* InsertTextColumn( unsigned int pos, const wxString& title, bool editable = false, + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; + wxListWidgetColumn* InsertCheckColumn( unsigned int pos , const wxString& title, bool editable = false, + wxAlignment just = wxALIGN_LEFT , int defaultWidth = -1) ; + + wxMacDataBrowserColumn* DoInsertColumn( unsigned int pos, DataBrowserPropertyID property, + const wxString& title, bool editable, + DataBrowserPropertyType colType, SInt16 just, int width ); + // add and remove + + virtual void ListDelete( unsigned int n ); + virtual void ListInsert( unsigned int n ); + virtual void ListClear(); + + // selecting + + virtual void ListDeselectAll(); + virtual void ListSetSelection( unsigned int n, bool select, bool multi = false ); + virtual int ListGetSelection() const; + virtual int ListGetSelections( wxArrayInt& aSelections ) const; + virtual bool ListIsSelected( unsigned int n ) const; + + // display + + virtual void ListScrollTo( unsigned int n ); + + // accessing content + + virtual unsigned int ListGetCount() const; + + virtual void UpdateLine( unsigned int n, wxListWidgetColumn* col = NULL ); + virtual void UpdateLineToEnd( unsigned int n) ; // pointing back - wxWindow * GetPeer() const; + wxMacDataBrowserColumn* GetColumnFromProperty( DataBrowserPropertyID ); + +protected: + virtual void ItemNotification( + DataBrowserItemID itemID, + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData); + +private: + wxArrayMacDataBrowserColumns m_columns; + int m_nextColumnId ; DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl) }; @@ -945,20 +931,6 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ; -CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void); - -// toplevel.cpp - -class WXDLLIMPEXP_CORE wxMacDeferredWindowDeleter : public wxObject -{ -public : - wxMacDeferredWindowDeleter( WindowRef windowRef ); - virtual ~wxMacDeferredWindowDeleter(); - -protected : - WindowRef m_macWindow ; -} ; - #endif // wxUSE_GUI #define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \ @@ -977,8 +949,7 @@ UPP Get##x() \ void wxMacSetupConverters(); void wxMacCleanupConverters(); -WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to ); -WXDLLIMPEXP_BASE wxString wxMacMakeStringFromPascal( ConstStringPtr from ); +// utils.cpp // filefn.cpp @@ -986,61 +957,14 @@ WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef add WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); -#if wxUSE_GUI - -// deprecating QD - -void wxMacLocalToGlobal( WindowRef window , Point*pt ); -void wxMacGlobalToLocal( WindowRef window , Point*pt ); - -#endif - //--------------------------------------------------------------------------- // cocoa bridging utilities //--------------------------------------------------------------------------- bool wxMacInitCocoa(); -class WXDLLIMPEXP_CORE 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 // ------------- @@ -1068,5 +992,87 @@ const short kwxCursorLast = kwxCursorRoller; extern ClassicCursor gMacCursors[]; +// +// +// + +#if wxUSE_GUI + +class wxNonOwnedWindowCarbonImpl : public wxNonOwnedWindowImpl +{ +public : + wxNonOwnedWindowCarbonImpl( wxNonOwnedWindow* nonownedwnd) ; + wxNonOwnedWindowCarbonImpl(); + virtual ~wxNonOwnedWindowCarbonImpl(); + + virtual void Destroy() ; + void Create( wxWindow* parent, const wxPoint& pos, const wxSize& size, + long style, long extraStyle, const wxString& name ) ; + + WXWindow GetWXWindow() const; + void Raise(); + void Lower(); + bool Show(bool show); + bool ShowWithEffect(bool show, wxShowEffect effect, unsigned timeout); + + + void Update(); + bool SetTransparent(wxByte alpha); + bool SetBackgroundColour(const wxColour& col ); + void SetExtraStyle( long exStyle ); + bool SetBackgroundStyle(wxBackgroundStyle style); + bool CanSetTransparent(); + void MoveWindow(int x, int y, int width, int height); + void GetPosition( int &x, int &y ) const; + void GetSize( int &width, int &height ) const; + void GetContentArea( int &left , int &top , int &width , int &height ) const; + + bool SetShape(const wxRegion& region); + + virtual void SetTitle( const wxString& title, wxFontEncoding encoding ) ; + + virtual bool IsMaximized() const; + + virtual bool IsIconized() const; + + virtual void Iconize( bool iconize ); + + virtual void Maximize(bool maximize); + + virtual bool IsFullScreen() const; + + virtual bool ShowFullScreen(bool show, long style); + + virtual void ShowWithoutActivating(); + + virtual void RequestUserAttention(int flags); + + virtual void ScreenToWindow( int *x, int *y ); + + virtual void WindowToScreen( int *x, int *y ); + virtual bool IsActive(); + + + bool MacGetUnifiedAppearance() const ; + void MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) ; + wxUint32 MacGetWindowAttributes() const ; + void MacSetMetalAppearance( bool set ) ; + bool MacGetMetalAppearance() const ; + void MacSetUnifiedAppearance( bool set ); + + WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } + + wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; } +protected : + void MacInstallTopLevelWindowEventHandler(); + + WXEVENTHANDLERREF m_macEventHandler ; + WindowRef m_macWindow; + void * m_macFullScreenData ; + DECLARE_DYNAMIC_CLASS_NO_COPY(wxNonOwnedWindowCarbonImpl) +}; + +#endif // wxUSE_GUI + #endif // _WX_PRIVATE_H_