X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..4b5d2be39657bb364c9111c4d13b1eecb8f3b69f:/src/univ/stattext.cpp diff --git a/src/univ/stattext.cpp b/src/univ/stattext.cpp index 2ea90b3ee2..f854398a17 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 Vadim Zeitlin -// Licence: wxWindows license +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) +// 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,6 +39,8 @@ // implementation // ============================================================================ +IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl) + // ---------------------------------------------------------------------------- // creation // ---------------------------------------------------------------------------- @@ -55,23 +54,18 @@ bool wxStaticText::Create(wxWindow *parent, const wxString &name) { if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) - return FALSE; + return false; SetLabel(label); - SetBestSize(size); + SetInitialSize(size); - return TRUE; + return true; } // ---------------------------------------------------------------------------- // size management // ---------------------------------------------------------------------------- -void wxStaticText::SetLabel(const wxString& label) -{ - wxControl::SetLabel(label); -} - wxSize wxStaticText::DoGetBestClientSize() const { wxStaticText *self = wxConstCast(this, wxStaticText); @@ -92,4 +86,28 @@ void wxStaticText::DoDraw(wxControlRenderer *renderer) renderer->DrawLabel(); } +void wxStaticText::SetLabel(const wxString& str) +{ + // save original label + m_labelOrig = str; + + // draw as real label the result of GetEllipsizedLabelWithoutMarkup: + DoSetLabel(GetEllipsizedLabelWithoutMarkup()); +} + +void wxStaticText::DoSetLabel(const wxString& str) +{ + UnivDoSetLabel(str); +} + +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