#include "wx/osx/cocoa/private/textimpl.h"
@interface wxNSSecureTextField : NSSecureTextField
+{
+ wxWidgetCocoaImpl* impl;
+}
+- (void) setImplementation:(wxWidgetCocoaImpl*) item;
+- (wxWidgetCocoaImpl*) implementation;
@end
@implementation wxNSSecureTextField
}
}
+- (wxWidgetCocoaImpl*) implementation
+{
+ return impl;
+}
+
+- (void) setImplementation:(wxWidgetCocoaImpl*) item
+{
+ impl = item;
+}
+
+- (void)controlTextDidChange:(NSNotification *)aNotification
+{
+ if ( impl )
+ {
+ wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
+ if ( wxpeer ) {
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId());
+ event.SetEventObject( wxpeer );
+ event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
+ wxpeer->HandleWindowEvent( event );
+ }
+ }
+}
+
@end
@interface wxNSTextView : NSScrollView
+{
+ wxWidgetCocoaImpl* impl;
+}
+- (void) setImplementation:(wxWidgetCocoaImpl*) item;
+- (wxWidgetCocoaImpl*) implementation;
@end
@implementation wxNSTextView
}
}
+- (wxWidgetCocoaImpl*) implementation
+{
+ return impl;
+}
+
+- (void) setImplementation:(wxWidgetCocoaImpl*) item
+{
+ impl = item;
+}
+
+
+- (void)controlTextDidChange:(NSNotification *)aNotification
+{
+ if ( impl )
+ {
+ wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
+ if ( wxpeer ) {
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId());
+ event.SetEventObject( wxpeer );
+ event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
+ wxpeer->HandleWindowEvent( event );
+ }
+ }
+}
@end
@implementation wxNSTextField
}
}
-/*
+- (wxWidgetCocoaImpl*) implementation
+{
+ return impl;
+}
+
+- (void) setImplementation:(wxWidgetCocoaImpl*) item
+{
+ impl = item;
+}
+
+- (void) setEnabled:(BOOL) flag
+{
+ [super setEnabled: flag];
+
+ if (![self drawsBackground]) {
+ // Static text is drawn incorrectly when disabled.
+ // For an explanation, see
+ // http://www.cocoabuilder.com/archive/message/cocoa/2006/7/21/168028
+ if (flag) {
+ [self setTextColor: [NSColor controlTextColor]];
+ } else {
+ [self setTextColor: [NSColor secondarySelectedControlColor]];
+ }
+ }
+}
+
- (void)controlTextDidChange:(NSNotification *)aNotification
{
if ( impl )
}
}
+/*
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
if ( impl )
wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ) : wxWidgetCocoaImpl(wxPeer, w)
{
m_scrollView = (NSScrollView*) w;
+ [w setImplementation: this];
[m_scrollView setHasVerticalScroller:YES];
[m_scrollView setHasHorizontalScroller:NO];
[v setBordered:NO];
c = new wxNSTextFieldControl( wxpeer, v );
+ [v setImplementation: c];
static_cast<wxNSTextFieldControl*>(c)->SetStringValue(str);
}