1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/stattext.mm
3 // Purpose: wxStaticText
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/stattext.h"
15 #include "wx/cocoa/autorelease.h"
17 #import <Foundation/NSString.h>
18 #import <AppKit/NSTextField.h>
20 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
21 BEGIN_EVENT_TABLE(wxStaticText, wxControl)
23 WX_IMPLEMENT_COCOA_OWNER(wxStaticText,NSTextField,NSControl,NSView)
25 bool wxStaticText::Create(wxWindow *parent, wxWindowID winid,
26 const wxString& label,
32 wxAutoNSAutoreleasePool pool;
33 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
36 SetNSTextField([[NSTextField alloc] initWithFrame:NSMakeRect(0,0,30,30)]);
37 [m_cocoaNSView release];
38 [GetNSTextField() setStringValue:[NSString stringWithCString:label.c_str()]];
39 // [GetNSTextField() setBordered: NO];
40 [GetNSTextField() setBezeled: NO];
41 [GetNSTextField() setEditable: NO];
42 [GetNSTextField() setDrawsBackground: NO];
43 [GetNSControl() sizeToFit];
45 m_parent->CocoaAddChild(this);
49 wxStaticText::~wxStaticText()
51 DisassociateNSTextField(m_cocoaNSView);
54 void wxStaticText::SetLabel(const wxString& label)
59 void wxStaticText::Cocoa_didChangeText(void)