]> git.saurik.com Git - wxWidgets.git/blame - src/univ/stattext.cpp
Fix wxListCtrl background colour bug Part I
[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)
1e6feb95
VZ
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#ifdef __GNUG__
a3870b2f 21 #pragma implementation "univstattext.h"
1e6feb95
VZ
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
3379ed37
VZ
45IMPLEMENT_ABSTRACT_CLASS(wxStaticText, wxControl)
46
1e6feb95
VZ
47// ----------------------------------------------------------------------------
48// creation
49// ----------------------------------------------------------------------------
50
51bool 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;
67d947ba
RR
61
62 m_hasDialogBackground = TRUE;
1e6feb95
VZ
63
64 SetLabel(label);
65 SetBestSize(size);
66
67 return TRUE;
68}
69
70// ----------------------------------------------------------------------------
71// size management
72// ----------------------------------------------------------------------------
73
74void wxStaticText::SetLabel(const wxString& label)
75{
76 wxControl::SetLabel(label);
77}
78
79wxSize wxStaticText::DoGetBestClientSize() const
80{
81 wxStaticText *self = wxConstCast(this, wxStaticText);
82 wxClientDC dc(self);
83 dc.SetFont(GetFont());
84 wxCoord width, height;
85 dc.GetMultiLineTextExtent(GetLabel(), &width, &height);
86
87 return wxSize(width, height);
88}
89
90// ----------------------------------------------------------------------------
91// drawing
92// ----------------------------------------------------------------------------
93
94void wxStaticText::DoDraw(wxControlRenderer *renderer)
95{
96 renderer->DrawLabel();
97}
98
99#endif // wxUSE_STATTEXT