osx regrouping

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54832 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-07-29 20:35:29 +00:00
parent 41e5097c52
commit bcb07ff03e
10 changed files with 291 additions and 271 deletions

View File

@@ -48,6 +48,10 @@ class WXDLLIMPEXP_CORE wxApp: public wxAppBase
// setting up all MacOS Specific Event-Handlers etc // setting up all MacOS Specific Event-Handlers etc
virtual bool OnInitGui(); virtual bool OnInitGui();
#endif // wxUSE_GUI #endif // wxUSE_GUI
#if wxOSX_USE_IPHONE
virtual bool CallOnInit();
virtual int OnRun();
#endif
// implementation only // implementation only
void OnIdle(wxIdleEvent& event); void OnIdle(wxIdleEvent& event);
void OnEndSession(wxCloseEvent& 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 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 ) ; 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 ) ; 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 MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAEGURL(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEGURL(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
#endif
// in response of an open-document apple event // in response of an open-document apple event
virtual void MacOpenFile(const wxString &fileName) ; virtual void MacOpenFile(const wxString &fileName) ;
// in response of a get-url apple event // in response of a get-url apple event

View File

@@ -30,15 +30,15 @@
* use OS X CoreGraphics (1) or QuickDraw (0) for rendering * use OS X CoreGraphics (1) or QuickDraw (0) for rendering
*/ */
#ifndef wxMAC_USE_CORE_GRAPHICS #ifndef wxOSX_USE_CORE_GRAPHICS
#define wxMAC_USE_CORE_GRAPHICS 1 #define wxOSX_USE_CORE_GRAPHICS 1
#endif #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 #undef wxUSE_GRAPHICS_CONTEXT
#define wxUSE_GRAPHICS_CONTEXT 1 #define wxUSE_GRAPHICS_CONTEXT 1
#endif #endif
@@ -46,8 +46,8 @@
/* /*
* check graphics context option * check graphics context option
*/ */
#if wxUSE_GRAPHICS_CONTEXT && !wxMAC_USE_CORE_GRAPHICS #if wxUSE_GRAPHICS_CONTEXT && !wxOSX_USE_CORE_GRAPHICS
# error "wxUSE_GRAPHICS_CONTEXT on wxMac requires wxMAC_USE_CORE_GRAPHICS" # error "wxUSE_GRAPHICS_CONTEXT on wxMac requires wxOSX_USE_CORE_GRAPHICS"
#endif #endif
/* /*
@@ -62,8 +62,8 @@
* using mixins of cocoa functionality * using mixins of cocoa functionality
*/ */
#ifndef wxMAC_USE_COCOA #ifndef wxOSX_USE_COCOA
#define wxMAC_USE_COCOA 0 #define wxOSX_USE_COCOA 0
#endif #endif
/* /*
@@ -71,21 +71,39 @@
*/ */
#ifdef __LP64__ #ifdef __LP64__
#if wxMAC_USE_COCOA == 0 #if wxOSX_USE_COCOA == 0
#undef wxMAC_USE_COCOA #undef wxOSX_USE_COCOA
#define wxMAC_USE_COCOA 1 #define wxOSX_USE_COCOA 1
#endif #endif
#define wxMAC_USE_QUICKDRAW 0 #define wxOSX_USE_QUICKDRAW 0
#define wxMAC_USE_CARBON 0 #define wxOSX_USE_CARBON 0
#else #else
#ifdef __WXOSX_IPHONE__ #ifdef __WXOSX_IPHONE__
#define wxMAC_USE_QUICKDRAW 0 #define wxOSX_USE_QUICKDRAW 0
#define wxMAC_USE_CARBON 0 #define wxOSX_USE_CARBON 0
#define wxOSX_USE_IPHONE 1
#else #else
#define wxMAC_USE_QUICKDRAW 1 #if wxOSX_USE_COCOA
#define wxMAC_USE_CARBON 1 #define wxOSX_USE_QUICKDRAW 0
#define wxOSX_USE_CARBON 0
#else
#define wxOSX_USE_QUICKDRAW 1
#define wxOSX_USE_CARBON 1
#endif #endif
#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 * text rendering system
@@ -95,17 +113,17 @@
* under a certain platform * under a certain platform
*/ */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
#ifdef __WXOSX_IPHONE__ #ifdef __WXOSX_IPHONE__
#define wxMAC_USE_CG_TEXT 1 #define wxMAC_USE_CG_TEXT 1
#define wxMAC_USE_CORE_TEXT 0 #define wxMAC_USE_CORE_TEXT 0
#define wxMAC_USE_ATSU_TEXT 0 #define wxMAC_USE_ATSU_TEXT 0
#else #else // !__WXOSX_IPHONE__
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
#define wxMAC_USE_CORE_TEXT 1 #define wxMAC_USE_CORE_TEXT 1
#define wxMAC_USE_ATSU_TEXT 0 #define wxMAC_USE_ATSU_TEXT 0
#define wxMAC_USE_CG_TEXT 0 #define wxMAC_USE_CG_TEXT 0
#endif
#else // platform < 10.5 #else // platform < 10.5
@@ -120,11 +138,23 @@
#endif #endif
#endif // !__WXOSX_IPHONE__
/* /*
* turning off capabilities that don't work under 64 bit yet * 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 #if wxUSE_DRAG_AND_DROP
#undef wxUSE_DRAG_AND_DROP #undef wxUSE_DRAG_AND_DROP
@@ -141,9 +171,71 @@
#define wxUSE_TOOLTIPS 0 #define wxUSE_TOOLTIPS 0
#endif #endif
#if wxUSE_DATAVIEWCTRL
#undef wxUSE_DATAVIEWCTRL
#define wxUSE_DATAVIEWCTRL 0
#endif #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 #endif
/* _WX_MAC_CHKCONF_H_ */ /* _WX_MAC_CHKCONF_H_ */

View File

@@ -47,14 +47,14 @@ public:
CGColorRef GetCGColor() const { return m_cgColour; }; CGColorRef GetCGColor() const { return m_cgColour; };
CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }; CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); };
#if wxMAC_USE_QUICKDRAW #if wxOSX_USE_QUICKDRAW
void GetRGBColor( RGBColor *col ) const; void GetRGBColor( RGBColor *col ) const;
#endif #endif
// Mac-specific ctor and assignment operator from the native colour // Mac-specific ctor and assignment operator from the native colour
// assumes ownership of CGColorRef // assumes ownership of CGColorRef
wxColour( CGColorRef col ); wxColour( CGColorRef col );
#if wxMAC_USE_QUICKDRAW #if wxOSX_USE_QUICKDRAW
wxColour(const RGBColor& col); wxColour(const RGBColor& col);
wxColour& operator=(const RGBColor& col); wxColour& operator=(const RGBColor& col);
#endif #endif
@@ -64,7 +64,7 @@ public:
protected : protected :
virtual void virtual void
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a); InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
#if wxMAC_USE_QUICKDRAW #if wxOSX_USE_QUICKDRAW
void InitRGBColor( const RGBColor& col ); void InitRGBColor( const RGBColor& col );
#endif #endif
void InitCGColorRef( CGColorRef col ); void InitCGColorRef( CGColorRef col );

