git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2007-11-15 20:26:54 +00:00
parent 2415ff14f8
commit 80f3f3beb6
13 changed files with 10 additions and 342 deletions

View File

@ -907,12 +907,12 @@ bool wxDataViewCtrl::AppendColumn(wxDataViewColumn* dataViewColumnPtr)
#endif
if (dataViewColumnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE)
columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
if ((columnDescription.propertyDesc.propertyType == kDataBrowserTextType) ||
(columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
(columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType))
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
#endif

View File

@ -16,7 +16,7 @@
#include "wx/mac/private.h"
#if defined( __WXMAC__ ) && TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
#if defined( __WXMAC__ )
#include "wx/mac/carbon/drawer.h"
@ -197,5 +197,4 @@ wxDirection WindowEdgeToDirection(OptionBits edge)
return direction;
}
#endif // defined( __WXMAC__ ) && TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
#endif // defined( __WXMAC__ )

View File

@ -542,9 +542,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const
columnDesc.propertyDesc.propertyID = kTextColumnId;
columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
#endif
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );
@ -553,9 +551,7 @@ wxMacDataBrowserListControl::wxMacDataBrowserListControl( wxWindow *peer, const
columnDesc.propertyDesc.propertyID = kNumericOrderColumnId;
columnDesc.propertyDesc.propertyType = kDataBrowserPropertyRelevanceRankPart;
columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
#endif
verify_noerr( AddColumn( &columnDesc, kDataBrowserListViewAppendColumn ) );

View File

@ -1,136 +1 @@
/* -------------------------------------------------------------------------
* Project: Mac Notifier Support
* Name: macnotfy.c
* Author: Stefan CSomor
* Purpose: Mac Notifier main file
* CVSID: $Id$
* -------------------------------------------------------------------------
*/
#include "wx/wxprec.h"
#include "wx/wx.h"
#include "wx/mac/private.h"
#include "wx/mac/macnotfy.h"
const short kMaxEvents = 1000 ;
struct wxMacNotificationEvents
{
short top ;
short bottom ;
wxMacNotificationProcPtr proc[kMaxEvents] ;
unsigned long events[kMaxEvents] ;
void* data[kMaxEvents] ;
} ;
typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
static wxMacNotificationEvents gMacNotificationEvents ;
ProcessSerialNumber gAppProcess ;
void wxMacCreateNotifierTable()
{
GetCurrentProcess(&gAppProcess);
gMacNotificationEvents.top = 0 ;
gMacNotificationEvents.bottom = 0 ;
for ( int i = 0 ; i < kMaxEvents ; ++i )
{
gMacNotificationEvents.proc[i] = NULL ;
gMacNotificationEvents.events[i] = 0 ;
gMacNotificationEvents.data[i] = NULL ;
}
}
void wxMacDestroyNotifierTable()
{
}
wxMacNotifierTableRef wxMacGetNotifierTable()
{
return (wxMacNotifierTableRef) &gMacNotificationEvents ;
}
void wxMacAddEvent(
wxMacNotifierTableRef table ,
wxMacNotificationProcPtr handler ,
unsigned long event ,
void* data ,
short wakeUp )
{
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
wxASSERT_MSG( handler != NULL , wxT("illegal notification proc ptr") ) ;
/* this should be protected eventually */
short index = e->top++ ;
if ( e->top == kMaxEvents )
e->top = 0 ;
e->proc[index] = handler ;
e->events[index] = event ;
e->data[index] = data ;
if ( wakeUp )
wxMacWakeUp() ;
}
bool gInProcessing = false ;
void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data )
{
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
/* this should be protected eventually */
short index = e->bottom ;
while ( e->top != index )
{
if ( e->data[index] == data )
e->data[index] = NULL ;
index++ ;
if ( index == kMaxEvents )
index = 0 ;
}
}
void wxMacProcessNotifierEvents()
{
// if ( gInProcessing )
// return ;
gInProcessing = true ;
if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
{
// we only should process the notifiers that were here when we entered it
// otherwise we might never get out...
short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
if ( count < 0 )
count += kMaxEvents ;
while ( count-- )
{
// consume event at bottom
short index = gMacNotificationEvents.bottom++ ;
if ( gMacNotificationEvents.bottom == kMaxEvents )
gMacNotificationEvents.bottom = 0 ;
void* data = gMacNotificationEvents.data[index] ;
unsigned long event = gMacNotificationEvents.events[index] ;
wxMacNotificationProcPtr handler = gMacNotificationEvents.proc[index] ;
gMacNotificationEvents.data[index] = NULL ;
gMacNotificationEvents.events[index] = 0 ;
gMacNotificationEvents.proc[index] = NULL ;
if ( handler )
handler( event , data ) ;
}
}
gInProcessing = false ;
}
void wxMacProcessNotifierAndPendingEvents()
{
wxMacProcessNotifierEvents() ;
wxTheApp->ProcessPendingEvents() ;
}
// TODO REMOVE

View File

