event handlers get deallocated automatically with their object

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-05-21 12:45:15 +00:00
parent a1485bc734
commit f919acdc41
2 changed files with 5 additions and 9 deletions

View File

@@ -102,10 +102,6 @@ protected :
// contains the tag for the content (is different for password and non-password controls)
OSType m_valueTag ;
// as the selection tag only works correctly when the control has the focus we have to mirror the
// intended value
EventHandlerRef m_focusHandlerRef ;
public :
ControlEditTextSelectionRec m_selection ;
};

View File

@@ -261,7 +261,6 @@ public :
protected :
HIViewRef m_scrollView ;
HIViewRef m_textView ;
EventHandlerRef m_textEventHandlerRef ;
};
#endif
@@ -1383,14 +1382,13 @@ bool wxMacUnicodeTextControl::Create( wxTextCtrl *wxPeer,
InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(),
GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this,
&m_focusHandlerRef);
NULL);
return true;
}
wxMacUnicodeTextControl::~wxMacUnicodeTextControl()
{
::RemoveEventHandler( m_focusHandlerRef );
}
void wxMacUnicodeTextControl::VisibilityChanged(bool shown)
@@ -3073,12 +3071,11 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
InstallControlEventHandler( m_textView , GetwxMacTextControlEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this,
&m_textEventHandlerRef);
NULL);
}
wxMacMLTEHIViewControl::~wxMacMLTEHIViewControl()
{
::RemoveEventHandler( m_textEventHandlerRef ) ;
}
OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
@@ -3089,6 +3086,9 @@ OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
bool wxMacMLTEHIViewControl::HasFocus() const
{
ControlRef control ;
if ( GetUserFocusWindow() == NULL )
return false;
GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
return control == m_textView ;
}