]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/stattext.cpp
14c69f1d96917abe4c96e9b5b1f9bd4b33084570
[wxWidgets.git] / src / mac / carbon / stattext.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: stattext.cpp
3 // Purpose: wxStaticText
4 // Author: AUTHOR
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "stattext.h"
14 #endif
15
16 #include "wx/app.h"
17 #include "wx/stattext.h"
18
19 #include <stdio.h>
20
21 #if !USE_SHARED_LIBRARY
22 IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
23 #endif
24
25 #include <wx/mac/uma.h>
26
27 bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
28 const wxString& label,
29 const wxPoint& pos,
30 const wxSize& size,
31 long style,
32 const wxString& name)
33 {
34 Rect bounds ;
35 Str255 title ;
36
37 MacPreControlCreate( parent , id , label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
38
39 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
40 kControlStaticTextProc , (long) this ) ;
41 ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) title[0] , (char*) &title[1] ) ;
42
43 MacPostControlCreate() ;
44
45 return TRUE;
46 }
47
48 void wxStaticText::SetLabel(const wxString& st , bool resize )
49 {
50 m_label = st ;
51 wxString label ;
52
53 if( wxApp::s_macDefaultEncodingIsPC )
54 label = wxMacMakeMacStringFromPC( st ) ;
55 else
56 label = st ;
57
58 ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;
59 Refresh() ;
60 }
61