View File

@@ -28,6 +28,8 @@
// location is independent of it. This class is for internal use only, it's // location is independent of it. This class is for internal use only, it's
// the base class for wxTopLevelWindow and wxPopupWindow. // the base class for wxTopLevelWindow and wxPopupWindow.
class wxNonOwnedWindowImpl;
class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow
{ {
public: public:
@@ -66,78 +68,51 @@ public:
virtual bool SetBackgroundStyle(wxBackgroundStyle style); virtual bool SetBackgroundStyle(wxBackgroundStyle style);
virtual void Update();
WXWindow GetWXWindow() const ;
static wxNonOwnedWindow* GetFromWXWindow( WXWindow win );
// implementation from now on // implementation from now on
// -------------------------- // --------------------------
// activation hooks only necessary for MDI Implementation
static void MacDelayedDeactivation(long timestamp); 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 MacActivate( long timestamp , bool inIsActivating ) ;
virtual void MacPerformUpdates() ;
virtual void Raise(); virtual void Raise();
virtual void Lower(); virtual void Lower();
virtual bool Show( bool show = true ); virtual bool Show( bool show = true );
virtual bool ShowWithEffect(wxShowEffect effect, virtual bool ShowWithEffect(wxShowEffect effect,
unsigned timeout = 0) unsigned timeout = 0) ;
{ return MacShowWithEffect(true, effect, timeout); }
virtual bool HideWithEffect(wxShowEffect effect, virtual bool HideWithEffect(wxShowEffect effect,
unsigned timeout = 0) unsigned timeout = 0) ;
{ return MacShowWithEffect(false, effect, timeout); }
virtual void SetExtraStyle(long exStyle) ; virtual void SetExtraStyle(long exStyle) ;
virtual bool SetBackgroundColour( const wxColour &colour ); virtual bool SetBackgroundColour( const wxColour &colour );
virtual void MacInstallTopLevelWindowEventHandler() ; wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; }
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 ) ;
protected: protected:
// common part of all ctors // common part of all ctors
void Init(); void Init();
bool MacShowWithEffect(bool show, wxShowEffect effect, unsigned timeout);
virtual void DoGetPosition( int *x, int *y ) const; virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const; virtual void DoGetSize( int *width, int *height ) const;
virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoMoveWindow(int x, int y, int width, int height);
virtual void DoGetClientSize(int *width, int *height) const; virtual void DoGetClientSize(int *width, int *height) const;
WXWindow m_macWindow ; wxNonOwnedWindowImpl* m_nowpeer ;
wxWindowMac* m_macFocus ; // wxWindowMac* m_macFocus ;
static wxNonOwnedWindow *s_macDeactivateWindow; static wxNonOwnedWindow *s_macDeactivateWindow;
private : 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 // list of all frames and modeless dialogs

