]> git.saurik.com Git - wxWidgets.git/blob - src/univ/stattext.cpp
check that wxUSE_DATEPICKCTRL_GENERIC is defined before checking its value
[wxWidgets.git] / src / univ / stattext.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "univstattext.h"
22 #endif
23
24 #include "wx/wxprec.h"
25
26 #ifdef __BORLANDC__
27 #pragma hdrstop
28 #endif
29
30 #if wxUSE_STATTEXT
31
32 #ifndef WX_PRECOMP
33 #include "wx/dcclient.h"
34 #include "wx/stattext.h"
35 #include "wx/validate.h"
36 #endif
37
38 #include "wx/univ/renderer.h"
39 #include "wx/univ/theme.h"
40
41 // ============================================================================
42 // implementation
43 // ============================================================================
44
45 IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl)
46
47 // ----------------------------------------------------------------------------
48 // creation
49 // ----------------------------------------------------------------------------
50
51 bool wxStaticText::Create(wxWindow *parent,
52 wxWindowID id,
53 const wxString &label,
54 const wxPoint &pos,
55 const wxSize &size,
56 long style,
57 const wxString &name)
58 {
59 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
60 return false;
61
62 SetLabel(label);
63 SetBestSize(size);
64
65 return true;
66 }
67
68 // ----------------------------------------------------------------------------
69 // size management
70 // ----------------------------------------------------------------------------
71
72 void wxStaticText::SetLabel(const wxString& label)
73 {
74 wxControl::SetLabel(label);
75 }
76
77 wxSize wxStaticText::DoGetBestClientSize() const
78 {
79 wxStaticText *self = wxConstCast(this, wxStaticText);
80 wxClientDC dc(self);
81 dc.SetFont(GetFont());
82 wxCoord width, height;
83 dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
84
85 return wxSize(width, height);
86 }
87
88 // ----------------------------------------------------------------------------
89 // drawing
90 // ----------------------------------------------------------------------------
91
92 void wxStaticText::DoDraw(wxControlRenderer *renderer)
93 {
94 renderer->DrawLabel();
95 }
96
97 #endif // wxUSE_STATTEXT