]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/cocoa/stattext.mm
use wxPopupWindow again
[wxWidgets.git] / src / cocoa / stattext.mm
... / ...
CommitLineData
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/wxprec.h"
13#ifndef WX_PRECOMP
14 #include "wx/app.h"
15 #include "wx/stattext.h"
16#endif //WX_PRECOMP
17
18#include "wx/cocoa/autorelease.h"
19#include "wx/cocoa/string.h"
20
21#import <Foundation/NSString.h>
22#import <AppKit/NSTextField.h>
23#include <math.h>
24
25IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
26BEGIN_EVENT_TABLE(wxStaticText, wxControl)
27END_EVENT_TABLE()
28WX_IMPLEMENT_COCOA_OWNER(wxStaticText,NSTextField,NSControl,NSView)
29
30bool wxStaticText::Create(wxWindow *parent, wxWindowID winid,
31 const wxString& label,
32 const wxPoint& pos,
33 const wxSize& size,
34 long style,
35 const wxString& name)
36{
37 wxAutoNSAutoreleasePool pool;
38 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
39 return false;
40 m_cocoaNSView = NULL;
41 SetNSTextField([[NSTextField alloc] initWithFrame:MakeDefaultNSRect(size)]);
42 [m_cocoaNSView release];
43 [GetNSTextField() setStringValue:wxNSStringWithWxString(label)];
44// [GetNSTextField() setBordered: NO];
45 [GetNSTextField() setBezeled: NO];
46 [GetNSTextField() setEditable: NO];
47 [GetNSTextField() setDrawsBackground: NO];
48
49 [GetNSControl() sizeToFit];
50 // Round-up to next integer size
51 NSRect nsrect = [m_cocoaNSView frame];
52 nsrect.size.width = ceil(nsrect.size.width);
53 [m_cocoaNSView setFrameSize: nsrect.size];
54
55 if(m_parent)
56 m_parent->CocoaAddChild(this);
57 SetInitialFrameRect(pos,size);
58
59 return true;
60}
61
62wxStaticText::~wxStaticText()
63{
64 DisassociateNSTextField(GetNSTextField());
65}
66
67void wxStaticText::SetLabel(const wxString& label)
68{
69 // TODO
70}
71
72void wxStaticText::Cocoa_didChangeText(void)
73{
74}
75