@ -80,7 +80,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
case wxSYS_COLOUR_HIGHLIGHT:
#if 0 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
#if 0
// NB: enable this case as desired
colorBrushID = kThemeBrushAlternatePrimaryHighlightColor;
#else
@ -105,7 +105,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
break ;
case wxSYS_COLOUR_HIGHLIGHTTEXT :
#if 0 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
#if 0
// NB: enable this case as desired
resultColor = *wxWHITE ;
#else

View File

@ -37,9 +37,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxSearchCtrl, wxSearchCtrlBase)
// wxMacSearchFieldControl
// ============================================================================
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
static const EventTypeSpec eventList[] =
{
{ kEventClassSearchField, kEventSearchFieldCancelClicked } ,
@ -195,8 +192,6 @@ wxString wxMacSearchFieldControl::GetDescriptiveText() const
}
}
#endif
// ============================================================================
// implementation
// ============================================================================
@ -414,12 +409,10 @@ void wxSearchCtrl::CreatePeer(
const wxSize& size, long style )
{
#ifdef __WXMAC_OSX__
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
if ( UMAGetSystemVersion() >= 0x1030 )
{
m_peer = new wxMacSearchFieldControl( this , str , pos , size , style );
}
#endif
#endif
if ( !m_peer )
{

View File

@ -235,12 +235,8 @@ protected :
TXNObject m_txn ;
} ;
#if TARGET_API_MAC_OSX
// implementation available under OSX
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
class wxMacMLTEHIViewControl : public wxMacMLTEControl
{
public :
@ -259,10 +255,6 @@ protected :
HIViewRef m_textView ;
};
#endif
#endif
// 'classic' MLTE implementation
class wxMacMLTEClassicControl : public wxMacMLTEControl
@ -1522,7 +1514,6 @@ void wxMacUnicodeTextControl::WriteText( const wxString& str )
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
if ( HasFocus() )
{
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
@ -1530,7 +1521,6 @@ void wxMacUnicodeTextControl::WriteText( const wxString& str )
SetData<CFStringRef>( 0, kControlEditTextInsertCFStringRefTag, &value );
}
else
#endif
{
wxString val = GetStringValue() ;
long start , end ;
@ -1690,9 +1680,7 @@ TXNFrameOptions wxMacMLTEControl::FrameOptionsFromWXStyle( long wxStyle )
{
TXNFrameOptions frameOptions = kTXNDontDrawCaretWhenInactiveMask;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
frameOptions |= kTXNDoFontSubstitutionMask;
#endif
if ( ! (wxStyle & wxTE_NOHIDESEL) )
frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ;
@ -3022,10 +3010,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
// MLTE control implementation (OSX part)
// ----------------------------------------------------------------------------
#if TARGET_API_MAC_OSX
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
// tiger multi-line textcontrols with no CR in the entire content
// don't scroll automatically, so we need a hack.
// This attempt only works 'before' the key (ie before CallNextEventHandler)
@ -3186,9 +3170,4 @@ void wxMacMLTEHIViewControl::SetBackground( const wxBrush &brush )
#endif
}
#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
#endif
#endif // wxUSE_TEXTCTRL

View File

@ -36,9 +36,6 @@
#include "wx/mac/uma.h"
#endif
#include "wx/mac/macnotfy.h"
// the possible states of the thread:
// ("=>" shows all possible transitions from this state)
enum wxThreadState

View File

@ -23,14 +23,6 @@
#include "wx/mac/private.h"
#endif
#ifndef __DARWIN__
#include <Timer.h>
#endif
#define wxMAC_USE_CARBON_TIMER 1
#if wxMAC_USE_CARBON_TIMER
struct MacTimerInfo
{
wxCarbonTimerImpl* m_timer;
@ -103,114 +95,5 @@ void wxCarbonTimerImpl::Stop()
m_info->m_timerRef = kInvalidID;
}
#else // !wxMAC_USE_CARBON_TIMER
typedef struct MacTimerInfo
{
TMTask m_task;
wxMacNotifierTableRef m_table;
wxCarbonTimerImpl* m_timer;
};
static void wxProcessTimer( unsigned long event, void *data );
static pascal void MacTimerProc( TMTask * t )
{
MacTimerInfo * tm = (MacTimerInfo*) t;
wxMacAddEvent( tm->m_table, wxProcessTimer, 0, (void*) tm->m_timer, true );
}
// we need this array to track timers that are being deleted within the Notify procedure
// adding the timer before the Notify call and checking after whether it still is in there
// as the destructor would have removed it from the array
wxArrayPtrVoid gTimersInProcess;
static void wxProcessTimer( unsigned long event, void *data )
{
if ( data == NULL )
return;
wxCarbonTimerImpl* timer = (wxCarbonTimerImpl*) data;
if ( timer->m_oneShot )
timer->Stop();
gTimersInProcess.Add( timer );
timer->Notify();
int index = gTimersInProcess.Index( timer );
if ( index != wxNOT_FOUND )
{
gTimersInProcess.RemoveAt( index );
if ( !timer->IsOneShot() && timer->m_info->m_task.tmAddr )
PrimeTime( (QElemPtr) &timer->m_info->m_task, timer->GetInterval() );
}
}
void wxCarbonTimerImpl::Init()
{
m_info = new MacTimerInfo();
m_info->m_task.tmAddr = NULL;
m_info->m_task.tmWakeUp = 0;
m_info->m_task.tmReserved = 0;
m_info->m_task.qType = 0;
m_info->m_table = wxMacGetNotifierTable();
m_info->m_timer = this;
}
bool wxCarbonTimerImpl::IsRunning() const
{
// as the qType may already indicate it is elapsed, but it
// was not handled internally yet
return ( m_info->m_task.tmAddr != NULL );
}
wxCarbonTimerImpl::~wxCarbonTimerImpl()
{
Stop();
if (m_info != NULL)
{
delete m_info;
m_info = NULL;
}
int index = gTimersInProcess.Index( this );
if ( index != wxNOT_FOUND )
gTimersInProcess.RemoveAt( index );
}
bool wxCarbonTimerImpl::Start( int milliseconds, bool mode )
{
(void)wxTimerBase::Start( milliseconds, mode );
wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeout") );
wxCHECK_MSG( m_info->m_task.tmAddr == NULL, false, wxT("attempting to restart a timer") );
m_info->m_task.tmAddr = NewTimerUPP( MacTimerProc );
m_info->m_task.tmWakeUp = 0;
m_info->m_task.tmReserved = 0;
m_info->m_task.qType = 0;
m_info->m_timer = this;
InsXTime( (QElemPtr) &m_info->m_task );
PrimeTime( (QElemPtr) &m_info->m_task, m_milli );
return true;
}
void wxCarbonTimerImpl::Stop()
{
if ( m_info->m_task.tmAddr )
{
RmvTime( (QElemPtr) &m_info->m_task );
DisposeTimerUPP( m_info->m_task.tmAddr );
m_info->m_task.tmAddr = NULL;
}
wxMacRemoveAllNotifiersForData( wxMacGetNotifierTable(), this );
}
#endif // wxMAC_USE_CARBON_TIMER/!wxMAC_USE_CARBON_TIMER
#endif // wxUSE_TIMER

View File

@ -1743,7 +1743,7 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
bool drawMetalTheme = MacGetTopLevelWindow()->MacGetMetalAppearance();
bool minimumUmaAvailable = (UMAGetSystemVersion() >= 0x1030);
#if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
#if wxMAC_USE_CORE_GRAPHICS
if ( !drawMetalTheme && minimumUmaAvailable )
{
HIThemePlacardDrawInfo info;

View File

@ -1205,12 +1205,10 @@ void wxTopLevelWindowMac::DoMacCreateRealWindow(
wclass = kDocumentWindowClass ;
attr |= kWindowInWindowMenuAttribute ;
}
#if defined( __WXMAC__ ) && TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
else if ( HasFlag( wxFRAME_DRAWER ) )
{
wclass = kDrawerWindowClass;
}
#endif //10.2 and up
else
{
if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
@ -1718,32 +1716,9 @@ wxUint32 wxTopLevelWindowMac::MacGetWindowAttributes() const
void wxTopLevelWindowMac::MacPerformUpdates()
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
// for composited windows this also triggers a redraw of all
// invalid views in the window
if ( UMAGetSystemVersion() >= 0x1030 )
HIWindowFlush((WindowRef) m_macWindow) ;
else
#endif
{
// the only way to trigger the redrawing on earlier systems is to call
// ReceiveNextEvent
EventRef currentEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ;
UInt32 currentEventClass = 0 ;
if ( currentEvent != NULL )
{
currentEventClass = ::GetEventClass( currentEvent ) ;
::GetEventKind( currentEvent ) ;
}
if ( currentEventClass != kEventClassMenu )
{
// when tracking a menu, strange redraw errors occur if we flush now, so leave..
EventRef theEvent;
ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ;
}
}
HIWindowFlush((WindowRef) m_macWindow) ;
}
// Attracts the users attention to this window if the application is

View File

@ -1895,9 +1895,7 @@ void wxMacDataItemBrowserControl::InsertColumn(int colId, DataBrowserPropertyTyp
columnDesc.propertyDesc.propertyID = (kMinColumnId + colId);
columnDesc.propertyDesc.propertyType = colType;
columnDesc.propertyDesc.propertyFlags = kDataBrowserListViewSortableColumn;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn;
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
columnDesc.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
#endif

View File

@ -153,17 +153,6 @@ void wxMacWindowToNative( const wxWindow* window , Rect *rect )
// Carbon Events
// ---------------------------------------------------------------------------
#if TARGET_API_MAC_OSX
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3
enum
{
kEventControlVisibilityChanged = 157
};
#endif
#endif
static const EventTypeSpec eventList[] =
{
{ kEventClassCommand, kEventProcessCommand } ,
@ -2667,13 +2656,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
m_peer->SetNeedsDisplay() ;
#else
// this would be the preferred version for fast drawing controls
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
if ( UMAGetSystemVersion() >= 0x1030 )
HIViewRender(m_peer->GetControlRef()) ;
else
#endif
Update() ;
HIViewRender(m_peer->GetControlRef()) ;
#endif
}