]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/stattext.cpp
reset the tooltip text before changing it, this apparently prevents a spurious redraw...
[wxWidgets.git] / src / univ / stattext.cpp
index 83ebf31eaf51cec685a486fd40f6a7f838eb51f7..3fccad27643efa2376a18f8eea8adccaefbc1a3f 100644 (file)
@@ -39,7 +39,7 @@
 // implementation
 // ============================================================================
 
-IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl)
+IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxGenericStaticText)
 
 // ----------------------------------------------------------------------------
 // creation
@@ -63,40 +63,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 result of GetEllipsizedLabelWithoutMarkup:
+    DoSetLabel(GetEllipsizedLabelWithoutMarkup());
 }
 
-// ----------------------------------------------------------------------------
-// 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