Get rid of compile- and run-time checks for OS X < 10.5.
As 10.5 is the minimal supported version, it doesn't make sense to check for it (or even earlier versions) during the build or run-time. Closes #15580. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -30,23 +30,9 @@
|
|||||||
* text rendering system
|
* text rendering system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
|
|
||||||
#define wxOSX_USE_CORE_TEXT 1
|
#define wxOSX_USE_CORE_TEXT 1
|
||||||
// MLTE-TextControl uses ATSU
|
|
||||||
#define wxOSX_USE_ATSU_TEXT 1
|
#define wxOSX_USE_ATSU_TEXT 1
|
||||||
|
|
||||||
#else // platform < 10.5
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
#define wxOSX_USE_CORE_TEXT 1
|
|
||||||
#else
|
|
||||||
#define wxOSX_USE_CORE_TEXT 0
|
|
||||||
#endif
|
|
||||||
#define wxOSX_USE_ATSU_TEXT 1
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Audio System
|
* Audio System
|
||||||
*/
|
*/
|
||||||
|
@@ -155,9 +155,7 @@ public:
|
|||||||
|
|
||||||
OSStatus EnableCellSizeModification(bool enableHeight=true, bool enableWidth=true); // enables or disables the column width and row height modification (default: false)
|
OSStatus EnableCellSizeModification(bool enableHeight=true, bool enableWidth=true); // enables or disables the column width and row height modification (default: false)
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
OSStatus GetAttributes (OptionBits* attributes);
|
OSStatus GetAttributes (OptionBits* attributes);
|
||||||
#endif
|
|
||||||
OSStatus GetColumnWidth (DataBrowserPropertyID column, UInt16 *width ) const; // returns the column width in pixels
|
OSStatus GetColumnWidth (DataBrowserPropertyID column, UInt16 *width ) const; // returns the column width in pixels
|
||||||
OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels
|
OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels
|
||||||
OSStatus GetDefaultRowHeight (UInt16 * height ) const;
|
OSStatus GetDefaultRowHeight (UInt16 * height ) const;
|
||||||
@@ -166,9 +164,7 @@ public:
|
|||||||
OSStatus GetRowHeight (DataBrowserItemID item , UInt16 *height) const;
|
OSStatus GetRowHeight (DataBrowserItemID item , UInt16 *height) const;
|
||||||
OSStatus GetScrollPosition (UInt32* top, UInt32 *left) const;
|
OSStatus GetScrollPosition (UInt32* top, UInt32 *left) const;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
OSStatus SetAttributes (OptionBits attributes);
|
OSStatus SetAttributes (OptionBits attributes);
|
||||||
#endif
|
|
||||||
OSStatus SetColumnWidth(DataBrowserPropertyID column, UInt16 width); // sets the column width in pixels
|
OSStatus SetColumnWidth(DataBrowserPropertyID column, UInt16 width); // sets the column width in pixels
|
||||||
OSStatus SetDefaultColumnWidth( UInt16 width );
|
OSStatus SetDefaultColumnWidth( UInt16 width );
|
||||||
OSStatus SetDefaultRowHeight( UInt16 height );
|
OSStatus SetDefaultRowHeight( UInt16 height );
|
||||||
|
@@ -22,8 +22,6 @@
|
|||||||
// near future
|
// near future
|
||||||
//
|
//
|
||||||
|
|
||||||
#if ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxDrawerWindow : public wxTopLevelWindow
|
class WXDLLIMPEXP_ADV wxDrawerWindow : public wxTopLevelWindow
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxDrawerWindow)
|
DECLARE_DYNAMIC_CLASS(wxDrawerWindow)
|
||||||
@@ -64,7 +62,4 @@ public:
|
|||||||
wxDirection GetCurrentEdge() const; // not necessarily the preferred, due to screen constraints
|
wxDirection GetCurrentEdge() const; // not necessarily the preferred, due to screen constraints
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // defined( __WXMAC__ ) && TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
|
#endif // _WX_DRAWERWINDOW_H_
|
||||||
|
|
||||||
#endif
|
|
||||||
// _WX_DRAWERWINDOW_H_
|
|
||||||
|
@@ -13,11 +13,6 @@
|
|||||||
#ifndef _WX_PRIVATE_H_
|
#ifndef _WX_PRIVATE_H_
|
||||||
#define _WX_PRIVATE_H_
|
#define _WX_PRIVATE_H_
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
|
||||||
typedef UInt32 URefCon;
|
|
||||||
typedef SInt32 SRefCon;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
#include "wx/osx/uma.h"
|
#include "wx/osx/uma.h"
|
||||||
@@ -29,10 +24,6 @@ typedef SInt32 SRefCon;
|
|||||||
|
|
||||||
// app.h
|
// app.h
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
|
||||||
bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
|
||||||
// filefn.h
|
// filefn.h
|
||||||
@@ -269,12 +260,6 @@ ControlActionUPP GetwxMacLiveScrollbarActionProc();
|
|||||||
|
|
||||||
// additional optional event defines
|
// additional optional event defines
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
|
||||||
enum {
|
|
||||||
kEventControlFocusPartChanged = 164
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl
|
class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
@@ -41,33 +41,15 @@
|
|||||||
* text rendering system
|
* text rendering system
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
|
|
||||||
#define wxOSX_USE_CORE_TEXT 1
|
#define wxOSX_USE_CORE_TEXT 1
|
||||||
#define wxOSX_USE_ATSU_TEXT 0
|
#define wxOSX_USE_ATSU_TEXT 0
|
||||||
|
|
||||||
#else // platform < 10.5
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
#define wxOSX_USE_CORE_TEXT 1
|
|
||||||
#else
|
|
||||||
#define wxOSX_USE_CORE_TEXT 0
|
|
||||||
#endif
|
|
||||||
#define wxOSX_USE_ATSU_TEXT 1
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Audio System
|
* Audio System
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
#define wxOSX_USE_QUICKTIME 0
|
#define wxOSX_USE_QUICKTIME 0
|
||||||
#define wxOSX_USE_AUDIOTOOLBOX 1
|
#define wxOSX_USE_AUDIOTOOLBOX 1
|
||||||
#else // platform < 10.5
|
|
||||||
#define wxOSX_USE_QUICKTIME 1
|
|
||||||
#define wxOSX_USE_AUDIOTOOLBOX 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* turning off capabilities that don't work under cocoa yet
|
* turning off capabilities that don't work under cocoa yet
|
||||||
|
@@ -19,12 +19,6 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
|
||||||
// available in 10.4 but not in the headers
|
|
||||||
enum {
|
|
||||||
kEventMouseScroll = 11
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
//
|
//
|
||||||
// shared between Cocoa and Carbon
|
// shared between Cocoa and Carbon
|
||||||
//
|
//
|
||||||
|
@@ -45,11 +45,7 @@
|
|||||||
#define WX_GMTOFF_IN_TM 1
|
#define WX_GMTOFF_IN_TM 1
|
||||||
#define HAVE_PW_GECOS 1
|
#define HAVE_PW_GECOS 1
|
||||||
#define HAVE_DLOPEN 1
|
#define HAVE_DLOPEN 1
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
|
||||||
/* #undef HAVE_CXA_DEMANGLE */
|
|
||||||
#else
|
|
||||||
#define HAVE_CXA_DEMANGLE 1
|
#define HAVE_CXA_DEMANGLE 1
|
||||||
#endif
|
|
||||||
#define HAVE_GETTIMEOFDAY 1
|
#define HAVE_GETTIMEOFDAY 1
|
||||||
#define HAVE_FSYNC 1
|
#define HAVE_FSYNC 1
|
||||||
#define HAVE_ROUND 1
|
#define HAVE_ROUND 1
|
||||||
@@ -108,11 +104,7 @@
|
|||||||
#define HAVE_WCHAR_H 1
|
#define HAVE_WCHAR_H 1
|
||||||
/* better to use the built-in CF conversions, also avoid iconv versioning problems */
|
/* better to use the built-in CF conversions, also avoid iconv versioning problems */
|
||||||
/* #undef HAVE_ICONV */
|
/* #undef HAVE_ICONV */
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
|
||||||
#define ICONV_CONST const
|
|
||||||
#else
|
|
||||||
#define ICONV_CONST
|
#define ICONV_CONST
|
||||||
#endif
|
|
||||||
#define HAVE_LANGINFO_H 1
|
#define HAVE_LANGINFO_H 1
|
||||||
#define HAVE_WCSRTOMBS 1
|
#define HAVE_WCSRTOMBS 1
|
||||||
#define HAVE_FPUTWS 1
|
#define HAVE_FPUTWS 1
|
||||||
|
@@ -52,7 +52,7 @@ of MSW, MAC and OS2
|
|||||||
#define USE_WXMAC 0
|
#define USE_WXMAC 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__WXMAC_OSX__) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2) && USE_NATIVE_FONT_DIALOG_FOR_MACOSX
|
#if defined(__WXMAC_OSX__) && && USE_NATIVE_FONT_DIALOG_FOR_MACOSX
|
||||||
#define USE_WXMACFONTDLG 1
|
#define USE_WXMACFONTDLG 1
|
||||||
#else
|
#else
|
||||||
#define USE_WXMACFONTDLG 0
|
#define USE_WXMACFONTDLG 0
|
||||||
|
@@ -458,10 +458,7 @@ bool wxWebKitCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() );
|
m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() );
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
|
HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
|
||||||
#endif
|
|
||||||
InstallControlEventHandler( peer->GetControlRef() , GetwxWebKitCtrlEventHandlerUPP(),
|
InstallControlEventHandler( peer->GetControlRef() , GetwxWebKitCtrlEventHandlerUPP(),
|
||||||
GetEventTypeCount(eventList), eventList, this,
|
GetEventTypeCount(eventList), eventList, this,
|
||||||
(EventHandlerRef *)&m_webKitCtrlEventHandler);
|
(EventHandlerRef *)&m_webKitCtrlEventHandler);
|
||||||
|
@@ -155,9 +155,7 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
|
|||||||
(columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
|
(columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
|
||||||
(columnDescription.propertyDesc.propertyType == kDataBrowserTextType))
|
(columnDescription.propertyDesc.propertyType == kDataBrowserTextType))
|
||||||
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; // enables generally the possibility to have user input for the mentioned types
|
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; // enables generally the possibility to have user input for the mentioned types
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
|
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
|
||||||
#endif
|
|
||||||
// set header's properties:
|
// set header's properties:
|
||||||
columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
|
columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
|
||||||
columnDescription.headerBtnDesc.titleOffset = 0;
|
columnDescription.headerBtnDesc.titleOffset = 0;
|
||||||
|
@@ -262,24 +262,7 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
|
|||||||
|
|
||||||
const_cast<wxGLCanvas&>(win).SetViewport();
|
const_cast<wxGLCanvas&>(win).SetViewport();
|
||||||
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1050 )
|
|
||||||
{
|
|
||||||
aglSetWindowRef(m_glContext, win.MacGetTopLevelWindowRef());
|
aglSetWindowRef(m_glContext, win.MacGetTopLevelWindowRef());
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
AGLDrawable drawable = (AGLDrawable)GetWindowPort(
|
|
||||||
MAC_WXHWND(win.MacGetTopLevelWindowRef()));
|
|
||||||
|
|
||||||
if ( !aglSetDrawable(m_glContext, drawable) )
|
|
||||||
{
|
|
||||||
wxLogAGLError("aglSetDrawable");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return WXGLSetCurrentContext(m_glContext);
|
return WXGLSetCurrentContext(m_glContext);
|
||||||
}
|
}
|
||||||
@@ -354,17 +337,7 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
m_bufferName = gCurrentBufferName++;
|
m_bufferName = gCurrentBufferName++;
|
||||||
aglSetInteger (m_dummyContext, AGL_BUFFER_NAME, &m_bufferName);
|
aglSetInteger (m_dummyContext, AGL_BUFFER_NAME, &m_bufferName);
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1050 )
|
|
||||||
{
|
|
||||||
aglSetWindowRef(m_dummyContext, MacGetTopLevelWindowRef());
|
aglSetWindowRef(m_dummyContext, MacGetTopLevelWindowRef());
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
AGLDrawable drawable = (AGLDrawable)GetWindowPort(MAC_WXHWND(MacGetTopLevelWindowRef()));
|
|
||||||
aglSetDrawable(m_dummyContext, drawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_macCanvasIsShown = true;
|
m_macCanvasIsShown = true;
|
||||||
|
|
||||||
|
@@ -78,10 +78,6 @@ extern void wxOSXUnlockFocus( WXWidget view) ;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
|
||||||
|
|
||||||
// TODO test whether this private API also works under 10.3
|
|
||||||
|
|
||||||
// copying values from NSCompositingModes (see also webkit and cairo sources)
|
// copying values from NSCompositingModes (see also webkit and cairo sources)
|
||||||
|
|
||||||
typedef enum CGCompositeOperation {
|
typedef enum CGCompositeOperation {
|
||||||
@@ -106,8 +102,6 @@ extern "C"
|
|||||||
CG_EXTERN void CGContextSetCompositeOperation (CGContextRef context, int operation);
|
CG_EXTERN void CGContextSetCompositeOperation (CGContextRef context, int operation);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -2855,8 +2855,6 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
|||||||
HIThemeTextInfo info;
|
HIThemeTextInfo info;
|
||||||
bool setup = false;
|
bool setup = false;
|
||||||
#if wxOSX_USE_CORE_TEXT
|
#if wxOSX_USE_CORE_TEXT
|
||||||
if ( UMAGetSystemVersion() >= 0x1050 )
|
|
||||||
{
|
|
||||||
info.version = kHIThemeTextInfoVersionOne;
|
info.version = kHIThemeTextInfoVersionOne;
|
||||||
info.fontID = kThemeViewsFont;
|
info.fontID = kThemeViewsFont;
|
||||||
if (font.IsOk())
|
if (font.IsOk())
|
||||||
@@ -2865,7 +2863,6 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
|||||||
info.font = (CTFontRef) font.OSXGetCTFont();
|
info.font = (CTFontRef) font.OSXGetCTFont();
|
||||||
setup = true;
|
setup = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
if ( !setup )
|
if ( !setup )
|
||||||
|
@@ -1522,18 +1522,11 @@ void wxNonOwnedWindowCarbonImpl::Maximize(bool maximize)
|
|||||||
Point idealSize = { 0 , 0 } ;
|
Point idealSize = { 0 , 0 } ;
|
||||||
if ( maximize )
|
if ( maximize )
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
HIRect bounds ;
|
HIRect bounds ;
|
||||||
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
|
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
|
||||||
&bounds);
|
&bounds);
|
||||||
idealSize.h = bounds.size.width;
|
idealSize.h = bounds.size.width;
|
||||||
idealSize.v = bounds.size.height;
|
idealSize.v = bounds.size.height;
|
||||||
#else
|
|
||||||
Rect rect ;
|
|
||||||
GetAvailableWindowPositioningBounds(GetMainDevice(),&rect) ;
|
|
||||||
idealSize.h = rect.right - rect.left ;
|
|
||||||
idealSize.v = rect.bottom - rect.top ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
ZoomWindowIdeal( (WindowRef)GetWXWindow() , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
|
ZoomWindowIdeal( (WindowRef)GetWXWindow() , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
|
||||||
}
|
}
|
||||||
|
@@ -369,41 +369,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
|
|||||||
long style,
|
long style,
|
||||||
long WXUNUSED(extraStyle))
|
long WXUNUSED(extraStyle))
|
||||||
{
|
{
|
||||||
bool forceMLTE = false ;
|
return new wxMacMLTEHIViewControl( wxpeer , str , pos , size , style ) ;
|
||||||
|
|
||||||
#if wxUSE_SYSTEM_OPTIONS
|
|
||||||
if (wxSystemOptions::HasOption( wxMAC_TEXTCONTROL_USE_MLTE ) && (wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_MLTE ) == 1))
|
|
||||||
{
|
|
||||||
forceMLTE = true ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1050 )
|
|
||||||
forceMLTE = false;
|
|
||||||
|
|
||||||
wxMacControl* peer = NULL;
|
|
||||||
|
|
||||||
if ( !forceMLTE )
|
|
||||||
{
|
|
||||||
if ( style & wxTE_MULTILINE || ( UMAGetSystemVersion() >= 0x1050 ) )
|
|
||||||
peer = new wxMacMLTEHIViewControl( wxpeer , str , pos , size , style ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !peer )
|
|
||||||
{
|
|
||||||
if ( !(style & wxTE_MULTILINE) && !forceMLTE )
|
|
||||||
{
|
|
||||||
peer = new wxMacUnicodeTextControl( wxpeer , str , pos , size , style ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// the horizontal single line scrolling bug that made us keep the classic implementation
|
|
||||||
// is fixed in 10.5
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
|
||||||
if ( !peer )
|
|
||||||
peer = new wxMacMLTEClassicControl( wxpeer , str , pos , size , style ) ;
|
|
||||||
#endif
|
|
||||||
return peer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1467,674 +1433,6 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const
|
|||||||
return theLength ;
|
return theLength ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// MLTE control implementation (classic part)
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// OS X Notes : We still don't have a full replacement for MLTE, so this implementation
|
|
||||||
// has to live on. We have different problems coming from outdated implementations on the
|
|
||||||
// various OS X versions. Most deal with the scrollbars: they are not correctly embedded
|
|
||||||
// while this can be solved on 10.3 by reassigning them the correct place, on 10.2 there is
|
|
||||||
// no way out, therefore we are using our own implementation and our own scrollbars ....
|
|
||||||
|
|
||||||
TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
|
|
||||||
ControlActionUPP gTXNScrollActionProc = NULL ;
|
|
||||||
|
|
||||||
pascal void wxMacMLTEClassicControl::TXNScrollInfoProc(
|
|
||||||
SInt32 iValue, SInt32 iMaximumValue,
|
|
||||||
TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon )
|
|
||||||
{
|
|
||||||
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) iRefCon ;
|
|
||||||
SInt32 value = wxMax( iValue , 0 ) ;
|
|
||||||
SInt32 maximum = wxMax( iMaximumValue , 0 ) ;
|
|
||||||
|
|
||||||
if ( iScrollBarOrientation == kTXNHorizontal )
|
|
||||||
{
|
|
||||||
if ( mlte->m_sbHorizontal )
|
|
||||||
{
|
|
||||||
SetControl32BitValue( mlte->m_sbHorizontal , value ) ;
|
|
||||||
SetControl32BitMaximum( mlte->m_sbHorizontal , maximum ) ;
|
|
||||||
mlte->m_lastHorizontalValue = value ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( iScrollBarOrientation == kTXNVertical )
|
|
||||||
{
|
|
||||||
if ( mlte->m_sbVertical )
|
|
||||||
{
|
|
||||||
SetControl32BitValue( mlte->m_sbVertical , value ) ;
|
|
||||||
SetControl32BitMaximum( mlte->m_sbVertical , maximum ) ;
|
|
||||||
mlte->m_lastVerticalValue = value ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode )
|
|
||||||
{
|
|
||||||
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) GetControlReference( controlRef ) ;
|
|
||||||
if ( mlte == NULL )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if ( controlRef != mlte->m_sbVertical && controlRef != mlte->m_sbHorizontal )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
OSStatus err ;
|
|
||||||
bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ;
|
|
||||||
|
|
||||||
SInt32 minimum = 0 ;
|
|
||||||
SInt32 maximum = GetControl32BitMaximum( controlRef ) ;
|
|
||||||
SInt32 value = GetControl32BitValue( controlRef ) ;
|
|
||||||
SInt32 delta = 0;
|
|
||||||
|
|
||||||
switch ( partCode )
|
|
||||||
{
|
|
||||||
case kControlDownButtonPart :
|
|
||||||
delta = 10 ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case kControlUpButtonPart :
|
|
||||||
delta = -10 ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case kControlPageDownPart :
|
|
||||||
delta = GetControlViewSize( controlRef ) ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case kControlPageUpPart :
|
|
||||||
delta = -GetControlViewSize( controlRef ) ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case kControlIndicatorPart :
|
|
||||||
delta = value - (isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue) ;
|
|
||||||
break ;
|
|
||||||
|
|
||||||
default :
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( delta != 0 )
|
|
||||||
{
|
|
||||||
SInt32 newValue = value ;
|
|
||||||
|
|
||||||
if ( partCode != kControlIndicatorPart )
|
|
||||||
{
|
|
||||||
if ( value + delta < minimum )
|
|
||||||
delta = minimum - value ;
|
|
||||||
if ( value + delta > maximum )
|
|
||||||
delta = maximum - value ;
|
|
||||||
|
|
||||||
SetControl32BitValue( controlRef , value + delta ) ;
|
|
||||||
newValue = value + delta ;
|
|
||||||
}
|
|
||||||
|
|
||||||
SInt32 verticalDelta = isHorizontal ? 0 : delta ;
|
|
||||||
SInt32 horizontalDelta = isHorizontal ? delta : 0 ;
|
|
||||||
|
|
||||||
err = TXNScroll(
|
|
||||||
mlte->m_txn, kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels,
|
|
||||||
&verticalDelta, &horizontalDelta );
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
if ( isHorizontal )
|
|
||||||
mlte->m_lastHorizontalValue = newValue ;
|
|
||||||
else
|
|
||||||
mlte->m_lastVerticalValue = newValue ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// make correct activations
|
|
||||||
void wxMacMLTEClassicControl::MacActivatePaneText(bool setActive)
|
|
||||||
{
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
|
|
||||||
|
|
||||||
wxMacWindowClipper clipper( textctrl ) ;
|
|
||||||
TXNActivate( m_txn, m_txnFrameID, setActive );
|
|
||||||
|
|
||||||
ControlRef controlFocus = 0 ;
|
|
||||||
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
|
|
||||||
if ( controlFocus == m_controlRef )
|
|
||||||
TXNFocus( m_txn, setActive );
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacFocusPaneText(bool setFocus)
|
|
||||||
{
|
|
||||||
TXNFocus( m_txn, setFocus );
|
|
||||||
}
|
|
||||||
|
|
||||||
// guards against inappropriate redraw (hidden objects drawing onto window)
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacSetObjectVisibility(bool vis)
|
|
||||||
{
|
|
||||||
ControlRef controlFocus = 0 ;
|
|
||||||
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
|
|
||||||
|
|
||||||
if ( !vis && (controlFocus == m_controlRef ) )
|
|
||||||
SetKeyboardFocus( m_txnWindow , m_controlRef , kControlFocusNoPart ) ;
|
|
||||||
|
|
||||||
TXNControlTag iControlTags[1] = { kTXNVisibilityTag };
|
|
||||||
TXNControlData iControlData[1] = { { (UInt32)false } };
|
|
||||||
|
|
||||||
verify_noerr( TXNGetTXNObjectControls( m_txn , 1, iControlTags, iControlData ) ) ;
|
|
||||||
|
|
||||||
if ( iControlData[0].uValue != vis )
|
|
||||||
{
|
|
||||||
iControlData[0].uValue = vis ;
|
|
||||||
verify_noerr( TXNSetTXNObjectControls( m_txn, false , 1, iControlTags, iControlData ) ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// currently, we always clip as partial visibility (overlapped) visibility is also a problem,
|
|
||||||
// if we run into further problems we might set the FrameBounds to an empty rect here
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure that the TXNObject is at the right position
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacUpdatePosition()
|
|
||||||
{
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
|
|
||||||
if ( textctrl == NULL )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
Rect bounds ;
|
|
||||||
GetRectInWindowCoords( &bounds );
|
|
||||||
|
|
||||||
wxRect visRect = textctrl->MacGetClippedClientRect() ;
|
|
||||||
Rect visBounds = { visRect.y , visRect.x , visRect.y + visRect.height , visRect.x + visRect.width } ;
|
|
||||||
int x , y ;
|
|
||||||
x = y = 0 ;
|
|
||||||
textctrl->MacWindowToRootWindow( &x , &y ) ;
|
|
||||||
OffsetRect( &visBounds , x , y ) ;
|
|
||||||
|
|
||||||
if ( !EqualRect( &bounds, &m_txnControlBounds ) || !EqualRect( &visBounds, &m_txnVisBounds ) )
|
|
||||||
{
|
|
||||||
m_txnControlBounds = bounds ;
|
|
||||||
m_txnVisBounds = visBounds ;
|
|
||||||
wxMacWindowClipper cl( textctrl ) ;
|
|
||||||
|
|
||||||
if ( m_sbHorizontal || m_sbVertical )
|
|
||||||
{
|
|
||||||
int w = bounds.right - bounds.left ;
|
|
||||||
int h = bounds.bottom - bounds.top ;
|
|
||||||
|
|
||||||
if ( m_sbHorizontal )
|
|
||||||
{
|
|
||||||
Rect sbBounds ;
|
|
||||||
|
|
||||||
sbBounds.left = -1 ;
|
|
||||||
sbBounds.top = h - 14 ;
|
|
||||||
sbBounds.right = w + 1 ;
|
|
||||||
sbBounds.bottom = h + 1 ;
|
|
||||||
|
|
||||||
SetControlBounds( m_sbHorizontal , &sbBounds ) ;
|
|
||||||
SetControlViewSize( m_sbHorizontal , w ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_sbVertical )
|
|
||||||
{
|
|
||||||
Rect sbBounds ;
|
|
||||||
|
|
||||||
sbBounds.left = w - 14 ;
|
|
||||||
sbBounds.top = -1 ;
|
|
||||||
sbBounds.right = w + 1 ;
|
|
||||||
sbBounds.bottom = m_sbHorizontal ? h - 14 : h + 1 ;
|
|
||||||
|
|
||||||
SetControlBounds( m_sbVertical , &sbBounds ) ;
|
|
||||||
SetControlViewSize( m_sbVertical , h ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect oldviewRect ;
|
|
||||||
TXNLongRect olddestRect ;
|
|
||||||
TXNGetRectBounds( m_txn , &oldviewRect , &olddestRect , NULL ) ;
|
|
||||||
|
|
||||||
Rect viewRect = { m_txnControlBounds.top, m_txnControlBounds.left,
|
|
||||||
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
|
|
||||||
m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
|
|
||||||
TXNLongRect destRect = { m_txnControlBounds.top, m_txnControlBounds.left,
|
|
||||||
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
|
|
||||||
m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
|
|
||||||
|
|
||||||
if ( olddestRect.right >= 10000 )
|
|
||||||
destRect.right = destRect.left + 32000 ;
|
|
||||||
|
|
||||||
if ( olddestRect.bottom >= 0x20000000 )
|
|
||||||
destRect.bottom = destRect.top + 0x40000000 ;
|
|
||||||
|
|
||||||
SectRect( &viewRect , &visBounds , &viewRect ) ;
|
|
||||||
TXNSetRectBounds( m_txn , &viewRect , &destRect , true ) ;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
TXNSetFrameBounds(
|
|
||||||
m_txn,
|
|
||||||
m_txnControlBounds.top,
|
|
||||||
m_txnControlBounds.left,
|
|
||||||
m_txnControlBounds.bottom - (m_sbHorizontal ? 14 : 0),
|
|
||||||
m_txnControlBounds.right - (m_sbVertical ? 14 : 0),
|
|
||||||
m_txnFrameID );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// the SetFrameBounds method under Classic sometimes does not correctly scroll a selection into sight after a
|
|
||||||
// movement, therefore we have to force it
|
|
||||||
|
|
||||||
// this problem has been reported in OSX as well, so we use this here once again
|
|
||||||
|
|
||||||
TXNLongRect textRect ;
|
|
||||||
TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ;
|
|
||||||
if ( textRect.left < m_txnControlBounds.left )
|
|
||||||
TXNShowSelection( m_txn , kTXNShowStart ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::Move(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
wxMacControl::Move(x,y,width,height) ;
|
|
||||||
MacUpdatePosition() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacControlUserPaneDrawProc(wxInt16 WXUNUSED(thePart))
|
|
||||||
{
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
|
|
||||||
if ( textctrl == NULL )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if ( textctrl->IsShownOnScreen() )
|
|
||||||
{
|
|
||||||
wxMacWindowClipper clipper( textctrl ) ;
|
|
||||||
TXNDraw( m_txn , NULL ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y)
|
|
||||||
{
|
|
||||||
Point where = { y , x } ;
|
|
||||||
ControlPartCode result = kControlNoPart;
|
|
||||||
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference( m_controlRef );
|
|
||||||
if ( (textctrl != NULL) && textctrl->IsShownOnScreen() )
|
|
||||||
{
|
|
||||||
if (PtInRect( where, &m_txnControlBounds ))
|
|
||||||
{
|
|
||||||
result = kControlEditTextPart ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// sometimes we get the coords also in control local coordinates, therefore test again
|
|
||||||
int x = 0 , y = 0 ;
|
|
||||||
textctrl->MacClientToRootWindow( &x , &y ) ;
|
|
||||||
where.h += x ;
|
|
||||||
where.v += y ;
|
|
||||||
|
|
||||||
if (PtInRect( where, &m_txnControlBounds ))
|
|
||||||
result = kControlEditTextPart ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxInt16 y, void* WXUNUSED(actionProc) )
|
|
||||||
{
|
|
||||||
ControlPartCode result = kControlNoPart;
|
|
||||||
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference( m_controlRef );
|
|
||||||
if ( (textctrl != NULL) && textctrl->IsShownOnScreen() )
|
|
||||||
{
|
|
||||||
Point startPt = { y , x } ;
|
|
||||||
|
|
||||||
// for compositing, we must convert these into toplevel window coordinates, because hittesting expects them
|
|
||||||
int x = 0 , y = 0 ;
|
|
||||||
textctrl->MacClientToRootWindow( &x , &y ) ;
|
|
||||||
startPt.h += x ;
|
|
||||||
startPt.v += y ;
|
|
||||||
|
|
||||||
switch (MacControlUserPaneHitTestProc( startPt.h , startPt.v ))
|
|
||||||
{
|
|
||||||
case kControlEditTextPart :
|
|
||||||
{
|
|
||||||
wxMacWindowClipper clipper( textctrl ) ;
|
|
||||||
EventRecord rec ;
|
|
||||||
|
|
||||||
ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
|
|
||||||
TXNClick( m_txn, &rec );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacControlUserPaneIdleProc()
|
|
||||||
{
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
|
|
||||||
if ( textctrl == NULL )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if (textctrl->IsShownOnScreen())
|
|
||||||
{
|
|
||||||
if (IsControlActive(m_controlRef))
|
|
||||||
{
|
|
||||||
Point mousep;
|
|
||||||
|
|
||||||
wxMacWindowClipper clipper( textctrl ) ;
|
|
||||||
GetMouse(&mousep);
|
|
||||||
|
|
||||||
TXNIdle(m_txn);
|
|
||||||
|
|
||||||
if (PtInRect(mousep, &m_txnControlBounds))
|
|
||||||
{
|
|
||||||
RgnHandle theRgn = NewRgn();
|
|
||||||
RectRgn(theRgn, &m_txnControlBounds);
|
|
||||||
TXNAdjustCursor(m_txn, theRgn);
|
|
||||||
DisposeRgn(theRgn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
|
|
||||||
{
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
|
|
||||||
if ( textctrl == NULL )
|
|
||||||
return kControlNoPart;
|
|
||||||
|
|
||||||
wxMacWindowClipper clipper( textctrl ) ;
|
|
||||||
|
|
||||||
EventRecord ev ;
|
|
||||||
memset( &ev , 0 , sizeof( ev ) ) ;
|
|
||||||
ev.what = keyDown ;
|
|
||||||
ev.modifiers = modifiers ;
|
|
||||||
ev.message = ((keyCode << 8) & keyCodeMask) | (charCode & charCodeMask);
|
|
||||||
TXNKeyDown( m_txn , &ev );
|
|
||||||
|
|
||||||
return kControlEntireControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacControlUserPaneActivateProc(bool activating)
|
|
||||||
{
|
|
||||||
MacActivatePaneText( activating );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action)
|
|
||||||
{
|
|
||||||
ControlPartCode focusResult = kControlFocusNoPart;
|
|
||||||
|
|
||||||
wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
|
|
||||||
if ( textctrl == NULL )
|
|
||||||
return focusResult;
|
|
||||||
|
|
||||||
wxMacWindowClipper clipper( textctrl ) ;
|
|
||||||
|
|
||||||
ControlRef controlFocus = NULL ;
|
|
||||||
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
|
|
||||||
bool wasFocused = ( controlFocus == m_controlRef ) ;
|
|
||||||
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case kControlFocusPrevPart:
|
|
||||||
case kControlFocusNextPart:
|
|
||||||
MacFocusPaneText( !wasFocused );
|
|
||||||
focusResult = (!wasFocused ? (ControlPartCode) kControlEditTextPart : (ControlPartCode) kControlFocusNoPart);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kControlFocusNoPart:
|
|
||||||
default:
|
|
||||||
MacFocusPaneText( false );
|
|
||||||
focusResult = kControlFocusNoPart;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return focusResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::MacControlUserPaneBackgroundProc( void *WXUNUSED(info) )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
|
|
||||||
const wxString& str,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size, long style )
|
|
||||||
: wxMacMLTEControl( wxPeer )
|
|
||||||
{
|
|
||||||
m_font = wxPeer->GetFont() ;
|
|
||||||
m_windowStyle = style ;
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
|
|
||||||
|
|
||||||
short featureSet =
|
|
||||||
kControlSupportsEmbedding | kControlSupportsFocus | kControlWantsIdle
|
|
||||||
| kControlWantsActivate | kControlHandlesTracking
|
|
||||||
// | kControlHasSpecialBackground
|
|
||||||
| kControlGetsFocusOnClick | kControlSupportsLiveFeedback;
|
|
||||||
|
|
||||||
OSStatus err = ::CreateUserPaneControl(
|
|
||||||
MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()),
|
|
||||||
&bounds, featureSet, &m_controlRef );
|
|
||||||
verify_noerr( err );
|
|
||||||
SetControlReference( m_controlRef , (URefCon) wxPeer );
|
|
||||||
|
|
||||||
DoCreate();
|
|
||||||
|
|
||||||
AdjustCreationAttributes( *wxWHITE , true ) ;
|
|
||||||
|
|
||||||
MacSetObjectVisibility( wxPeer->IsShownOnScreen() ) ;
|
|
||||||
|
|
||||||
{
|
|
||||||
wxString st = str ;
|
|
||||||
wxMacConvertNewlines10To13( &st ) ;
|
|
||||||
wxMacWindowClipper clipper( GetWXPeer() ) ;
|
|
||||||
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
|
|
||||||
TXNSetSelection( m_txn, 0, 0 ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacMLTEClassicControl::~wxMacMLTEClassicControl()
|
|
||||||
{
|
|
||||||
TXNDeleteObject( m_txn );
|
|
||||||
m_txn = NULL ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::VisibilityChanged(bool shown)
|
|
||||||
{
|
|
||||||
MacSetObjectVisibility( shown ) ;
|
|
||||||
wxMacControl::VisibilityChanged( shown ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacMLTEClassicControl::SuperChangedPosition()
|
|
||||||
{
|
|
||||||
MacUpdatePosition() ;
|
|
||||||
wxMacControl::SuperChangedPosition() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlUserPaneDrawUPP gTPDrawProc = NULL;
|
|
||||||
ControlUserPaneHitTestUPP gTPHitProc = NULL;
|
|
||||||
ControlUserPaneTrackingUPP gTPTrackProc = NULL;
|
|
||||||
ControlUserPaneIdleUPP gTPIdleProc = NULL;
|
|
||||||
ControlUserPaneKeyDownUPP gTPKeyProc = NULL;
|
|
||||||
ControlUserPaneActivateUPP gTPActivateProc = NULL;
|
|
||||||
ControlUserPaneFocusUPP gTPFocusProc = NULL;
|
|
||||||
|
|
||||||
static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
win->MacControlUserPaneDrawProc( part ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control, Point where)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
return win->MacControlUserPaneHitTestProc( where.h , where.v ) ;
|
|
||||||
else
|
|
||||||
return kControlNoPart ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef control, Point startPt, ControlActionUPP actionProc)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
return win->MacControlUserPaneTrackingProc( startPt.h , startPt.v , (void*) actionProc ) ;
|
|
||||||
else
|
|
||||||
return kControlNoPart ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
win->MacControlUserPaneIdleProc() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
return win->MacControlUserPaneKeyDownProc( keyCode, charCode, modifiers ) ;
|
|
||||||
else
|
|
||||||
return kControlNoPart ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean activating)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget)control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
win->MacControlUserPaneActivateProc( activating ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control, ControlFocusPart action)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
return win->MacControlUserPaneFocusProc( action ) ;
|
|
||||||
else
|
|
||||||
return kControlNoPart ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info)
|
|
||||||
{
|
|
||||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget(control) , wxTextCtrl ) ;
|
|
||||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
|
||||||
if ( win )
|
|
||||||
win->MacControlUserPaneBackgroundProc(info) ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TXNRegisterScrollInfoProc
|
|
||||||
|
|
||||||
OSStatus wxMacMLTEClassicControl::DoCreate()
|
|
||||||
{
|
|
||||||
Rect bounds;
|
|
||||||
OSStatus err = noErr ;
|
|
||||||
|
|
||||||
// set up our globals
|
|
||||||
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc);
|
|
||||||
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc);
|
|
||||||
if (gTPTrackProc == NULL) gTPTrackProc = NewControlUserPaneTrackingUPP(wxMacControlUserPaneTrackingProc);
|
|
||||||
if (gTPIdleProc == NULL) gTPIdleProc = NewControlUserPaneIdleUPP(wxMacControlUserPaneIdleProc);
|
|
||||||
if (gTPKeyProc == NULL) gTPKeyProc = NewControlUserPaneKeyDownUPP(wxMacControlUserPaneKeyDownProc);
|
|
||||||
if (gTPActivateProc == NULL) gTPActivateProc = NewControlUserPaneActivateUPP(wxMacControlUserPaneActivateProc);
|
|
||||||
if (gTPFocusProc == NULL) gTPFocusProc = NewControlUserPaneFocusUPP(wxMacControlUserPaneFocusProc);
|
|
||||||
|
|
||||||
if (gTXNScrollInfoProc == NULL ) gTXNScrollInfoProc = NewTXNScrollInfoUPP(TXNScrollInfoProc) ;
|
|
||||||
if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ;
|
|
||||||
|
|
||||||
// set the initial settings for our private data
|
|
||||||
|
|
||||||
m_txnWindow = GetControlOwner(m_controlRef);
|
|
||||||
m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow);
|
|
||||||
|
|
||||||
// set up the user pane procedures
|
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
|
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
|
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneTrackingProcTag, sizeof(gTPTrackProc), &gTPTrackProc);
|
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneIdleProcTag, sizeof(gTPIdleProc), &gTPIdleProc);
|
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc);
|
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
|
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
|
||||||
|
|
||||||
// calculate the rectangles used by the control
|
|
||||||
GetRectInWindowCoords( &bounds );
|
|
||||||
|
|
||||||
m_txnControlBounds = bounds ;
|
|
||||||
m_txnVisBounds = bounds ;
|
|
||||||
|
|
||||||
CGrafPtr origPort ;
|
|
||||||
GDHandle origDev ;
|
|
||||||
|
|
||||||
GetGWorld( &origPort, &origDev ) ;
|
|
||||||
SetPort( m_txnPort );
|
|
||||||
|
|
||||||
// create the new edit field
|
|
||||||
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle );
|
|
||||||
|
|
||||||
// the scrollbars are not correctly embedded but are inserted at the root:
|
|
||||||
// this gives us problems as we have erratic redraws even over the structure area
|
|
||||||
|
|
||||||
m_sbHorizontal = 0 ;
|
|
||||||
m_sbVertical = 0 ;
|
|
||||||
m_lastHorizontalValue = 0 ;
|
|
||||||
m_lastVerticalValue = 0 ;
|
|
||||||
|
|
||||||
Rect sb = { 0 , 0 , 0 , 0 } ;
|
|
||||||
if ( frameOptions & kTXNWantVScrollBarMask )
|
|
||||||
{
|
|
||||||
CreateScrollBarControl( m_txnWindow, &sb, 0, 0, 100, 1, true, gTXNScrollActionProc, &m_sbVertical );
|
|
||||||
SetControlReference( m_sbVertical, (SInt32)this );
|
|
||||||
SetControlAction( m_sbVertical, gTXNScrollActionProc );
|
|
||||||
ShowControl( m_sbVertical );
|
|
||||||
EmbedControl( m_sbVertical , m_controlRef );
|
|
||||||
frameOptions &= ~kTXNWantVScrollBarMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( frameOptions & kTXNWantHScrollBarMask )
|
|
||||||
{
|
|
||||||
CreateScrollBarControl( m_txnWindow, &sb, 0, 0, 100, 1, true, gTXNScrollActionProc, &m_sbHorizontal );
|
|
||||||
SetControlReference( m_sbHorizontal, (SInt32)this );
|
|
||||||
SetControlAction( m_sbHorizontal, gTXNScrollActionProc );
|
|
||||||
ShowControl( m_sbHorizontal );
|
|
||||||
EmbedControl( m_sbHorizontal, m_controlRef );
|
|
||||||
frameOptions &= ~(kTXNWantHScrollBarMask | kTXNDrawGrowIconMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
err = TXNNewObject(
|
|
||||||
NULL, m_txnWindow, &bounds, frameOptions,
|
|
||||||
kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding,
|
|
||||||
&m_txn, &m_txnFrameID, NULL );
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
TXNControlTag iControlTags[] = { kTXNUseCarbonEvents };
|
|
||||||
TXNControlData iControlData[] = { { (UInt32)&cInfo } };
|
|
||||||
int toptag = WXSIZEOF( iControlTags ) ;
|
|
||||||
TXNCarbonEventInfo cInfo ;
|
|
||||||
cInfo.useCarbonEvents = false ;
|
|
||||||
cInfo.filler = 0 ;
|
|
||||||
cInfo.flags = 0 ;
|
|
||||||
cInfo.fDictionary = NULL ;
|
|
||||||
|
|
||||||
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32)this );
|
|
||||||
|
|
||||||
SetGWorld( origPort , origDev ) ;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MLTE control implementation (OSX part)
|
// MLTE control implementation (OSX part)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -113,14 +113,6 @@ public:
|
|||||||
if ( m_toolbarItemRef )
|
if ( m_toolbarItemRef )
|
||||||
{
|
{
|
||||||
CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
|
CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
|
||||||
// different behaviour under Leopard
|
|
||||||
if ( UMAGetSystemVersion() < 0x1050 )
|
|
||||||
{
|
|
||||||
if ( count != 1 )
|
|
||||||
{
|
|
||||||
wxFAIL_MSG("Reference count of native tool was not 1 in wxToolBarTool destructor");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wxTheApp->MacAddToAutorelease(m_toolbarItemRef);
|
wxTheApp->MacAddToAutorelease(m_toolbarItemRef);
|
||||||
CFRelease(m_toolbarItemRef);
|
CFRelease(m_toolbarItemRef);
|
||||||
m_toolbarItemRef = NULL;
|
m_toolbarItemRef = NULL;
|
||||||
@@ -941,14 +933,6 @@ wxToolBar::~wxToolBar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CFIndex count = CFGetRetainCount( m_macToolbar ) ;
|
CFIndex count = CFGetRetainCount( m_macToolbar ) ;
|
||||||
// Leopard seems to have one refcount more, so we cannot check reliably at the moment
|
|
||||||
if ( UMAGetSystemVersion() < 0x1050 )
|
|
||||||
{
|
|
||||||
if ( count != 1 )
|
|
||||||
{
|
|
||||||
wxFAIL_MSG("Reference count of native control was not 1 in wxToolBar destructor");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CFRelease( (HIToolbarRef)m_macToolbar );
|
CFRelease( (HIToolbarRef)m_macToolbar );
|
||||||
m_macToolbar = NULL;
|
m_macToolbar = NULL;
|
||||||
#endif // wxOSX_USE_NATIVE_TOOLBAR
|
#endif // wxOSX_USE_NATIVE_TOOLBAR
|
||||||
@@ -1619,23 +1603,11 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
|||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap() );
|
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap() );
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000)
|
|
||||||
{
|
|
||||||
// contrary to the docs this control only works with iconrefs
|
// contrary to the docs this control only works with iconrefs
|
||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef );
|
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef );
|
||||||
CreateIconControl( window, &toolrect, &info, false, &controlHandle );
|
CreateIconControl( window, &toolrect, &info, false, &controlHandle );
|
||||||
wxMacReleaseBitmapButton( &info );
|
wxMacReleaseBitmapButton( &info );
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SInt16 behaviour = kControlBehaviorOffsetContents;
|
|
||||||
if ( tool->CanBeToggled() )
|
|
||||||
behaviour |= kControlBehaviorToggles;
|
|
||||||
err = CreateBevelButtonControl( window,
|
|
||||||
&toolrect, CFSTR(""), kControlBevelButtonNormalBevel,
|
|
||||||
behaviour, &info, 0, 0, 0, &controlHandle );
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxOSX_USE_NATIVE_TOOLBAR
|
#if wxOSX_USE_NATIVE_TOOLBAR
|
||||||
if (m_macToolbar != NULL)
|
if (m_macToolbar != NULL)
|
||||||
|
@@ -33,9 +33,7 @@
|
|||||||
|
|
||||||
// #include "MoreFilesX.h"
|
// #include "MoreFilesX.h"
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
#include <AudioToolbox/AudioServices.h>
|
#include <AudioToolbox/AudioServices.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
@@ -49,17 +47,8 @@
|
|||||||
// Emit a beeeeeep
|
// Emit a beeeeeep
|
||||||
void wxBell()
|
void wxBell()
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
if ( AudioServicesPlayAlertSound != NULL )
|
if ( AudioServicesPlayAlertSound != NULL )
|
||||||
AudioServicesPlayAlertSound(kUserPreferredAlert);
|
AudioServicesPlayAlertSound(kUserPreferredAlert);
|
||||||
else
|
|
||||||
#endif
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
|
||||||
AlertSoundPlay();
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
|
wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
|
||||||
@@ -156,7 +145,6 @@ void wxGetMousePosition( int* x, int* y )
|
|||||||
|
|
||||||
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
HIRect bounds ;
|
HIRect bounds ;
|
||||||
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
|
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
|
||||||
&bounds);
|
&bounds);
|
||||||
@@ -168,18 +156,6 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
|||||||
*width = bounds.size.width;
|
*width = bounds.size.width;
|
||||||
if ( height )
|
if ( height )
|
||||||
*height = bounds.size.height;
|
*height = bounds.size.height;
|
||||||
#else
|
|
||||||
Rect r;
|
|
||||||
GetAvailableWindowPositioningBounds( GetMainDevice() , &r );
|
|
||||||
if ( x )
|
|
||||||
*x = r.left;
|
|
||||||
if ( y )
|
|
||||||
*y = r.top;
|
|
||||||
if ( width )
|
|
||||||
*width = r.right - r.left;
|
|
||||||
if ( height )
|
|
||||||
*height = r.bottom - r.top;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
@@ -299,11 +299,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
case kEventControlFocusPartChanged :
|
case kEventControlFocusPartChanged :
|
||||||
// the event is emulated by wxmac for systems lower than 10.5
|
// the event is emulated by wxmac for systems lower than 10.5
|
||||||
{
|
{
|
||||||
if ( UMAGetSystemVersion() < 0x1050 )
|
|
||||||
{
|
|
||||||
// as it is synthesized here, we have to manually avoid propagation
|
|
||||||
result = noErr;
|
|
||||||
}
|
|
||||||
ControlPartCode previousControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPreviousPart , typeControlPartCode );
|
ControlPartCode previousControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPreviousPart , typeControlPartCode );
|
||||||
ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlCurrentPart , typeControlPartCode );
|
ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlCurrentPart , typeControlPartCode );
|
||||||
|
|
||||||
@@ -387,76 +382,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = CallNextEventHandler(handler, event);
|
result = CallNextEventHandler(handler, event);
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() < 0x1050 )
|
|
||||||
{
|
|
||||||
// set back to 0 if problems arise
|
|
||||||
#if 1
|
|
||||||
if ( result == noErr )
|
|
||||||
{
|
|
||||||
ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
|
||||||
// synthesize the event focus changed event
|
|
||||||
EventRef evRef = NULL ;
|
|
||||||
|
|
||||||
OSStatus err = MacCreateEvent(
|
|
||||||
NULL , kEventClassControl , kEventControlFocusPartChanged , TicksToEventTime( TickCount() ) ,
|
|
||||||
kEventAttributeUserEvent , &evRef );
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
wxMacCarbonEvent iEvent( evRef ) ;
|
|
||||||
iEvent.SetParameter<ControlRef>( kEventParamDirectObject , controlRef );
|
|
||||||
iEvent.SetParameter<EventTargetRef>( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) );
|
|
||||||
iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart );
|
|
||||||
iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart );
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// TODO test this first, avoid double posts etc...
|
|
||||||
PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
|
|
||||||
#else
|
|
||||||
wxMacWindowControlEventHandler( NULL , evRef , data ) ;
|
|
||||||
#endif
|
|
||||||
ReleaseEvent( evRef ) ;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
// old implementation, to be removed if the new one works
|
|
||||||
if ( controlPart == kControlFocusNoPart )
|
|
||||||
{
|
|
||||||
#if wxUSE_CARET
|
|
||||||
if ( thisWindow->GetCaret() )
|
|
||||||
thisWindow->GetCaret()->OnKillFocus();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxLogTrace(wxT("Focus"), wxT("focus lost(%p)"), static_cast<void*>(thisWindow));
|
|
||||||
|
|
||||||
static bool inKillFocusEvent = false ;
|
|
||||||
|
|
||||||
if ( !inKillFocusEvent )
|
|
||||||
{
|
|
||||||
inKillFocusEvent = true ;
|
|
||||||
wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId());
|
|
||||||
event.SetEventObject(thisWindow);
|
|
||||||
thisWindow->HandleWindowEvent(event) ;
|
|
||||||
inKillFocusEvent = false ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// panel wants to track the window which was the last to have focus in it
|
|
||||||
wxLogTrace(wxT("Focus"), wxT("focus set(%p)"), static_cast<void*>(thisWindow));
|
|
||||||
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
|
|
||||||
thisWindow->HandleWindowEvent(eventFocus);
|
|
||||||
|
|
||||||
#if wxUSE_CARET
|
|
||||||
if ( thisWindow->GetCaret() )
|
|
||||||
thisWindow->GetCaret()->OnSetFocus();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId());
|
|
||||||
event.SetEventObject(thisWindow);
|
|
||||||
thisWindow->HandleWindowEvent(event) ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
@@ -1136,19 +1061,10 @@ void wxMacControl::SetCursor(const wxCursor& cursor)
|
|||||||
ControlPartCode part ;
|
ControlPartCode part ;
|
||||||
ControlRef control ;
|
ControlRef control ;
|
||||||
Point pt ;
|
Point pt ;
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
HIPoint hiPoint ;
|
HIPoint hiPoint ;
|
||||||
HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint);
|
HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint);
|
||||||
pt.h = hiPoint.x;
|
pt.h = hiPoint.x;
|
||||||
pt.v = hiPoint.y;
|
pt.v = hiPoint.y;
|
||||||
#else
|
|
||||||
GetGlobalMouse( &pt );
|
|
||||||
int x = pt.h;
|
|
||||||
int y = pt.v;
|
|
||||||
tlwwx->ScreenToClient(&x, &y);
|
|
||||||
pt.h = x;
|
|
||||||
pt.v = y;
|
|
||||||
#endif
|
|
||||||
control = FindControlUnderMouse( pt , window , &part ) ;
|
control = FindControlUnderMouse( pt , window , &part ) ;
|
||||||
if ( control )
|
if ( control )
|
||||||
mouseWin = wxFindWindowFromWXWidget( (WXWidget) control ) ;
|
mouseWin = wxFindWindowFromWXWidget( (WXWidget) control ) ;
|
||||||
@@ -1263,8 +1179,6 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l
|
|||||||
{
|
{
|
||||||
m_font = font;
|
m_font = font;
|
||||||
#if wxOSX_USE_CORE_TEXT
|
#if wxOSX_USE_CORE_TEXT
|
||||||
if ( UMAGetSystemVersion() >= 0x1050 )
|
|
||||||
{
|
|
||||||
HIViewPartCode part = 0;
|
HIViewPartCode part = 0;
|
||||||
HIThemeTextHorizontalFlush flush = kHIThemeTextHorizontalFlushDefault;
|
HIThemeTextHorizontalFlush flush = kHIThemeTextHorizontalFlushDefault;
|
||||||
if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL )
|
if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL )
|
||||||
@@ -1281,7 +1195,6 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l
|
|||||||
fontStyle.flags = kControlUseForeColorMask;
|
fontStyle.flags = kControlUseForeColorMask;
|
||||||
::SetControlFontStyle( m_controlRef , &fontStyle );
|
::SetControlFontStyle( m_controlRef , &fontStyle );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
#if wxOSX_USE_ATSU_TEXT
|
||||||
ControlFontStyleRec fontStyle;
|
ControlFontStyleRec fontStyle;
|
||||||
|
@@ -367,10 +367,8 @@ NSTableColumn* CreateNativeColumn(const wxDataViewColumn *column)
|
|||||||
}
|
}
|
||||||
[nativeColumn setResizingMask:resizingMask];
|
[nativeColumn setResizingMask:resizingMask];
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
// setting the visibility:
|
// setting the visibility:
|
||||||
[nativeColumn setHidden:static_cast<BOOL>(column->IsHidden())];
|
[nativeColumn setHidden:static_cast<BOOL>(column->IsHidden())];
|
||||||
#endif
|
|
||||||
|
|
||||||
wxDataViewRendererNativeData * const renderData = renderer->GetNativeData();
|
wxDataViewRendererNativeData * const renderData = renderer->GetNativeData();
|
||||||
|
|
||||||
@@ -1486,7 +1484,6 @@ outlineView:(NSOutlineView*)outlineView
|
|||||||
[super editWithFrame:textFrame inView:controlView editor:textObj delegate:anObject event:theEvent];
|
[super editWithFrame:textFrame inView:controlView editor:textObj delegate:anObject event:theEvent];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
-(NSUInteger) hitTestForEvent:(NSEvent*)event inRect:(NSRect)cellFrame ofView:(NSView*)controlView
|
-(NSUInteger) hitTestForEvent:(NSEvent*)event inRect:(NSRect)cellFrame ofView:(NSView*)controlView
|
||||||
{
|
{
|
||||||
NSPoint point = [controlView convertPoint:[event locationInWindow] fromView:nil];
|
NSPoint point = [controlView convertPoint:[event locationInWindow] fromView:nil];
|
||||||
@@ -1528,7 +1525,6 @@ outlineView:(NSOutlineView*)outlineView
|
|||||||
|
|
||||||
return [super hitTestForEvent:event inRect:textFrame ofView:controlView];
|
return [super hitTestForEvent:event inRect:textFrame ofView:controlView];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
-(NSRect) imageRectForBounds:(NSRect)cellFrame
|
-(NSRect) imageRectForBounds:(NSRect)cellFrame
|
||||||
{
|
{
|
||||||
@@ -2060,7 +2056,6 @@ bool wxCocoaDataViewControl::InsertColumn(unsigned int pos, wxDataViewColumn* co
|
|||||||
|
|
||||||
void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
const int count = GetCount();
|
const int count = GetCount();
|
||||||
NSTableColumn *column = GetColumn(pos)->GetNativeData()->GetNativeColumnPtr();
|
NSTableColumn *column = GetColumn(pos)->GetNativeData()->GetNativeColumnPtr();
|
||||||
|
|
||||||
@@ -2173,7 +2168,6 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[column setWidth:calculator.GetMaxWidth()];
|
[column setWidth:calculator.GetMaxWidth()];
|
||||||
#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -3295,15 +3289,13 @@ void wxDataViewColumn::SetWidth(int width)
|
|||||||
switch ( width )
|
switch ( width )
|
||||||
{
|
{
|
||||||
case wxCOL_WIDTH_AUTOSIZE:
|
case wxCOL_WIDTH_AUTOSIZE:
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
|
||||||
if ( GetOwner() )
|
if ( GetOwner() )
|
||||||
{
|
{
|
||||||
wxCocoaDataViewControl *peer = static_cast<wxCocoaDataViewControl*>(GetOwner()->GetPeer());
|
wxCocoaDataViewControl *peer = static_cast<wxCocoaDataViewControl*>(GetOwner()->GetPeer());
|
||||||
peer->FitColumnWidthToContent(GetOwner()->GetColumnPosition(this));
|
peer->FitColumnWidthToContent(GetOwner()->GetColumnPosition(this));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
// fall through if not yet settable
|
||||||
// fall through if unsupported (OSX < 10.5) or not yet settable
|
|
||||||
|
|
||||||
case wxCOL_WIDTH_DEFAULT:
|
case wxCOL_WIDTH_DEFAULT:
|
||||||
width = wxDVC_DEFAULT_WIDTH;
|
width = wxDVC_DEFAULT_WIDTH;
|
||||||
|
@@ -66,10 +66,8 @@ static NSUInteger CalculateNSEventMaskFromEventCategory(wxEventCategory cat)
|
|||||||
NSMouseEnteredMask |
|
NSMouseEnteredMask |
|
||||||
NSMouseExitedMask |
|
NSMouseExitedMask |
|
||||||
NSScrollWheelMask |
|
NSScrollWheelMask |
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
NSTabletPointMask |
|
NSTabletPointMask |
|
||||||
NSTabletProximityMask |
|
NSTabletProximityMask |
|
||||||
#endif
|
|
||||||
NSOtherMouseDownMask |
|
NSOtherMouseDownMask |
|
||||||
NSOtherMouseUpMask |
|
NSOtherMouseUpMask |
|
||||||
NSOtherMouseDraggedMask |
|
NSOtherMouseDraggedMask |
|
||||||
@@ -77,14 +75,12 @@ static NSUInteger CalculateNSEventMaskFromEventCategory(wxEventCategory cat)
|
|||||||
NSKeyDownMask |
|
NSKeyDownMask |
|
||||||
NSKeyUpMask |
|
NSKeyUpMask |
|
||||||
NSFlagsChangedMask |
|
NSFlagsChangedMask |
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
NSEventMaskGesture |
|
NSEventMaskGesture |
|
||||||
NSEventMaskMagnify |
|
NSEventMaskMagnify |
|
||||||
NSEventMaskSwipe |
|
NSEventMaskSwipe |
|
||||||
NSEventMaskRotate |
|
NSEventMaskRotate |
|
||||||
NSEventMaskBeginGesture |
|
NSEventMaskBeginGesture |
|
||||||
NSEventMaskEndGesture |
|
NSEventMaskEndGesture |
|
||||||
#endif
|
|
||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,12 +57,8 @@ public :
|
|||||||
{
|
{
|
||||||
double v = ((double) value)/m_maximum;
|
double v = ((double) value)/m_maximum;
|
||||||
double t = ((double) thumbSize)/(m_maximum+thumbSize);
|
double t = ((double) thumbSize)/(m_maximum+thumbSize);
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
|
||||||
[(wxNSScroller*) m_osxView setFloatValue:v knobProportion:t];
|
|
||||||
#else
|
|
||||||
[(wxNSScroller*) m_osxView setDoubleValue:v];
|
[(wxNSScroller*) m_osxView setDoubleValue:v];
|
||||||
[(wxNSScroller*) m_osxView setKnobProportion:t];
|
[(wxNSScroller*) m_osxView setKnobProportion:t];
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual wxInt32 GetValue() const
|
virtual wxInt32 GetValue() const
|
||||||
|
@@ -54,10 +54,8 @@ static int CalculateUIEventMaskFromEventCategory(wxEventCategory cat)
|
|||||||
NSMouseEnteredMask = 1 << NSMouseEntered,
|
NSMouseEnteredMask = 1 << NSMouseEntered,
|
||||||
NSMouseExitedMask = 1 << NSMouseExited,
|
NSMouseExitedMask = 1 << NSMouseExited,
|
||||||
NSScrollWheelMask = 1 << NSScrollWheel,
|
NSScrollWheelMask = 1 << NSScrollWheel,
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
NSTabletPointMask = 1 << NSTabletPoint,
|
NSTabletPointMask = 1 << NSTabletPoint,
|
||||||
NSTabletProximityMask = 1 << NSTabletProximity,
|
NSTabletProximityMask = 1 << NSTabletProximity,
|
||||||
#endif
|
|
||||||
NSOtherMouseDownMask = 1 << NSOtherMouseDown,
|
NSOtherMouseDownMask = 1 << NSOtherMouseDown,
|
||||||
NSOtherMouseUpMask = 1 << NSOtherMouseUp,
|
NSOtherMouseUpMask = 1 << NSOtherMouseUp,
|
||||||
NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged,
|
NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged,
|
||||||
|
@@ -351,10 +351,7 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() );
|
m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() );
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
|
HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
|
||||||
#endif
|
|
||||||
InstallControlEventHandler(peer->GetControlRef(),
|
InstallControlEventHandler(peer->GetControlRef(),
|
||||||
GetwxWebViewWebKitEventHandlerUPP(),
|
GetwxWebViewWebKitEventHandlerUPP(),
|
||||||
GetEventTypeCount(eventList), eventList, this,
|
GetEventTypeCount(eventList), eventList, this,
|
||||||
@@ -1074,9 +1071,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
|||||||
|
|
||||||
case NSURLErrorResourceUnavailable:
|
case NSURLErrorResourceUnavailable:
|
||||||
case NSURLErrorHTTPTooManyRedirects:
|
case NSURLErrorHTTPTooManyRedirects:
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
case NSURLErrorDataLengthExceedsMaximum:
|
case NSURLErrorDataLengthExceedsMaximum:
|
||||||
#endif
|
|
||||||
case NSURLErrorBadURL:
|
case NSURLErrorBadURL:
|
||||||
case NSURLErrorFileIsDirectory:
|
case NSURLErrorFileIsDirectory:
|
||||||
*out = wxWEBVIEW_NAV_ERR_REQUEST;
|
*out = wxWEBVIEW_NAV_ERR_REQUEST;
|
||||||
@@ -1098,20 +1093,16 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
|
|||||||
*out = wxWEBVIEW_NAV_ERR_USER_CANCELLED;
|
*out = wxWEBVIEW_NAV_ERR_USER_CANCELLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
case NSURLErrorCannotDecodeRawData:
|
case NSURLErrorCannotDecodeRawData:
|
||||||
case NSURLErrorCannotDecodeContentData:
|
case NSURLErrorCannotDecodeContentData:
|
||||||
case NSURLErrorCannotParseResponse:
|
case NSURLErrorCannotParseResponse:
|
||||||
#endif
|
|
||||||
case NSURLErrorBadServerResponse:
|
case NSURLErrorBadServerResponse:
|
||||||
*out = wxWEBVIEW_NAV_ERR_REQUEST;
|
*out = wxWEBVIEW_NAV_ERR_REQUEST;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSURLErrorUserAuthenticationRequired:
|
case NSURLErrorUserAuthenticationRequired:
|
||||||
case NSURLErrorSecureConnectionFailed:
|
case NSURLErrorSecureConnectionFailed:
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
|
||||||
case NSURLErrorClientCertificateRequired:
|
case NSURLErrorClientCertificateRequired:
|
||||||
#endif
|
|
||||||
*out = wxWEBVIEW_NAV_ERR_AUTH;
|
*out = wxWEBVIEW_NAV_ERR_AUTH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user