X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e13c1ec4e6e8d2c5852df39c6be5db4fd279227..c1aa5517acff9ce039adcd6502db2e88cdd886c7:/src/mac/carbon/textctrl.cpp diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index b536e37c44..fddd31d2bc 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -13,12 +13,17 @@ #if wxUSE_TEXTCTRL +#include "wx/textctrl.h" + +#ifndef WX_PRECOMP + #include "wx/intl.h" +#endif #ifdef __DARWIN__ - #include - #include + #include + #include #else - #include + #include #endif #include "wx/msgdlg.h" @@ -35,13 +40,11 @@ #include "wx/dc.h" #include "wx/button.h" #include "wx/toplevel.h" -#include "wx/textctrl.h" #include "wx/settings.h" #include "wx/filefn.h" #include "wx/utils.h" #include "wx/sysopt.h" #include "wx/menu.h" -#include "wx/intl.h" #if defined(__BORLANDC__) && !defined(__WIN32__) #include @@ -435,6 +438,7 @@ void wxTextCtrl::Init() m_maxLength = 0; m_privateContextMenu = NULL; + m_triggerOnSetValue = true ; } wxTextCtrl::~wxTextCtrl() @@ -545,10 +549,13 @@ void wxTextCtrl::SetValue(const wxString& str) GetPeer()->SetStringValue( str ) ; - wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId ); - event.SetString( GetValue() ); - event.SetEventObject( this ); - GetEventHandler()->ProcessEvent( event ); + if ( m_triggerOnSetValue ) + { + wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, m_windowId ); + event.SetString( GetValue() ); + event.SetEventObject( this ); + GetEventHandler()->ProcessEvent( event ); + } } void wxTextCtrl::SetMaxLength(unsigned long len) @@ -876,6 +883,13 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) int key = event.GetKeyCode() ; bool eat_key = false ; + if ( key == 'a' && event.MetaDown() ) + { + SelectAll() ; + + return ; + } + if ( key == 'c' && event.MetaDown() ) { if ( CanCopy() ) @@ -1563,9 +1577,11 @@ wxString wxMacMLTEControl::GetStringValue() const (((UniChar*)*theText)[actualSize]) = 0 ; wxMBConvUTF16 converter ; size_t noChars = converter.MB2WC( NULL , (const char*)*theText , 0 ) ; + wxASSERT_MSG( noChars != wxCONV_FAILED, _T("Unable to count the number of characters in this string!") ); ptr = new wxChar[noChars + 1] ; - noChars = converter.MB2WC( ptr , (const char*)*theText , noChars ) ; + noChars = converter.MB2WC( ptr , (const char*)*theText , noChars + 1 ) ; + wxASSERT_MSG( noChars != wxCONV_FAILED, _T("Conversion of string failed!") ); ptr[noChars] = 0 ; HUnlock( theText ) ; #endif