]> git.saurik.com Git - wxWidgets.git/blob - src/univ/stattext.cpp
Alter focus handling to disable GTK+ standard
[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 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_STATTEXT
27
28 #ifndef WX_PRECOMP
29 #include "wx/dcclient.h"
30 #include "wx/stattext.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 IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl)
42
43 // ----------------------------------------------------------------------------
44 // creation
45 // ----------------------------------------------------------------------------
46
47 bool wxStaticText::Create(wxWindow *parent,
48 wxWindowID id,
49 const wxString &label,
50 const wxPoint &pos,
51 const wxSize &size,
52 long style,
53 const wxString &name)
54 {
55 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
56 return false;
57
58 SetLabel(label);
59 SetBestSize(size);
60
61 return true;
62 }
63
64 // ----------------------------------------------------------------------------
65 // size management
66 // ----------------------------------------------------------------------------
67
68 void wxStaticText::SetLabel(const wxString& label)
69 {
70 wxControl::SetLabel(label);
71 }
72
73 wxSize wxStaticText::DoGetBestClientSize() const
74 {
75 wxStaticText *self = wxConstCast(this, wxStaticText);
76 wxClientDC dc(self);
77 dc.SetFont(GetFont());
78 wxCoord width, height;
79 dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
80
81 return wxSize(width, height);
82 }
83
84 // ----------------------------------------------------------------------------
85 // drawing
86 // ----------------------------------------------------------------------------
87
88 void wxStaticText::DoDraw(wxControlRenderer *renderer)
89 {
90 renderer->DrawLabel();
91 }
92
93 #endif // wxUSE_STATTEXT