]> git.saurik.com Git - wxWidgets.git/blame - src/univ/stattext.cpp
Corrected wxFileSystemHandler::GetRightLocation for the case
[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)
6aa89a22 9// Licence: wxWindows licence
1e6feb95
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
14f355c2 20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 61
1e6feb95
VZ
62 SetLabel(label);
63 SetBestSize(size);
64
65 return TRUE;
66}
67
68// ----------------------------------------------------------------------------
69// size management
70// ----------------------------------------------------------------------------
71
72void wxStaticText::SetLabel(const wxString& label)
73{
74 wxControl::SetLabel(label);
75}
76
77wxSize 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
92void wxStaticText::DoDraw(wxControlRenderer *renderer)
93{
94 renderer->DrawLabel();
95}
96
97#endif // wxUSE_STATTEXT