1 /////////////////////////////////////////////////////////////////////////////
2 // Name: univ/statbox.cpp
3 // Purpose: wxStaticBox implementation
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #include "wx/wxprec.h"
30 #include "wx/statbox.h"
31 #include "wx/validate.h"
34 #include "wx/univ/renderer.h"
36 // ============================================================================
38 // ============================================================================
40 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 bool wxStaticBox::Create(wxWindow *parent,
48 const wxString &label,
54 // FIXME refresh just the right/bottom parts affected in OnSize
55 style |= wxFULL_REPAINT_ON_RESIZE;
57 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
65 void wxStaticBox::DoDraw(wxControlRenderer *renderer)
67 // we never have a border, so don't call the base class version which draws
69 renderer->DrawFrame();
72 // ----------------------------------------------------------------------------
74 // ----------------------------------------------------------------------------
76 wxRect wxStaticBox::GetBorderGeometry() const
78 // FIXME should use the renderer here
81 rect.x = GetCharWidth() / 2 + 1;
82 rect.y = GetCharHeight() + 1;
83 rect.height = rect.y / 2;
88 wxPoint wxStaticBox::GetBoxAreaOrigin() const
90 wxPoint pt = wxControl::GetClientAreaOrigin();
91 wxRect rect = GetBorderGeometry();
99 void wxStaticBox::DoSetClientSize(int width, int height)
101 wxRect rect = GetBorderGeometry();
103 wxControl::DoSetClientSize(width + rect.x + rect.width,
104 height + rect.y + rect.height);
107 void wxStaticBox::DoGetClientSize(int *width, int *height) const
109 wxControl::DoGetClientSize(width, height);
111 wxRect rect = GetBorderGeometry();
113 *width -= rect.x + rect.width;
115 *height -= rect.y + rect.height;
120 #endif // wxUSE_STATBOX