]>
Commit | Line | Data |
---|---|---|
fb896a32 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cocoa/stattext.mm | |
3 | // Purpose: wxStaticText | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2003/02/15 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) 2003 David Elliott | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/app.h" | |
13 | #include "wx/stattext.h" | |
14 | ||
7fc77f30 DE |
15 | #include "wx/cocoa/autorelease.h" |
16 | ||
fb896a32 DE |
17 | #import <Foundation/NSString.h> |
18 | #import <AppKit/NSTextField.h> | |
19 | ||
20 | IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) | |
21 | BEGIN_EVENT_TABLE(wxStaticText, wxControl) | |
22 | END_EVENT_TABLE() | |
23 | WX_IMPLEMENT_COCOA_OWNER(wxStaticText,NSTextField,NSControl,NSView) | |
24 | ||
25 | bool wxStaticText::Create(wxWindow *parent, wxWindowID winid, | |
26 | const wxString& label, | |
27 | const wxPoint& pos, | |
28 | const wxSize& size, | |
29 | long style, | |
30 | const wxString& name) | |
31 | { | |
7fc77f30 | 32 | wxAutoNSAutoreleasePool pool; |
fb896a32 DE |
33 | if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name)) |
34 | return false; | |
35 | m_cocoaNSView = NULL; | |
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]; | |
44 | if(m_parent) | |
45 | m_parent->CocoaAddChild(this); | |
46 | return true; | |
47 | } | |
48 | ||
49 | wxStaticText::~wxStaticText() | |
50 | { | |
570aaadf | 51 | DisassociateNSTextField(m_cocoaNSView); |
fb896a32 DE |
52 | } |
53 | ||
54 | void wxStaticText::SetLabel(const wxString& label) | |
55 | { | |
56 | // TODO | |
57 | } | |
58 | ||
59 | void wxStaticText::Cocoa_didChangeText(void) | |
60 | { | |
61 | } | |
62 |