]> git.saurik.com Git - wxWidgets.git/blob - src/generic/statline.cpp
Improved size handling.
[wxWidgets.git] / src / generic / statline.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: generic/statline.cpp
3 // Purpose: a generic wxStaticLine class
4 // Author: Vadim Zeitlin
5 // Created: 28.06.99
6 // Version: $Id$
7 // Copyright: (c) 1998 Vadim Zeitlin
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/wxprec.h"
20 #if wxUSE_STATLINE
21 // For compilers that support precompilation, includes "wx.h".
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #include "wx/statline.h"
28 #include "wx/statbox.h"
29
30 // ============================================================================
31 // implementation
32 // ============================================================================
33
34 IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
35
36 // ----------------------------------------------------------------------------
37 // wxStaticLine
38 // ----------------------------------------------------------------------------
39
40 bool wxStaticLine::Create( wxWindow *parent,
41 wxWindowID id,
42 const wxPoint &pos,
43 const wxSize &size,
44 long style,
45 const wxString &name)
46 {
47 m_statbox = NULL;
48
49 if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
50 return false;
51
52 // ok, this is ugly but it's better than nothing: use a thin static box to
53 // emulate static line
54
55 wxSize sizeReal = AdjustSize(size);
56
57 m_statbox = new wxStaticBox(parent, id, wxEmptyString, pos, sizeReal, style, name);
58
59 return true;
60 }
61
62 wxStaticLine::~wxStaticLine()
63 {
64 delete m_statbox;
65 }
66
67 WXWidget wxStaticLine::GetMainWidget() const
68 {
69 return m_statbox->GetMainWidget();
70 }
71
72 void wxStaticLine::DoSetSize(int x, int y, int width, int height, int sizeFlags)
73 {
74 m_statbox->SetSize(x, y, width, height, sizeFlags);
75 }
76
77 void wxStaticLine::DoMoveWindow(int x, int y, int width, int height)
78 {
79 m_statbox->SetSize(x, y, width, height);
80 }
81
82 #endif
83 // wxUSE_STATLINE