View File

@@ -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 // Purpose: Private declarations: as this header is only included by
// wxWidgets itself, it may contain identifiers which don't start // wxWidgets itself, it may contain identifiers which don't start
// with "wx". // with "wx".
@@ -14,13 +14,10 @@
#ifndef _WX_PRIVATE_H_ #ifndef _WX_PRIVATE_H_
#define _WX_PRIVATE_H_ #define _WX_PRIVATE_H_
#include "wx/defs.h" #include "wx/osx/core/private.h"
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#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 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
typedef UInt32 URefCon; typedef UInt32 URefCon;
typedef SInt32 SRefCon; typedef SInt32 SRefCon;
@@ -33,30 +30,15 @@ typedef SInt32 SRefCon;
#include "wx/osx/carbon/dcclient.h" #include "wx/osx/carbon/dcclient.h"
#include "wx/osx/carbon/dcmemory.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 // app.h
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec); bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec);
#endif #endif
WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
// TODO REMOVE WXDLLIMPEXP_CORE wxNonOwnedWindow* wxFindWindowFromWXWindow( WXWindow inWindow );
#endif // wxUSE_GUI #endif // wxUSE_GUI
// filefn.h // filefn.h
@@ -217,30 +199,6 @@ protected :
bool m_release; bool m_release;
}; };
//
// helper class for allocating and deallocating Universal Proc Ptrs
//
template <typename procType, typename uppType , uppType (*newUPP)(procType) , void (*disposeUPP)(uppType) > 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<NMProcPtr,NMUPP,NewNMUPP,DisposeNMUPP> wxMacNMUPP;
#if wxUSE_GUI #if wxUSE_GUI
class WXDLLIMPEXP_FWD_CORE wxMacToolTipTimer ; 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 wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 );
WXDLLIMPEXP_CORE void wxMacReleaseBitmapButton( ControlButtonContentInfo*info ); 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_WXHBITMAP(a) (GWorldPtr(a))
#define MAC_WXHMETAFILE(a) (PicHandle(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 wxMacPointToNative( const wxPoint* wx , Point *n );
WXDLLIMPEXP_CORE void wxMacNativeToPoint( const Point *n , wxPoint* wx ); 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 wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef);
WXDLLIMPEXP_CORE int wxMacCommandToId( UInt32 macCommandId ); WXDLLIMPEXP_CORE int wxMacCommandToId( UInt32 macCommandId );
WXDLLIMPEXP_CORE UInt32 wxIdToMacCommand( int wxId ); WXDLLIMPEXP_CORE UInt32 wxIdToMacCommand( int wxId );
WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacCommand( const HICommand &macCommandId , wxMenuItem* &item ); 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 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(); ControlActionUPP GetwxMacLiveScrollbarActionProc();
@@ -331,21 +280,16 @@ enum {
}; };
#endif #endif
class WXDLLIMPEXP_CORE wxMacControl : public wxObject class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl
{ {
public : public :
wxMacControl( wxWindow* peer , bool isRootControl = false ); wxMacControl( wxWindowMac* peer , bool isRootControl = false );
wxMacControl( wxWindow* peer , ControlRef control );
wxMacControl( wxWindow* peer , WXWidget control );
wxMacControl() ; wxMacControl() ;
virtual ~wxMacControl(); virtual ~wxMacControl();
void Init(); void Init();
virtual void Dispose(); virtual void Destroy();
bool Ok() const { return IsOk(); }
bool IsOk() const { return GetControlRef() != NULL; }
void SetReferenceInNativeControl(); void SetReferenceInNativeControl();
static wxMacControl* GetReferenceFromNativeControl(ControlRef control); static wxMacControl* GetReferenceFromNativeControl(ControlRef control);
@@ -353,7 +297,34 @@ public :
virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } virtual ControlRef * GetControlRefAddr() { return &m_controlRef; }
virtual ControlRef GetControlRef() const { return m_controlRef; } virtual ControlRef GetControlRef() const { return m_controlRef; }
virtual WXWidget GetWXWidget() const { return (WXWidget) m_controlRef; }
virtual void SetReference( URefCon data ); 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; } void operator= (ControlRef c) { m_controlRef = c; }
operator ControlRef () { return m_controlRef; } operator ControlRef () { return m_controlRef; }
@@ -380,11 +351,6 @@ public :
virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ); virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum );
virtual void SetRange( 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 // templated helpers
Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const
@@ -451,8 +417,7 @@ public :
void SetViewSize( SInt32 viewSize ); void SetViewSize( SInt32 viewSize );
SInt32 GetViewSize() const; SInt32 GetViewSize() const;
virtual bool IsVisible() const; virtual void SetVisibility( bool visible );
virtual void SetVisibility( bool visible , bool redraw );
virtual bool IsEnabled() const; virtual bool IsEnabled() const;
virtual bool IsActive() const; virtual bool IsActive() const;
virtual void Enable( bool enable ); virtual void Enable( bool enable );
@@ -460,49 +425,32 @@ public :
// invalidates this control and all children // invalidates this control and all children
virtual void InvalidateWithChildren(); virtual void InvalidateWithChildren();
virtual void SetDrawingEnabled( bool enable ); 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 // 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 GetRectInWindowCoords( Rect *r );
virtual void GetBestRect( Rect *r ); virtual void GetBestRect( Rect *r );
virtual void SetLabel( const wxString &title ); 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 void GetFeatures( UInt32 *features );
virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region ); 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 ); virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable );
void InstallEventHandler()
{
MacInstallEventHandler( m_controlRef, m_wxPeer );
}
static void MacInstallEventHandler( ControlRef control, wxWindowMac* wxPeer );
protected : protected :
WXEVENTHANDLERREF m_macControlEventHandler ;
ControlRef m_controlRef; ControlRef m_controlRef;
wxFont m_font; wxFont m_font;
long m_windowStyle; long m_windowStyle;
wxWindow* m_peer;
bool m_needsFocusRect;
bool m_isRootControl;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacControl) DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacControl)
}; };
@@ -927,7 +875,7 @@ public:
// pointing back // pointing back
wxWindow * GetPeer() const; // wxWindow * GetPeer() const;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl) DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl)
}; };
@@ -945,20 +893,6 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ; 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 #endif // wxUSE_GUI
#define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \ #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 OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); 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 // cocoa bridging utilities
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool wxMacInitCocoa(); 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; typedef Cursor ClassicCursor;
#endif // wxMAC_USE_COCOA
// ------------- // -------------
// Common to all // Common to all
// ------------- // -------------
@@ -1068,5 +955,84 @@ const short kwxCursorLast = kwxCursorRoller;
extern ClassicCursor gMacCursors[]; 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 #endif
// _WX_PRIVATE_H_ // _WX_PRIVATE_H_

