]> git.saurik.com Git - wxWidgets.git/blame - src/univ/stattext.cpp
GTK2: gtk_widget_set_usize -> gtk_widget_set_size_request
[wxWidgets.git] / src / univ / stattext.cpp
CommitLineData
1e6feb95
VZ
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$
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
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
3379ed37
VZ
41IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl)
42
1e6feb95
VZ
43// ----------------------------------------------------------------------------
44// creation
45// ----------------------------------------------------------------------------
46
47bool 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) )
a290fa5a 56 return false;
67d947ba 57
1e6feb95
VZ
58 SetLabel(label);
59 SetBestSize(size);
60
a290fa5a 61 return true;
1e6feb95
VZ
62}
63
64// ----------------------------------------------------------------------------
65// size management
66// ----------------------------------------------------------------------------
67
68void wxStaticText::SetLabel(const wxString& label)
69{
70 wxControl::SetLabel(label);
71}
72
73wxSize 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
88void wxStaticText::DoDraw(wxControlRenderer *renderer)
89{
90 renderer->DrawLabel();
91}
92
93#endif // wxUSE_STATTEXT