]> git.saurik.com Git - wxWidgets.git/blob - src/univ/stattext.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / univ / stattext.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/stattext.cpp
3 // Purpose: wxStaticText
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 14.08.00
7 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/wxprec.h"
20
21 #ifdef __BORLANDC__
22 #pragma hdrstop
23 #endif
24
25 #if wxUSE_STATTEXT
26
27 #include "wx/stattext.h"
28
29 #ifndef WX_PRECOMP
30 #include "wx/dcclient.h"
31 #include "wx/validate.h"
32 #endif
33
34 #include "wx/univ/renderer.h"
35 #include "wx/univ/theme.h"
36
37 // ============================================================================
38 // implementation
39 // ============================================================================
40
41 // ----------------------------------------------------------------------------
42 // creation
43 // ----------------------------------------------------------------------------
44
45 bool wxStaticText::Create(wxWindow *parent,
46 wxWindowID id,
47 const wxString &label,
48 const wxPoint &pos,
49 const wxSize &size,
50 long style,
51 const wxString &name)
52 {
53 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
54 return false;
55
56 SetLabel(label);
57 SetInitialSize(size);
58
59 return true;
60 }
61
62 // ----------------------------------------------------------------------------
63 // drawing
64 // ----------------------------------------------------------------------------
65
66 void wxStaticText::DoDraw(wxControlRenderer *renderer)
67 {
68 renderer->DrawLabel();
69 }
70
71 void wxStaticText::SetLabel(const wxString& str)
72 {
73 // save original label
74 m_labelOrig = str;
75
76 // draw as real label the abbreviated version of it
77 DoSetLabel(GetEllipsizedLabel());
78 }
79
80 void wxStaticText::DoSetLabel(const wxString& str)
81 {
82 UnivDoSetLabel(str);
83 }
84
85 wxString wxStaticText::DoGetLabel() const
86 {
87 return wxControl::GetLabel();
88 }
89
90 /*
91 FIXME: UpdateLabel() should be called on size events to allow correct
92 dynamic ellipsizing of the label
93 */
94
95 #endif // wxUSE_STATTEXT