]> git.saurik.com Git - wxWidgets.git/blob - src/univ/statbox.cpp
fix for HP and IBM compilers, calls to static template functions must be qualified
[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 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
41
42 // ----------------------------------------------------------------------------
43 // wxStaticBox
44 // ----------------------------------------------------------------------------
45
46 bool wxStaticBox::Create(wxWindow *parent,
47 wxWindowID id,
48 const wxString &label,
49 const wxPoint &pos,
50 const wxSize &size,
51 long style,
52 const wxString &name)
53 {
54 // FIXME refresh just the right/bottom parts affected in OnSize
55 style |= wxFULL_REPAINT_ON_RESIZE;
56
57 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
58 return false;
59
60 SetLabel(label);
61
62 return true;
63 }
64
65 void wxStaticBox::DoDraw(wxControlRenderer *renderer)
66 {
67 // we never have a border, so don't call the base class version which draws
68 // it
69 renderer->DrawFrame();
70 }
71
72 // ----------------------------------------------------------------------------
73 // geometry
74 // ----------------------------------------------------------------------------
75
76 wxRect wxStaticBox::GetBorderGeometry() const
77 {
78 // FIXME should use the renderer here
79 wxRect rect;
80 rect.width =
81 rect.x = GetCharWidth() / 2 + 1;
82 rect.y = GetCharHeight() + 1;
83 rect.height = rect.y / 2;
84
85 return rect;
86 }
87
88 wxPoint wxStaticBox::GetBoxAreaOrigin() const
89 {
90 wxPoint pt = wxControl::GetClientAreaOrigin();
91 wxRect rect = GetBorderGeometry();
92 pt.x += rect.x;
93 pt.y += rect.y;
94
95 return pt;
96 }
97
98 #if 0
99 void wxStaticBox::DoSetClientSize(int width, int height)
100 {
101 wxRect rect = GetBorderGeometry();
102
103 wxControl::DoSetClientSize(width + rect.x + rect.width,
104 height + rect.y + rect.height);
105 }
106
107 void wxStaticBox::DoGetClientSize(int *width, int *height) const
108 {
109 wxControl::DoGetClientSize(width, height);
110
111 wxRect rect = GetBorderGeometry();
112 if ( width )
113 *width -= rect.x + rect.width;
114 if ( height )
115 *height -= rect.y + rect.height;
116 }
117
118 #endif // 0
119
120 #endif // wxUSE_STATBOX
121