X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e75491071dbefcada61175e3eb89ce4edf335983..3112490359260018d5d90deea13f3eff9dbe9564:/src/mac/stattext.cpp diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index 54f6eb4e58..b249fc0e11 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -18,12 +18,69 @@ #include -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) -#endif #include +BEGIN_EVENT_TABLE(wxStaticText, wxControl) + EVT_PAINT(wxStaticText::OnPaint) +END_EVENT_TABLE() + +bool wxStaticText::Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + SetName(name); + m_backgroundColour = parent->GetBackgroundColour() ; + m_foregroundColour = parent->GetForegroundColour() ; + + if ( id == -1 ) + m_windowId = (int)NewControlId(); + else + m_windowId = id; + + m_windowStyle = style; + m_label = label ; + + bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); + SetSizeOrDefault( size ) ; + + return ret; +} + +void wxStaticText::OnPaint( wxPaintEvent &event ) +{ + wxPaintDC dc(this); + PrepareDC(dc); + dc.Clear() ; + dc.DrawText( m_label , 0 , 0 ) ; +} + +wxSize wxStaticText::DoGetBestSize() const +{ + int x , y ; + GetTextExtent( m_label , &x , &y ) ; + return wxSize( x , y ) ; +} + +void wxStaticText::SetLabel(const wxString& st , bool resize ) +{ + SetTitle( st ) ; + m_label = st ; + if ( resize ) + SetSizeOrDefault() ; + else + Refresh() ; +} +/* +void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags) +{ + wxControl::SetSize( x , y , width , height , sizeFlags ) ; +} + bool wxStaticText::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, @@ -58,4 +115,5 @@ void wxStaticText::SetLabel(const wxString& st , bool resize ) ::UMASetControlData( m_macControl, kControlLabelPart, kControlStaticTextTextTag , (long) label.Length() , (char*)(const char*) label ) ; Refresh() ; } +*/