]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/stattext.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticText
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "stattext.h"
17 #include "wx/stattext.h"
21 IMPLEMENT_DYNAMIC_CLASS(wxStaticText
, wxControl
)
23 #include <wx/mac/uma.h>
25 BEGIN_EVENT_TABLE(wxStaticText
, wxControl
)
26 EVT_PAINT(wxStaticText::OnPaint
)
29 bool wxStaticText::Create(wxWindow
*parent
, wxWindowID id
,
30 const wxString
& label
,
37 m_backgroundColour
= parent
->GetBackgroundColour() ;
38 m_foregroundColour
= parent
->GetForegroundColour() ;
41 m_windowId
= (int)NewControlId();
45 m_windowStyle
= style
;
48 bool ret
= wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
49 SetSizeOrDefault( size
) ;
54 void wxStaticText::OnPaint( wxPaintEvent
&event
)
59 dc
.DrawText( m_label
, 0 , 0 ) ;
62 wxSize
wxStaticText::DoGetBestSize() const
65 GetTextExtent( m_label
, &x
, &y
) ;
66 return wxSize( x
, y
) ;
69 void wxStaticText::SetLabel(const wxString
& st
, bool resize
)
79 void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
81 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
84 bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
85 const wxString& label,
94 MacPreControlCreate( parent , id , label , pos , size ,style, *((wxValidator*)NULL) , name , &bounds , title ) ;
96 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
97 kControlStaticTextProc , (long) this ) ;
98 ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) title[0] , (char*) &title[1] ) ;
100 MacPostControlCreate() ;
105 void wxStaticText::SetLabel(const wxString& st , bool resize )
110 if( wxApp::s_macDefaultEncodingIsPC )
111 label = wxMacMakeMacStringFromPC( st ) ;
115 ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ;