]>
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 | |
7 | // RCS-ID: $Id$ | |
442b35b5 | 8 | // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) |
65571936 | 9 | // Licence: wxWindows licence |
1e6feb95 VZ |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
1e6feb95 VZ |
20 | #include "wx/wxprec.h" |
21 | ||
22 | #ifdef __BORLANDC__ | |
23 | #pragma hdrstop | |
24 | #endif | |
25 | ||
26 | #if wxUSE_STATTEXT | |
27 | ||
ccdc11bb WS |
28 | #include "wx/stattext.h" |
29 | ||
1e6feb95 VZ |
30 | #ifndef WX_PRECOMP |
31 | #include "wx/dcclient.h" | |
1e6feb95 VZ |
32 | #include "wx/validate.h" |
33 | #endif | |
34 | ||
35 | #include "wx/univ/renderer.h" | |
36 | #include "wx/univ/theme.h" | |
37 | ||
38 | // ============================================================================ | |
39 | // implementation | |
40 | // ============================================================================ | |
41 | ||
42 | // ---------------------------------------------------------------------------- | |
43 | // creation | |
44 | // ---------------------------------------------------------------------------- | |
45 | ||
46 | bool wxStaticText::Create(wxWindow *parent, | |
47 | wxWindowID id, | |
48 | const wxString &label, | |
49 | const wxPoint &pos, | |
50 | const wxSize &size, | |
51 | long style, | |
52 | const wxString &name) | |
53 | { | |
54 | if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) | |
a290fa5a | 55 | return false; |
ccdc11bb | 56 | |
1e6feb95 | 57 | SetLabel(label); |
170acdc9 | 58 | SetInitialSize(size); |
1e6feb95 | 59 | |
a290fa5a | 60 | return true; |
1e6feb95 VZ |
61 | } |
62 | ||
1e6feb95 VZ |
63 | // ---------------------------------------------------------------------------- |
64 | // drawing | |
65 | // ---------------------------------------------------------------------------- | |
66 | ||
67 | void wxStaticText::DoDraw(wxControlRenderer *renderer) | |
68 | { | |
69 | renderer->DrawLabel(); | |
70 | } | |
71 | ||
39bc0347 VZ |
72 | void wxStaticText::SetLabel(const wxString& str) |
73 | { | |
74 | // save original label | |
75 | m_labelOrig = str; | |
76 | ||
3da9cffc VZ |
77 | // draw as real label the abbreviated version of it |
78 | DoSetLabel(GetEllipsizedLabel()); | |
39bc0347 VZ |
79 | } |
80 | ||
81 | void wxStaticText::DoSetLabel(const wxString& str) | |
82 | { | |
83 | UnivDoSetLabel(str); | |
84 | } | |
85 | ||
86 | wxString wxStaticText::DoGetLabel() const | |
87 | { | |
88 | return wxControl::GetLabel(); | |
89 | } | |
90 | ||
91 | /* | |
92 | FIXME: UpdateLabel() should be called on size events to allow correct | |
93 | dynamic ellipsizing of the label | |
94 | */ | |
95 | ||
1e6feb95 | 96 | #endif // wxUSE_STATTEXT |