From bcb07ff03e6c308e7a1c30479017d77dad9c4cb3 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 29 Jul 2008 20:35:29 +0000 Subject: [PATCH] osx regrouping git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54832 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/carbon/app.h | 8 +- include/wx/osx/carbon/chkconf.h | 162 ++++++++++++---- include/wx/osx/carbon/colour.h | 6 +- include/wx/osx/carbon/nonownedwnd.h | 57 ++---- include/wx/osx/carbon/private.h | 290 ++++++++++++---------------- include/wx/osx/carbon/srchctrl.h | 2 - include/wx/osx/carbon/textctrl.h | 3 - include/wx/osx/carbon/toplevel.h | 2 - include/wx/osx/carbon/uma.h | 1 - include/wx/osx/carbon/window.h | 31 +-- 10 files changed, 291 insertions(+), 271 deletions(-) diff --git a/include/wx/osx/carbon/app.h b/include/wx/osx/carbon/app.h index 66796866a4..c5b56e8e0b 100644 --- a/include/wx/osx/carbon/app.h +++ b/include/wx/osx/carbon/app.h @@ -48,6 +48,10 @@ class WXDLLIMPEXP_CORE wxApp: public wxAppBase // setting up all MacOS Specific Event-Handlers etc virtual bool OnInitGui(); #endif // wxUSE_GUI +#if wxOSX_USE_IPHONE + virtual bool CallOnInit(); + virtual int OnRun(); +#endif // implementation only void OnIdle(wxIdleEvent& event); void OnEndSession(wxCloseEvent& event); @@ -106,13 +110,15 @@ public: bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; +#if wxOSX_USE_COCOA_OR_CARBON + // we only have applescript on these virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEGURL(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; - +#endif // in response of an open-document apple event virtual void MacOpenFile(const wxString &fileName) ; // in response of a get-url apple event diff --git a/include/wx/osx/carbon/chkconf.h b/include/wx/osx/carbon/chkconf.h index 3fe681da34..6a5ea47cac 100644 --- a/include/wx/osx/carbon/chkconf.h +++ b/include/wx/osx/carbon/chkconf.h @@ -30,15 +30,15 @@ * use OS X CoreGraphics (1) or QuickDraw (0) for rendering */ -#ifndef wxMAC_USE_CORE_GRAPHICS - #define wxMAC_USE_CORE_GRAPHICS 1 +#ifndef wxOSX_USE_CORE_GRAPHICS + #define wxOSX_USE_CORE_GRAPHICS 1 #endif /* - * wxMAC_USE_CORE_GRAPHICS is now implemented in terms of wxUSE_GRAPHICS_CONTEXT + * wxOSX_USE_CORE_GRAPHICS is now implemented in terms of wxUSE_GRAPHICS_CONTEXT */ -#if wxMAC_USE_CORE_GRAPHICS +#if wxOSX_USE_CORE_GRAPHICS #undef wxUSE_GRAPHICS_CONTEXT #define wxUSE_GRAPHICS_CONTEXT 1 #endif @@ -46,8 +46,8 @@ /* * check graphics context option */ -#if wxUSE_GRAPHICS_CONTEXT && !wxMAC_USE_CORE_GRAPHICS -# error "wxUSE_GRAPHICS_CONTEXT on wxMac requires wxMAC_USE_CORE_GRAPHICS" +#if wxUSE_GRAPHICS_CONTEXT && !wxOSX_USE_CORE_GRAPHICS +# error "wxUSE_GRAPHICS_CONTEXT on wxMac requires wxOSX_USE_CORE_GRAPHICS" #endif /* @@ -62,8 +62,8 @@ * using mixins of cocoa functionality */ -#ifndef wxMAC_USE_COCOA - #define wxMAC_USE_COCOA 0 +#ifndef wxOSX_USE_COCOA + #define wxOSX_USE_COCOA 0 #endif /* @@ -71,22 +71,40 @@ */ #ifdef __LP64__ - #if wxMAC_USE_COCOA == 0 - #undef wxMAC_USE_COCOA - #define wxMAC_USE_COCOA 1 + #if wxOSX_USE_COCOA == 0 + #undef wxOSX_USE_COCOA + #define wxOSX_USE_COCOA 1 #endif - #define wxMAC_USE_QUICKDRAW 0 - #define wxMAC_USE_CARBON 0 + #define wxOSX_USE_QUICKDRAW 0 + #define wxOSX_USE_CARBON 0 #else #ifdef __WXOSX_IPHONE__ - #define wxMAC_USE_QUICKDRAW 0 - #define wxMAC_USE_CARBON 0 + #define wxOSX_USE_QUICKDRAW 0 + #define wxOSX_USE_CARBON 0 + #define wxOSX_USE_IPHONE 1 #else - #define wxMAC_USE_QUICKDRAW 1 - #define wxMAC_USE_CARBON 1 + #if wxOSX_USE_COCOA + #define wxOSX_USE_QUICKDRAW 0 + #define wxOSX_USE_CARBON 0 + #else + #define wxOSX_USE_QUICKDRAW 1 + #define wxOSX_USE_CARBON 1 + #endif #endif #endif +#if wxOSX_USE_COCOA || wxOSX_USE_CARBON + #define wxOSX_USE_COCOA_OR_CARBON 1 +#else + #define wxOSX_USE_COCOA_OR_CARBON 0 +#endif + +#if wxOSX_USE_COCOA || wxOSX_USE_IPHONE + #define wxOSX_USE_COCOA_OR_IPHONE 1 +#else + #define wxOSX_USE_COCOA_OR_IPHONE 0 +#endif + /* * text rendering system */ @@ -95,36 +113,48 @@ * under a certain platform */ +#ifdef __WXOSX_IPHONE__ + #define wxMAC_USE_CG_TEXT 1 + #define wxMAC_USE_CORE_TEXT 0 + #define wxMAC_USE_ATSU_TEXT 0 +#else // !__WXOSX_IPHONE__ + #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 -#ifdef __WXOSX_IPHONE__ -#define wxMAC_USE_CG_TEXT 1 -#define wxMAC_USE_CORE_TEXT 0 -#define wxMAC_USE_ATSU_TEXT 0 -#else -#define wxMAC_USE_CORE_TEXT 1 -#define wxMAC_USE_ATSU_TEXT 0 -#define wxMAC_USE_CG_TEXT 0 -#endif + #define wxMAC_USE_CORE_TEXT 1 + #define wxMAC_USE_ATSU_TEXT 0 + #define wxMAC_USE_CG_TEXT 0 #else // platform < 10.5 -#define wxMAC_USE_CG_TEXT 0 + #define wxMAC_USE_CG_TEXT 0 -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -#define wxMAC_USE_CORE_TEXT 1 -#else -#define wxMAC_USE_CORE_TEXT 0 -#endif -#define wxMAC_USE_ATSU_TEXT 1 + #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + #define wxMAC_USE_CORE_TEXT 1 + #else + #define wxMAC_USE_CORE_TEXT 0 + #endif + #define wxMAC_USE_ATSU_TEXT 1 #endif +#endif // !__WXOSX_IPHONE__ + /* * turning off capabilities that don't work under 64 bit yet */ -#ifdef __LP64__ +#if wxOSX_USE_COCOA_OR_IPHONE + +#if wxUSE_MDI +#undef wxUSE_MDI +#define wxUSE_MDI 0 +#endif + +#if wxUSE_MDI_ARCHITECTURE +#undef wxUSE_MDI_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 0 +#endif #if wxUSE_DRAG_AND_DROP #undef wxUSE_DRAG_AND_DROP @@ -141,9 +171,71 @@ #define wxUSE_TOOLTIPS 0 #endif - +#if wxUSE_DATAVIEWCTRL +#undef wxUSE_DATAVIEWCTRL +#define wxUSE_DATAVIEWCTRL 0 #endif +#if wxUSE_DRAG_AND_DROP +#undef wxUSE_DRAG_AND_DROP +#define wxUSE_DRAG_AND_DROP 0 +#endif + +#if wxUSE_TASKBARICON +#undef wxUSE_TASKBARICON +#define wxUSE_TASKBARICON 0 +#endif + +/* +#if wxUSE_POPUPWIN +#undef wxUSE_POPUPWIN +#define wxUSE_POPUPWIN 0 +#endif + +#if wxUSE_COMBOBOX +#undef wxUSE_COMBOBOX +#define wxUSE_COMBOBOX 0 +#endif + + +#if wxUSE_MENUS +#undef wxUSE_MENUS +#define wxUSE_MENUS 0 +#endif + +#if wxUSE_CALENDARCTRL +#undef wxUSE_CALENDARCTRL +#define wxUSE_CALENDARCTRL 0 +#endif + +#if wxUSE_WXHTML_HELP +#undef wxUSE_WXHTML_HELP +#define wxUSE_WXHTML_HELP 0 +#endif + +#if wxUSE_DOC_VIEW_ARCHITECTURE +#undef wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_DOC_VIEW_ARCHITECTURE 0 +#endif + +#if wxUSE_PRINTING_ARCHITECTURE +#undef wxUSE_PRINTING_ARCHITECTURE +#define wxUSE_PRINTING_ARCHITECTURE 0 +#endif + +*/ + + +#endif // wxOSX_USE_COCOA_OR_IPHON + +#if wxOSX_USE_IPHONE + +#if wxUSE_CLIPBOARD +#undef wxUSE_CLIPBOARD +#define wxUSE_CLIPBOARD 0 +#endif // wxUSE_CLIPBOARD + +#endif //wxOSX_USE_IPHONE #endif /* _WX_MAC_CHKCONF_H_ */ diff --git a/include/wx/osx/carbon/colour.h b/include/wx/osx/carbon/colour.h index 1406e609df..1cc69f3984 100644 --- a/include/wx/osx/carbon/colour.h +++ b/include/wx/osx/carbon/colour.h @@ -47,14 +47,14 @@ public: CGColorRef GetCGColor() const { return m_cgColour; }; CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }; -#if wxMAC_USE_QUICKDRAW +#if wxOSX_USE_QUICKDRAW void GetRGBColor( RGBColor *col ) const; #endif // Mac-specific ctor and assignment operator from the native colour // assumes ownership of CGColorRef wxColour( CGColorRef col ); -#if wxMAC_USE_QUICKDRAW +#if wxOSX_USE_QUICKDRAW wxColour(const RGBColor& col); wxColour& operator=(const RGBColor& col); #endif @@ -64,7 +64,7 @@ public: protected : virtual void InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a); -#if wxMAC_USE_QUICKDRAW +#if wxOSX_USE_QUICKDRAW void InitRGBColor( const RGBColor& col ); #endif void InitCGColorRef( CGColorRef col ); diff --git a/include/wx/osx/carbon/nonownedwnd.h b/include/wx/osx/carbon/nonownedwnd.h index 025e3dab7a..664abc33e4 100644 --- a/include/wx/osx/carbon/nonownedwnd.h +++ b/include/wx/osx/carbon/nonownedwnd.h @@ -28,6 +28,8 @@ // location is independent of it. This class is for internal use only, it's // the base class for wxTopLevelWindow and wxPopupWindow. +class wxNonOwnedWindowImpl; + class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow { public: @@ -65,79 +67,52 @@ public: virtual bool CanSetTransparent(); virtual bool SetBackgroundStyle(wxBackgroundStyle style); + + virtual void Update(); + + WXWindow GetWXWindow() const ; + static wxNonOwnedWindow* GetFromWXWindow( WXWindow win ); // implementation from now on // -------------------------- + // activation hooks only necessary for MDI Implementation static void MacDelayedDeactivation(long timestamp); - virtual void MacCreateRealWindow( const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name ) ; - - WXWindow MacGetWindowRef() { return m_macWindow ; } virtual void MacActivate( long timestamp , bool inIsActivating ) ; - virtual void MacPerformUpdates() ; + virtual void Raise(); virtual void Lower(); virtual bool Show( bool show = true ); virtual bool ShowWithEffect(wxShowEffect effect, - unsigned timeout = 0) - { return MacShowWithEffect(true, effect, timeout); } + unsigned timeout = 0) ; virtual bool HideWithEffect(wxShowEffect effect, - unsigned timeout = 0) - { return MacShowWithEffect(false, effect, timeout); } + unsigned timeout = 0) ; virtual void SetExtraStyle(long exStyle) ; virtual bool SetBackgroundColour( const wxColour &colour ); - virtual void MacInstallTopLevelWindowEventHandler() ; - - bool MacGetMetalAppearance() const ; - bool MacGetUnifiedAppearance() const ; - - void MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) ; - wxUint32 MacGetWindowAttributes() const ; - - WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } - - virtual void MacGetContentAreaInset( int &left , int &top , int &right , int &bottom ) ; - + wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; } + + protected: // common part of all ctors void Init(); - bool MacShowWithEffect(bool show, wxShowEffect effect, unsigned timeout); - virtual void DoGetPosition( int *x, int *y ) const; virtual void DoGetSize( int *width, int *height ) const; virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoGetClientSize(int *width, int *height) const; - WXWindow m_macWindow ; + wxNonOwnedWindowImpl* m_nowpeer ; - wxWindowMac* m_macFocus ; +// wxWindowMac* m_macFocus ; static wxNonOwnedWindow *s_macDeactivateWindow; private : - // KH: We cannot let this be called directly since the metal appearance is now managed by an - // extra style. Calling this function directly can result in blank white window backgrounds. - // This is because the ExtraStyle flags get out of sync with the metal appearance and the metal - // logic & checks cease to work as expected. To set the metal appearance, use SetExtraStyle. - void MacSetMetalAppearance( bool on ) ; - void MacSetUnifiedAppearance( bool on ) ; - // binary compatible workaround TODO REPLACE - void DoMacCreateRealWindow( wxWindow *parent, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name ); - - WXEVENTHANDLERREF m_macEventHandler ; }; // list of all frames and modeless dialogs diff --git a/include/wx/osx/carbon/private.h b/include/wx/osx/carbon/private.h index fbbcb3c5cd..c4f2ee8200 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/osx/core/cfstring.h" -#include "wx/osx/core/cfdataref.h" - #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 typedef UInt32 URefCon; typedef SInt32 SRefCon; @@ -33,30 +30,15 @@ typedef SInt32 SRefCon; #include "wx/osx/carbon/dcclient.h" #include "wx/osx/carbon/dcmemory.h" -class WXDLLIMPEXP_CORE wxMacCGContextStateSaver -{ - DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver) - -public: - wxMacCGContextStateSaver( CGContextRef cg ) - { - m_cg = cg; - CGContextSaveGState( cg ); - } - ~wxMacCGContextStateSaver() - { - CGContextRestoreGState( m_cg ); - } -private: - CGContextRef m_cg; -}; - // app.h #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec); #endif +WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl ); +// TODO REMOVE WXDLLIMPEXP_CORE wxNonOwnedWindow* wxFindWindowFromWXWindow( WXWindow inWindow ); + #endif // wxUSE_GUI // filefn.h @@ -217,30 +199,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 +237,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 +261,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,21 +280,16 @@ 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; } + virtual void Destroy(); void SetReferenceInNativeControl(); static wxMacControl* GetReferenceFromNativeControl(ControlRef control); @@ -353,7 +297,34 @@ public : virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } virtual ControlRef GetControlRef() const { return m_controlRef; } + virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; } + virtual void SetReference( URefCon data ); + + 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; + + // 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 operator= (ControlRef c) { m_controlRef = c; } operator ControlRef () { return m_controlRef; } @@ -380,11 +351,6 @@ public : 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 @@ -451,8 +417,7 @@ public : void SetViewSize( SInt32 viewSize ); SInt32 GetViewSize() const; - virtual bool IsVisible() const; - virtual void SetVisibility( bool visible , bool redraw ); + virtual void SetVisibility( bool visible ); virtual bool IsEnabled() const; virtual bool IsActive() const; virtual void Enable( bool enable ); @@ -460,49 +425,32 @@ public : // 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; - } - - // to be moved into a tab control class + + // to be moved into a tab control class virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ); + + void InstallEventHandler() + { + MacInstallEventHandler( m_controlRef, m_wxPeer ); + } + + static void MacInstallEventHandler( ControlRef control, wxWindowMac* wxPeer ); 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) }; @@ -927,7 +875,7 @@ public: // pointing back - wxWindow * GetPeer() const; + // wxWindow * GetPeer() const; DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl) }; @@ -945,20 +893,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 ) \ @@ -986,61 +920,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 +955,84 @@ 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 RequestUserAttention(int flags); + + virtual void ScreenToWindow( int *x, int *y ); + + virtual void WindowToScreen( int *x, int *y ); + + + 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_ diff --git a/include/wx/osx/carbon/srchctrl.h b/include/wx/osx/carbon/srchctrl.h index eba88ccc43..2f339d638a 100644 --- a/include/wx/osx/carbon/srchctrl.h +++ b/include/wx/osx/carbon/srchctrl.h @@ -63,8 +63,6 @@ public: wxMacSearchFieldControl * GetPeer() const { return (wxMacSearchFieldControl*) m_peer; } - virtual void SetFocus(); - protected: wxSize DoGetBestSize() const; diff --git a/include/wx/osx/carbon/textctrl.h b/include/wx/osx/carbon/textctrl.h index a2f5956328..a2a3eb5e7d 100644 --- a/include/wx/osx/carbon/textctrl.h +++ b/include/wx/osx/carbon/textctrl.h @@ -164,9 +164,6 @@ public: void OnContextMenu(wxContextMenuEvent& event); - virtual bool MacCanFocus() const - { return true; } - virtual bool MacSetupCursor( const wxPoint& pt ); virtual void MacVisibilityChanged(); diff --git a/include/wx/osx/carbon/toplevel.h b/include/wx/osx/carbon/toplevel.h index d5e11e79ce..726c5d256a 100644 --- a/include/wx/osx/carbon/toplevel.h +++ b/include/wx/osx/carbon/toplevel.h @@ -77,8 +77,6 @@ protected: // should the frame be maximized when it will be shown? set by Maximize() // when it is called while the frame is hidden bool m_maximizeOnShow; - - void *m_macFullScreenData ; private : DECLARE_EVENT_TABLE() }; diff --git a/include/wx/osx/carbon/uma.h b/include/wx/osx/carbon/uma.h index 2dbb8777c2..7b5ccc0023 100644 --- a/include/wx/osx/carbon/uma.h +++ b/include/wx/osx/carbon/uma.h @@ -14,7 +14,6 @@ #include "wx/osx/private.h" -void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded) ; long UMAGetSystemVersion() ; #if wxUSE_GUI diff --git a/include/wx/osx/carbon/window.h b/include/wx/osx/carbon/window.h index 0092b70fc7..4cb6f8c7c8 100644 --- a/include/wx/osx/carbon/window.h +++ b/include/wx/osx/carbon/window.h @@ -20,6 +20,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; class WXDLLIMPEXP_FWD_CORE wxMacControl ; +class WXDLLIMPEXP_FWD_CORE wxWidgetImpl ; class WXDLLIMPEXP_CORE wxWindowMac: public wxWindowBase { @@ -117,13 +118,10 @@ public: // -------------------------- void MacClientToRootWindow( int *x , int *y ) const; - void MacRootWindowToClient( int *x , int *y ) const; void MacWindowToRootWindow( int *x , int *y ) const; - void MacWindowToRootWindow( short *x , short *y ) const; void MacRootWindowToWindow( int *x , int *y ) const; - void MacRootWindowToWindow( short *x , short *y ) const; virtual wxString MacGetToolTipString( wxPoint &where ); @@ -164,7 +162,6 @@ public: virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; virtual bool MacDoRedraw( void* updatergn , long time ) ; - virtual bool MacCanFocus() const ; // this should not be overriden in classes above wxWindowMac // because it is called from its destructor via DeleteChildren @@ -228,10 +225,8 @@ public: wxWindowBase::IsClientAreaChild(child); } - virtual void MacInstallEventHandler(WXWidget native) ; void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ; wxList& GetSubcontrols() { return m_subControls; } - WXEVENTHANDLERREF MacGetControlEventHandler() { return m_macControlEventHandler ; } // translate wxWidgets coords into ones suitable // to be passed to CreateControl calls @@ -242,20 +237,13 @@ public: int& x, int& y, int& w, int& h , bool adjustForOrigin ) const ; - // calculates the real window position and size from the native control - void MacGetPositionAndSizeFromControl(int& x, int& y, - int& w, int& h) const ; - - // gets the inset from every part - virtual void MacGetContentAreaInset( int &left , int &top , int &right , int &bottom ) ; - - // visibly flash the current invalid area: - // useful for debugging in OSX composited (double-buffered) situation - void MacFlashInvalidAreas() ; - // the 'true' OS level control for this wxWindow +#if wxOSX_USE_CARBON wxMacControl* GetPeer() const { return m_peer ; } - +#else + wxWidgetImpl* GetPeer() const { return m_peer ; } +#endif + void * MacGetCGContextRef() { return m_cgContextRef ; } void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; } @@ -263,9 +251,12 @@ protected: // For controls like radio buttons which are genuinely composite wxList m_subControls; +#if wxOSX_USE_CARBON // the peer object, allowing for cleaner API support wxMacControl * m_peer ; - +#else + wxWidgetImpl * m_peer ; +#endif void * m_cgContextRef ; // cache the clipped rectangles within the window hierarchy @@ -341,8 +332,6 @@ private: void DoUpdateScrollbarVisibility(); - WXEVENTHANDLERREF m_macControlEventHandler ; - DECLARE_NO_COPY_CLASS(wxWindowMac) DECLARE_EVENT_TABLE() };