]>
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 SciTech Software, Inc. (www.scitechsoft.com)
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
) )
61 m_hasDialogBackground
= TRUE
;
68 void wxStaticBox::DoDraw(wxControlRenderer
*renderer
)
70 // we never have a border, so don't call the base class version which draws
72 renderer
->DrawFrame();
75 // ----------------------------------------------------------------------------
77 // ----------------------------------------------------------------------------
79 wxRect
wxStaticBox::GetBorderGeometry() const
81 // FIXME should use the renderer here
84 rect
.x
= GetCharWidth() / 2 + 1;
85 rect
.y
= GetCharHeight() + 1;
86 rect
.height
= rect
.y
/ 2;
91 wxPoint
wxStaticBox::GetBoxAreaOrigin() const
93 wxPoint pt
= wxControl::GetClientAreaOrigin();
94 wxRect rect
= GetBorderGeometry();
102 void wxStaticBox::DoSetClientSize(int width
, int height
)
104 wxRect rect
= GetBorderGeometry();
106 wxControl::DoSetClientSize(width
+ rect
.x
+ rect
.width
,
107 height
+ rect
.y
+ rect
.height
);
110 void wxStaticBox::DoGetClientSize(int *width
, int *height
) const
112 wxControl::DoGetClientSize(width
, height
);
114 wxRect rect
= GetBorderGeometry();
116 *width
-= rect
.x
+ rect
.width
;
118 *height
-= rect
.y
+ rect
.height
;
123 #endif // wxUSE_STATBOX