]> git.saurik.com Git - wxWidgets.git/blame - src/univ/statbox.cpp
call SetWindowPos(SWP_FRAMECHANGED) after changing some styles (patch 1445096)
[wxWidgets.git] / src / univ / statbox.cpp
CommitLineData
1e6feb95
VZ
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$
442b35b5 8// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
1e6feb95
VZ
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
40IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
41
42// ----------------------------------------------------------------------------
43// wxStaticBox
44// ----------------------------------------------------------------------------
45
46bool 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{
3dddebb1
MW
54 // FIXME refresh just the right/bottom parts affected in OnSize
55 style |= wxFULL_REPAINT_ON_RESIZE;
56
1e6feb95 57 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
a290fa5a 58 return false;
1e6feb95
VZ
59
60 SetLabel(label);
61
a290fa5a 62 return true;
1e6feb95
VZ
63}
64
65void 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
76wxRect 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
88wxPoint 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
99void 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
107void 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