X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/67d947ba89b176c05c7707f44e4381bdef0f21c8..eb7350290f690dd3e4d92bcf0515027678b3374f:/src/univ/stattext.cpp diff --git a/src/univ/stattext.cpp b/src/univ/stattext.cpp index e09644b5b1..3fccad2764 100644 --- a/src/univ/stattext.cpp +++ b/src/univ/stattext.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: univ/stattext.cpp +// Name: src/univ/stattext.cpp // Purpose: wxStaticText // Author: Vadim Zeitlin // Modified by: // Created: 14.08.00 // RCS-ID: $Id$ // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "univstattext.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -29,9 +25,10 @@ #if wxUSE_STATTEXT +#include "wx/stattext.h" + #ifndef WX_PRECOMP #include "wx/dcclient.h" - #include "wx/stattext.h" #include "wx/validate.h" #endif @@ -42,7 +39,7 @@ // implementation // ============================================================================ -IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl) +IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxGenericStaticText) // ---------------------------------------------------------------------------- // creation @@ -57,43 +54,45 @@ bool wxStaticText::Create(wxWindow *parent, const wxString &name) { if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) - return FALSE; - - m_hasDialogBackground = TRUE; + return false; SetLabel(label); - SetBestSize(size); + SetInitialSize(size); - return TRUE; + 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