]> git.saurik.com Git - wxWidgets.git/blob - src/univ/statbox.cpp
Use wxMarkupParser in wxStaticText for dealing with markup.
[wxWidgets.git] / src / univ / statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: univ/statbox.cpp
3 // Purpose: wxStaticBox implementation
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 25.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_STATBOX
27
28 #ifndef WX_PRECOMP
29 #include "wx/dc.h"
30 #include "wx/statbox.h"
31 #include "wx/validate.h"
32 #endif
33
34 #include "wx/univ/renderer.h"
35
36 // ============================================================================
37 // implementation
38 // ============================================================================
39
40 // ----------------------------------------------------------------------------
41 // wxStaticBox
42 // ----------------------------------------------------------------------------
43
44 bool wxStaticBox::Create(wxWindow *parent,
45 wxWindowID id,
46 const wxString &label,
47 const wxPoint &pos,
48 const wxSize &size,
49 long style,
50 const wxString &name)
51 {
52 // FIXME refresh just the right/bottom parts affected in OnSize
53 style |= wxFULL_REPAINT_ON_RESIZE;
54
55 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
56 return false;
57
58 SetLabel(label);
59
60 return true;
61 }
62
63 void wxStaticBox::DoDraw(wxControlRenderer *renderer)
64 {
65 // we never have a border, so don't call the base class version which draws
66 // it
67 renderer->DrawFrame();
68 }
69
70 // ----------------------------------------------------------------------------
71 // geometry
72 // ----------------------------------------------------------------------------
73
74 wxRect wxStaticBox::GetBorderGeometry() const
75 {
76 // FIXME should use the renderer here
77 wxRect rect;
78 rect.width =
79 rect.x = GetCharWidth() / 2 + 1;
80 rect.y = GetCharHeight() + 1;
81 rect.height = rect.y / 2;
82
83 return rect;
84 }
85
86 wxPoint wxStaticBox::GetBoxAreaOrigin() const
87 {
88 wxPoint pt = wxControl::GetClientAreaOrigin();
89 wxRect rect = GetBorderGeometry();
90 pt.x += rect.x;
91 pt.y += rect.y;
92
93 return pt;
94 }
95
96 #if 0
97 void wxStaticBox::DoSetClientSize(int width, int height)
98 {
99 wxRect rect = GetBorderGeometry();
100
101 wxControl::DoSetClientSize(width + rect.x + rect.width,
102 height + rect.y + rect.height);
103 }
104
105 void wxStaticBox::DoGetClientSize(int *width, int *height) const
106 {
107 wxControl::DoGetClientSize(width, height);
108
109 wxRect rect = GetBorderGeometry();
110 if ( width )
111 *width -= rect.x + rect.width;
112 if ( height )
113 *height -= rect.y + rect.height;
114 }
115
116 #endif // 0
117
118 #endif // wxUSE_STATBOX
119