}
#endif
+ if ( thisWindow->MacIsUserPane() )
+ result = noErr ;
+
if ( controlPart == kControlFocusNoPart )
{
#if wxUSE_CARET
event.SetEventObject(thisWindow);
thisWindow->GetEventHandler()->ProcessEvent(event) ;
}
-
- if ( thisWindow->MacIsUserPane() )
- result = noErr ;
}
break ;
charBuf[ numChars - 1 ] = 0;
#if SIZEOF_WCHAR_T == 2
uniChars = (wchar_t*) charBuf ;
- memcpy( uniChars , charBuf , numChars * 2 ) ;
+/* memcpy( uniChars , charBuf , numChars * 2 ) ;*/ // is there any point in copying charBuf over itself? (in fact, memcpy isn't even guaranteed to work correctly if the source and destination ranges overlap...)
#else
// the resulting string will never have more chars than the utf16 version, so this is safe
wxMBConvUTF16 converter ;
WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
wxTheApp->MacSetCurrentEvent( event , handler ) ;
+ UInt32 message = uniChars[pos] < 128 ? (char)uniChars[pos] : '?';
+/*
+ NB: faking a charcode here is problematic. The kEventTextInputUpdateActiveInputArea event is sent
+ multiple times to update the active range during inline input, so this handler will often receive
+ uncommited text, which should usually not trigger side effects. It might be a good idea to check the
+ kEventParamTextInputSendFixLen parameter and verify if input is being confirmed (see CarbonEvents.h).
+ On the other hand, it can be useful for some applications to react to uncommitted text (for example,
+ to update a status display), as long as it does not disrupt the inline input session. Ideally, wx
+ should add new event types to support advanced text input. For now, I would keep things as they are.
+
+ However, the code that was being used caused additional problems:
UInt32 message = (0 << 8) + ((char)uniChars[pos] );
+ Since it simply truncated the unichar to the last byte, it ended up causing weird bugs with inline
+ input, such as switching to another field when one attempted to insert the character U+4E09 (the kanji
+ for "three"), because it was truncated to 09 (kTabCharCode), which was later "converted" to WXK_TAB
+ (still 09) in wxMacTranslateKey; or triggering the default button when one attempted to insert U+840D
+ (the kanji for "name"), which got truncated to 0D and interpreted as a carriage return keypress.
+ Note that even single-byte characters could have been misinterpreted, since MacRoman charcodes only
+ overlap with Unicode within the (7-bit) ASCII range.
+ But simply passing a NUL charcode would disable text updated events, because wxTextCtrl::OnChar checks
+ for codes within a specific range. Therefore I went for the solution seen above, which keeps ASCII
+ characters as they are and replaces the rest with '?', ensuring that update events are triggered.
+ It would be better to change wxTextCtrl::OnChar to look at the actual unicode character instead, but
+ I don't have time to look into that right now.
+ -- CL
+*/
if ( wxTheApp->MacSendCharEvent(
focus , message , 0 , when , 0 , 0 , uniChars[pos] ) )
{
return true;
}
-bool wxWindowMac::Enable(bool enable)
+void wxWindowMac::DoEnable(bool enable)
{
- wxASSERT( m_peer->Ok() ) ;
- bool former = MacIsReallyEnabled() ;
- if ( !wxWindowBase::Enable(enable) )
- return false;
-
m_peer->Enable( enable ) ;
-
- if ( former != MacIsReallyEnabled() )
- MacPropagateEnabledStateChanged() ;
-
- return true;
}
//
#endif
}
-void wxWindowMac::MacPropagateEnabledStateChanged()
+void wxWindowMac::OnEnabled(bool enabled)
{
#if !TARGET_API_MAC_OSX
MacEnabledStateChanged() ;
-
- wxWindowMac *child;
- wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
- while ( node )
- {
- child = node->GetData();
- if ( child->IsEnabled() )
- child->MacPropagateEnabledStateChanged() ;
-
- node = node->GetNext();
- }
#endif
}
fontToUse = &m_font;
wxClientDC dc( (wxWindowMac*) this ) ;
- long lx,ly,ld,le ;
+ wxCoord lx,ly,ld,le ;
dc.GetTextExtent( string , &lx , &ly , &ld, &le, (wxFont *)fontToUse ) ;
if ( externalLeading )
*externalLeading = le ;
if ( m_peer->GetNeedsDisplay() )
{
// because HIViewScrollRect does not scroll the already invalidated area we have two options:
+ // in case there is already a pending redraw on that area
// either immediate redraw or full invalidate
#if 1
// is the better overall solution, as it does not slow down scrolling
scrollrect.Offset( -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
m_peer->ScrollRect( &scrollrect , dx , dy ) ;
- // becuase HIViewScrollRect does not scroll the already invalidated area we have two options
- // either immediate redraw or full invalidate
#if 0
- // is the better overall solution, as it does not slow down scrolling
- m_peer->SetNeedsDisplay() ;
-#else
// this would be the preferred version for fast drawing controls
-
HIViewRender(m_peer->GetControlRef()) ;
#endif
}
{
wxRect rc( x, y, w, h );
if (rect->Intersects( rc ))
- child->SetSize( x + dx, y + dy, w, h );
+ child->SetSize( x + dx, y + dy, w, h, wxSIZE_AUTO|wxSIZE_ALLOW_MINUS_ONE );
}
else
{
- child->SetSize( x + dx, y + dy, w, h );
+ child->SetSize( x + dx, y + dy, w, h, wxSIZE_AUTO|wxSIZE_ALLOW_MINUS_ONE );
}
}
}
Rect rect ;
m_peer->GetRect( &rect ) ;
- // auf den umgebenden Rahmen zur\9fck
+ // auf den umgebenden Rahmen zur\81\9fck
InsetRect( &rect, -1 , -1 ) ;
wxTopLevelWindowMac* top = MacGetTopLevelWindow();