]>
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 licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 // FIXME refresh just the right/bottom parts affected in OnSize
59 style
|= wxFULL_REPAINT_ON_RESIZE
;
61 if ( !wxControl::Create(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
69 void wxStaticBox::DoDraw(wxControlRenderer
*renderer
)
71 // we never have a border, so don't call the base class version which draws
73 renderer
->DrawFrame();
76 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
80 wxRect
wxStaticBox::GetBorderGeometry() const
82 // FIXME should use the renderer here
85 rect
.x
= GetCharWidth() / 2 + 1;
86 rect
.y
= GetCharHeight() + 1;
87 rect
.height
= rect
.y
/ 2;
92 wxPoint
wxStaticBox::GetBoxAreaOrigin() const
94 wxPoint pt
= wxControl::GetClientAreaOrigin();
95 wxRect rect
= GetBorderGeometry();
103 void wxStaticBox::DoSetClientSize(int width
, int height
)
105 wxRect rect
= GetBorderGeometry();
107 wxControl::DoSetClientSize(width
+ rect
.x
+ rect
.width
,
108 height
+ rect
.y
+ rect
.height
);
111 void wxStaticBox::DoGetClientSize(int *width
, int *height
) const
113 wxControl::DoGetClientSize(width
, height
);
115 wxRect rect
= GetBorderGeometry();
117 *width
-= rect
.x
+ rect
.width
;
119 *height
-= rect
.y
+ rect
.height
;
124 #endif // wxUSE_STATBOX