]> git.saurik.com Git - wxWidgets.git/blob - src/univ/stattext.cpp
Include wx/arrstr.h according to precompiled headers of wx/wx.h (with other minor...
[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 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_STATTEXT
27
28 #include "wx/stattext.h"
29
30 #ifndef WX_PRECOMP
31 #include "wx/dcclient.h"
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 IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl)
43
44 // ----------------------------------------------------------------------------
45 // creation
46 // ----------------------------------------------------------------------------
47
48 bool wxStaticText::Create(wxWindow *parent,
49 wxWindowID id,
50 const wxString &label,
51 const wxPoint &pos,
52 const wxSize &size,
53 long style,
54 const wxString &name)
55 {
56 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
57 return false;
58
59 SetLabel(label);
60 SetBestSize(size);
61
62 return true;
63 }
64
65 // ----------------------------------------------------------------------------
66 // size management
67 // ----------------------------------------------------------------------------
68
69 void wxStaticText::SetLabel(const wxString& label)
70 {
71 wxControl::SetLabel(label);
72 }
73
74 wxSize wxStaticText::DoGetBestClientSize() const
75 {
76 wxStaticText *self = wxConstCast(this, wxStaticText);
77 wxClientDC dc(self);
78 dc.SetFont(GetFont());
79 wxCoord width, height;
80 dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
81
82 return wxSize(width, height);
83 }
84
85 // ----------------------------------------------------------------------------
86 // drawing
87 // ----------------------------------------------------------------------------
88
89 void wxStaticText::DoDraw(wxControlRenderer *renderer)
90 {
91 renderer->DrawLabel();
92 }
93
94 #endif // wxUSE_STATTEXT