View File

@@ -63,8 +63,6 @@ public:
wxMacSearchFieldControl * GetPeer() const wxMacSearchFieldControl * GetPeer() const
{ return (wxMacSearchFieldControl*) m_peer; } { return (wxMacSearchFieldControl*) m_peer; }
virtual void SetFocus();
protected: protected:
wxSize DoGetBestSize() const; wxSize DoGetBestSize() const;

View File

@@ -164,9 +164,6 @@ public:
void OnContextMenu(wxContextMenuEvent& event); void OnContextMenu(wxContextMenuEvent& event);
virtual bool MacCanFocus() const
{ return true; }
virtual bool MacSetupCursor( const wxPoint& pt ); virtual bool MacSetupCursor( const wxPoint& pt );
virtual void MacVisibilityChanged(); virtual void MacVisibilityChanged();

View File

@@ -77,8 +77,6 @@ protected:
// should the frame be maximized when it will be shown? set by Maximize() // should the frame be maximized when it will be shown? set by Maximize()
// when it is called while the frame is hidden // when it is called while the frame is hidden
bool m_maximizeOnShow; bool m_maximizeOnShow;
void *m_macFullScreenData ;
private : private :
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -14,7 +14,6 @@
#include "wx/osx/private.h" #include "wx/osx/private.h"
void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded) ;
long UMAGetSystemVersion() ; long UMAGetSystemVersion() ;
#if wxUSE_GUI #if wxUSE_GUI

