X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ccdc11bbaf0310a474ad7b9d41413b31c3544356..cc378c2d7521e58e6f067470b798e9c81dd08c61:/src/univ/stattext.cpp diff --git a/src/univ/stattext.cpp b/src/univ/stattext.cpp index 38da4fb592..3fccad2764 100644 --- a/src/univ/stattext.cpp +++ b/src/univ/stattext.cpp @@ -39,7 +39,7 @@ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl) +IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxGenericStaticText) // ---------------------------------------------------------------------------- // creation @@ -57,38 +57,42 @@ bool wxStaticText::Create(wxWindow *parent, return false; SetLabel(label); - SetBestSize(size); + SetInitialSize(size); return true; } // ---------------------------------------------------------------------------- -// size management +// drawing // ---------------------------------------------------------------------------- -void wxStaticText::SetLabel(const wxString& label) +void wxStaticText::DoDraw(wxControlRenderer *renderer) { - wxControl::SetLabel(label); + renderer->DrawLabel(); } -wxSize wxStaticText::DoGetBestClientSize() const +void wxStaticText::SetLabel(const wxString& str) { - wxStaticText *self = wxConstCast(this, wxStaticText); - wxClientDC dc(self); - dc.SetFont(GetFont()); - wxCoord width, height; - dc.GetMultiLineTextExtent(GetLabel(), &width, &height); + // save original label + m_labelOrig = str; - return wxSize(width, height); + // draw as real label the result of GetEllipsizedLabelWithoutMarkup: + DoSetLabel(GetEllipsizedLabelWithoutMarkup()); } -// ---------------------------------------------------------------------------- -// drawing -// ---------------------------------------------------------------------------- +void wxStaticText::DoSetLabel(const wxString& str) +{ + UnivDoSetLabel(str); +} -void wxStaticText::DoDraw(wxControlRenderer *renderer) +wxString wxStaticText::DoGetLabel() const { - renderer->DrawLabel(); + return wxControl::GetLabel(); } +/* + FIXME: UpdateLabel() should be called on size events to allow correct + dynamic ellipsizing of the label +*/ + #endif // wxUSE_STATTEXT