X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/170acdc90e9f92f8b8120fa6c04acdbf45c89582..c13815810e8ff427614ca82fe0dfd4b1e773f0f3:/src/univ/stattext.cpp diff --git a/src/univ/stattext.cpp b/src/univ/stattext.cpp index 509a5d6dde..772a8e9b38 100644 --- a/src/univ/stattext.cpp +++ b/src/univ/stattext.cpp @@ -39,8 +39,6 @@ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl) - // ---------------------------------------------------------------------------- // creation // ---------------------------------------------------------------------------- @@ -63,32 +61,36 @@ bool wxStaticText::Create(wxWindow *parent, } // ---------------------------------------------------------------------------- -// 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 abbreviated version of it + DoSetLabel(GetEllipsizedLabel()); } -// ---------------------------------------------------------------------------- -// 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