View File

@@ -20,6 +20,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow;
class WXDLLIMPEXP_FWD_CORE wxMacControl ; class WXDLLIMPEXP_FWD_CORE wxMacControl ;
class WXDLLIMPEXP_FWD_CORE wxWidgetImpl ;
class WXDLLIMPEXP_CORE wxWindowMac: public wxWindowBase class WXDLLIMPEXP_CORE wxWindowMac: public wxWindowBase
{ {
@@ -117,13 +118,10 @@ public:
// -------------------------- // --------------------------
void MacClientToRootWindow( int *x , int *y ) const; void MacClientToRootWindow( int *x , int *y ) const;
void MacRootWindowToClient( int *x , int *y ) const;
void MacWindowToRootWindow( 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( int *x , int *y ) const;
void MacRootWindowToWindow( short *x , short *y ) const;
virtual wxString MacGetToolTipString( wxPoint &where ); virtual wxString MacGetToolTipString( wxPoint &where );
@@ -164,7 +162,6 @@ public:
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
virtual bool MacDoRedraw( void* updatergn , long time ) ; virtual bool MacDoRedraw( void* updatergn , long time ) ;
virtual bool MacCanFocus() const ;
// this should not be overriden in classes above wxWindowMac // this should not be overriden in classes above wxWindowMac
// because it is called from its destructor via DeleteChildren // because it is called from its destructor via DeleteChildren
@@ -228,10 +225,8 @@ public:
wxWindowBase::IsClientAreaChild(child); wxWindowBase::IsClientAreaChild(child);
} }
virtual void MacInstallEventHandler(WXWidget native) ;
void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ; void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ;
wxList& GetSubcontrols() { return m_subControls; } wxList& GetSubcontrols() { return m_subControls; }
WXEVENTHANDLERREF MacGetControlEventHandler() { return m_macControlEventHandler ; }
// translate wxWidgets coords into ones suitable // translate wxWidgets coords into ones suitable
// to be passed to CreateControl calls // to be passed to CreateControl calls
@@ -242,19 +237,12 @@ public:
int& x, int& y, int& x, int& y,
int& w, int& h , bool adjustForOrigin ) const ; 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 // the 'true' OS level control for this wxWindow
#if wxOSX_USE_CARBON
wxMacControl* GetPeer() const { return m_peer ; } wxMacControl* GetPeer() const { return m_peer ; }
#else
wxWidgetImpl* GetPeer() const { return m_peer ; }
#endif
void * MacGetCGContextRef() { return m_cgContextRef ; } void * MacGetCGContextRef() { return m_cgContextRef ; }
void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; } void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; }
@@ -263,9 +251,12 @@ protected:
// For controls like radio buttons which are genuinely composite // For controls like radio buttons which are genuinely composite
wxList m_subControls; wxList m_subControls;
#if wxOSX_USE_CARBON
// the peer object, allowing for cleaner API support // the peer object, allowing for cleaner API support
wxMacControl * m_peer ; wxMacControl * m_peer ;
#else
wxWidgetImpl * m_peer ;
#endif
void * m_cgContextRef ; void * m_cgContextRef ;
// cache the clipped rectangles within the window hierarchy // cache the clipped rectangles within the window hierarchy
@@ -341,8 +332,6 @@ private:
void DoUpdateScrollbarVisibility(); void DoUpdateScrollbarVisibility();
WXEVENTHANDLERREF m_macControlEventHandler ;
DECLARE_NO_COPY_CLASS(wxWindowMac) DECLARE_NO_COPY_CLASS(wxWindowMac)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };