]> git.saurik.com Git - wxWidgets.git/blob - src/univ/stattext.cpp
implemented IPC using Unix domain sockets
[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 license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
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 m_hasDialogBackground = TRUE;
63
64 SetLabel(label);
65 SetBestSize(size);
66
67 return TRUE;
68 }
69
70 // ----------------------------------------------------------------------------
71 // size management
72 // ----------------------------------------------------------------------------
73
74 void wxStaticText::SetLabel(const wxString& label)
75 {
76 wxControl::SetLabel(label);
77 }
78
79 wxSize 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
94 void wxStaticText::DoDraw(wxControlRenderer *renderer)
95 {
96 renderer->DrawLabel();
97 }
98
99 #endif // wxUSE_STATTEXT