// 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
/////////////////////////////////////////////////////////////////////////////
#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;
@interface wxMaximumLengthFormatter : NSFormatter
{
int maxLength;
+ wxTextEntry* field;
}
@end
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
wxString wxNSTextFieldControl::GetStringValue() const
{
+ wxAutoNSAutoreleasePool pool;
return wxCFStringRef::AsString([m_textField stringValue], m_wxPeer->GetFont().GetEncoding());
}
{
wxMaximumLengthFormatter* formatter = [[[wxMaximumLengthFormatter alloc] init] autorelease];
[formatter setMaxLength:len];
+ [formatter setTextEntry:GetTextEntry()];
[m_textField setFormatter:formatter];
}