]>
Commit | Line | Data |
---|---|---|
1e6feb95 | 1 | ///////////////////////////////////////////////////////////////////////////// |
ccdc11bb | 2 | // Name: src/univ/stattext.cpp |
1e6feb95 VZ |
3 | // Purpose: wxStaticText |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 14.08.00 | |
442b35b5 | 7 | // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) |
65571936 | 8 | // Licence: wxWindows licence |
1e6feb95 VZ |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | // ============================================================================ | |
12 | // declarations | |
13 | // ============================================================================ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
1e6feb95 VZ |
19 | #include "wx/wxprec.h" |
20 | ||
21 | #ifdef __BORLANDC__ | |
22 | #pragma hdrstop | |
23 | #endif | |
24 | ||
25 | #if wxUSE_STATTEXT | |
26 | ||
ccdc11bb WS |
27 | #include "wx/stattext.h" |
28 | ||
1e6feb95 VZ |
29 | #ifndef WX_PRECOMP |
30 | #include "wx/dcclient.h" | |
1e6feb95 VZ |
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) ) | |
a290fa5a | 54 | return false; |
ccdc11bb | 55 | |
1e6feb95 | 56 | SetLabel(label); |
170acdc9 | 57 | SetInitialSize(size); |
1e6feb95 | 58 | |
a290fa5a | 59 | return true; |
1e6feb95 VZ |
60 | } |
61 | ||
1e6feb95 VZ |
62 | // ---------------------------------------------------------------------------- |
63 | // drawing | |
64 | // ---------------------------------------------------------------------------- | |
65 | ||
66 | void wxStaticText::DoDraw(wxControlRenderer *renderer) | |
67 | { | |
68 | renderer->DrawLabel(); | |
69 | } | |
70 | ||
39bc0347 VZ |
71 | void wxStaticText::SetLabel(const wxString& str) |
72 | { | |
73 | // save original label | |
74 | m_labelOrig = str; | |
75 | ||
3da9cffc VZ |
76 | // draw as real label the abbreviated version of it |
77 | DoSetLabel(GetEllipsizedLabel()); | |
39bc0347 VZ |
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 | ||
1e6feb95 | 95 | #endif // wxUSE_STATTEXT |