+// the current unicode textcontrol implementation has a bug : only if the control
+// is currently having the focus, the selection can be retrieved by the corresponding
+// data tag. So we have a mirroring using a member variable
+// TODO : build event table using virtual member functions for wxMacControl
+
+static const EventTypeSpec unicodeTextControlEventList[] =
+{
+ { kEventClassControl , kEventControlSetFocusPart } ,
+} ;
+
+static pascal OSStatus wxMacUnicodeTextControlControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+{
+ OSStatus result = eventNotHandledErr ;
+ wxMacUnicodeTextControl* focus = (wxMacUnicodeTextControl*) data ;
+ wxMacCarbonEvent cEvent( event ) ;
+
+ switch ( GetEventKind( event ) )
+ {
+ case kEventControlSetFocusPart :
+ {
+ ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
+ if ( controlPart == kControlFocusNoPart )
+ {
+ // about to loose focus -> store selection to field
+ focus->GetData<ControlEditTextSelectionRec>( 0, kControlEditTextSelectionTag, &focus->m_selection );
+ }
+ result = CallNextEventHandler(handler,event) ;
+ if ( controlPart != kControlFocusNoPart )
+ {
+ // about to gain focus -> set selection from field
+ focus->SetData<ControlEditTextSelectionRec>( 0, kControlEditTextSelectionTag, &focus->m_selection );
+ }
+ break;
+ }
+ default:
+ break ;
+ }
+
+ return result ;
+}
+
+static pascal OSStatus wxMacUnicodeTextControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+{
+ OSStatus result = eventNotHandledErr ;
+
+ switch ( GetEventClass( event ) )
+ {
+ case kEventClassControl :
+ result = wxMacUnicodeTextControlControlEventHandler( handler , event , data ) ;
+ break ;
+
+ default :
+ break ;
+ }
+ return result ;
+}
+
+DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacUnicodeTextControlEventHandler )
+
+wxMacUnicodeTextControl::wxMacUnicodeTextControl( wxTextCtrl *wxPeer,
+ const wxString& str,
+ const wxPoint& pos,
+ const wxSize& size, long style )
+ : wxMacTextControl( wxPeer )