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 #import <Foundation/NSString.h>
16 #import <AppKit/NSTextField.h>
18 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
19 BEGIN_EVENT_TABLE(wxStaticText, wxControl)
21 WX_IMPLEMENT_COCOA_OWNER(wxStaticText,NSTextField,NSControl,NSView)
23 bool wxStaticText::Create(wxWindow *parent, wxWindowID winid,
24 const wxString& label,
30 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
33 SetNSTextField([[NSTextField alloc] initWithFrame:NSMakeRect(0,0,30,30)]);
34 [m_cocoaNSView release];
35 [GetNSTextField() setStringValue:[NSString stringWithCString:label.c_str()]];
36 // [GetNSTextField() setBordered: NO];
37 [GetNSTextField() setBezeled: NO];
38 [GetNSTextField() setEditable: NO];
39 [GetNSTextField() setDrawsBackground: NO];
40 [GetNSControl() sizeToFit];
42 m_parent->CocoaAddChild(this);
46 wxStaticText::~wxStaticText()
48 CocoaRemoveFromParent();
52 void wxStaticText::SetLabel(const wxString& label)
57 void wxStaticText::Cocoa_didChangeText(void)