]>
git.saurik.com Git - wxWidgets.git/blob - src/univ/statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: univ/statbox.cpp
3 // Purpose: wxStaticBox implementation
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 Vadim Zeitlin
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "univstatbox.h"
24 #include "wx/wxprec.h"
34 #include "wx/statbox.h"
35 #include "wx/validate.h"
38 #include "wx/univ/renderer.h"
40 // ============================================================================
42 // ============================================================================
44 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
)
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 bool wxStaticBox::Create(wxWindow
*parent
,
52 const wxString
&label
,
58 if ( !wxControl::Create(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
66 void wxStaticBox::DoDraw(wxControlRenderer
*renderer
)
68 // we never have a border, so don't call the base class version which draws
70 renderer
->DrawFrame();
73 // ----------------------------------------------------------------------------
75 // ----------------------------------------------------------------------------
77 wxRect
wxStaticBox::GetBorderGeometry() const
79 // FIXME should use the renderer here
82 rect
.x
= GetCharWidth() / 2 + 1;
83 rect
.y
= GetCharHeight() + 1;
84 rect
.height
= rect
.y
/ 2;
89 wxPoint
wxStaticBox::GetBoxAreaOrigin() const
91 wxPoint pt
= wxControl::GetClientAreaOrigin();
92 wxRect rect
= GetBorderGeometry();
100 void wxStaticBox::DoSetClientSize(int width
, int height
)
102 wxRect rect
= GetBorderGeometry();
104 wxControl::DoSetClientSize(width
+ rect
.x
+ rect
.width
,
105 height
+ rect
.y
+ rect
.height
);
108 void wxStaticBox::DoGetClientSize(int *width
, int *height
) const
110 wxControl::DoGetClientSize(width
, height
);
112 wxRect rect
= GetBorderGeometry();
114 *width
-= rect
.x
+ rect
.width
;
116 *height
-= rect
.y
+ rect
.height
;
121 #endif // wxUSE_STATBOX