]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/textctrl.mm
Somehow, setting a tint color makes gauge work :/.
[wxWidgets.git] / src / osx / cocoa / textctrl.mm
index 760257f4f4547e0afa9139dd416ca4331cf1fe1d..7ec0ff8bca710cf688e151af1bf755c56ed8e8a3 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Stefan Csomor
 // Modified by: Ryan Norton (MLTE GetLineLength and GetLineText)
 // Created:     1998-01-01
-// RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -50,6 +49,8 @@
 #include "wx/osx/private.h"
 #include "wx/osx/cocoa/private/textimpl.h"
 
+#include "wx/cocoa/autorelease.h"
+
 @interface NSView(EditableView)
 - (BOOL)isEditable;
 - (void)setEditable:(BOOL)flag;
@@ -111,6 +112,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
 @interface wxMaximumLengthFormatter : NSFormatter
 {
     int maxLength;
+    wxTextEntry* field;
 }
 
 @end
@@ -148,12 +150,17 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
     int len = [*partialStringPtr length];
     if ( maxLength > 0 && len > maxLength )
     {
-        // TODO wxEVT_TEXT_MAXLEN
+        field->SendMaxLenEvent();
         return NO;
     }
     return YES;
 }
 
+- (void) setTextEntry:(wxTextEntry*) tf
+{
+    field = tf;
+}
+
 @end
 
 @implementation wxNSSecureTextField
@@ -792,6 +799,7 @@ wxNSTextFieldControl::~wxNSTextFieldControl()
 
 wxString wxNSTextFieldControl::GetStringValue() const
 {
+    wxAutoNSAutoreleasePool pool;
     return wxCFStringRef::AsString([m_textField stringValue], m_wxPeer->GetFont().GetEncoding());
 }
 
@@ -805,6 +813,7 @@ void wxNSTextFieldControl::SetMaxLength(unsigned long len)
 {
     wxMaximumLengthFormatter* formatter = [[[wxMaximumLengthFormatter alloc] init] autorelease];
     [formatter setMaxLength:len];
+    [formatter setTextEntry:GetTextEntry()];
     [m_textField setFormatter:formatter];
 }