]>
Commit | Line | Data |
---|---|---|
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 | ||
15 | #import <Foundation/NSString.h> | |
16 | #import <AppKit/NSTextField.h> | |
17 | ||
18 | IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) | |
19 | BEGIN_EVENT_TABLE(wxStaticText, wxControl) | |
20 | END_EVENT_TABLE() | |
21 | WX_IMPLEMENT_COCOA_OWNER(wxStaticText,NSTextField,NSControl,NSView) | |
22 | ||
23 | bool wxStaticText::Create(wxWindow *parent, wxWindowID winid, | |
24 | const wxString& label, | |
25 | const wxPoint& pos, | |
26 | const wxSize& size, | |
27 | long style, | |
28 | const wxString& name) | |
29 | { | |
30 | if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name)) | |
31 | return false; | |
32 | m_cocoaNSView = NULL; | |
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]; | |
41 | if(m_parent) | |
42 | m_parent->CocoaAddChild(this); | |
43 | return true; | |
44 | } | |
45 | ||
46 | wxStaticText::~wxStaticText() | |
47 | { | |
48 | CocoaRemoveFromParent(); | |
49 | SetNSTextField(NULL); | |
50 | } | |
51 | ||
52 | void wxStaticText::SetLabel(const wxString& label) | |
53 | { | |
54 | // TODO | |
55 | } | |
56 | ||
57 | void wxStaticText::Cocoa_didChangeText(void) | |
58 | { | |
59 | } | |
60 |