Fix crash when getting or setting wxComboBox value in wxUniv.
[wxWidgets.git] / src / univ / statline.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/statline.cpp
3 // Purpose: wxStaticLine implementation
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 25.08.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_STATLINE
27
28 #ifndef WX_PRECOMP
29 #include "wx/dc.h"
30 #include "wx/validate.h"
31 #endif
32
33 #include "wx/statline.h"
34
35 #include "wx/univ/renderer.h"
36
37 // ============================================================================
38 // implementation
39 // ============================================================================
40
41 // ----------------------------------------------------------------------------
42 // wxStaticLine
43 // ----------------------------------------------------------------------------
44
45 bool wxStaticLine::Create(wxWindow *parent,
46 wxWindowID id,
47 const wxPoint &pos,
48 const wxSize &size,
49 long style,
50 const wxString &name)
51 {
52 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
53 return false;
54
55 wxSize sizeReal = AdjustSize(size);
56 if ( sizeReal != size )
57 SetSize(sizeReal);
58
59 return true;
60 }
61
62 void wxStaticLine::DoDraw(wxControlRenderer *renderer)
63 {
64 // we never have a border, so don't call the base class version whcih draws
65 // it
66 wxSize sz = GetSize();
67 wxCoord x2, y2;
68 if ( IsVertical() )
69 {
70 x2 = 0;
71 y2 = sz.y;
72 }
73 else // horizontal
74 {
75 x2 = sz.x;
76 y2 = 0;
77 }
78
79 renderer->DrawLine(0, 0, x2, y2);
80 }
81
82 #endif // wxUSE_STATLINE
83