X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c5fd8a319e58c0d8c58d73360ee9d4874c87bd8..bfdaa9173ed5b20dd5a9cd83241ce44fc0eff960:/src/univ/stattext.cpp diff --git a/src/univ/stattext.cpp b/src/univ/stattext.cpp index 83ebf31eaf..a34cf8ad17 100644 --- a/src/univ/stattext.cpp +++ b/src/univ/stattext.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 14.08.00 -// RCS-ID: $Id$ // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -39,8 +38,6 @@ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl) - // ---------------------------------------------------------------------------- // creation // ---------------------------------------------------------------------------- @@ -63,40 +60,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::DoDraw(wxControlRenderer *renderer) +void wxStaticText::DoSetLabel(const wxString& str) { - if ( UseBgCol() ) - { - wxDC& dc = renderer->GetDC(); - dc.SetBrush(GetBackgroundColour()); - dc.SetPen(*wxTRANSPARENT_PEN); - dc.DrawRectangle(renderer->GetRect()); - } + UnivDoSetLabel(str); +} - renderer->DrawLabel(); +wxString wxStaticText::DoGetLabel() const +{ + return wxControl::GetLabel(); } +/* + FIXME: UpdateLabel() should be called on size events to allow correct + dynamic ellipsizing of the label +*/ + #endif // wxUSE_STATTEXT