]> git.saurik.com Git - wxWidgets.git/blob - src/univ/statline.cpp
honour min/max size in wxMGL's wxWindow::DoSetSize
[wxWidgets.git] / src / univ / statline.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "univstatline.h"
22 #endif
23
24 #include "wx/wxprec.h"
25
26 #ifdef __BORLANDC__
27 #pragma hdrstop
28 #endif
29
30 #if wxUSE_STATLINE
31
32 #ifndef WX_PRECOMP
33 #include "wx/dc.h"
34 #include "wx/validate.h"
35 #endif
36
37 #include "wx/statline.h"
38
39 #include "wx/univ/renderer.h"
40
41 // ============================================================================
42 // implementation
43 // ============================================================================
44
45 IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
46
47 // ----------------------------------------------------------------------------
48 // wxStaticLine
49 // ----------------------------------------------------------------------------
50
51 bool wxStaticLine::Create(wxWindow *parent,
52 wxWindowID id,
53 const wxPoint &pos,
54 const wxSize &size,
55 long style,
56 const wxString &name)
57 {
58 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
59 return FALSE;
60
61 wxSize sizeReal = AdjustSize(size);
62 if ( sizeReal != size )
63 SetSize(sizeReal);
64
65 return TRUE;
66 }
67
68 void wxStaticLine::DoDraw(wxControlRenderer *renderer)
69 {
70 // we never have a border, so don't call the base class version whcih draws
71 // it
72 wxSize sz = GetSize();
73 wxCoord x2, y2;
74 if ( IsVertical() )
75 {
76 x2 = 0;
77 y2 = sz.y;
78 }
79 else // horizontal
80 {
81 x2 = sz.x;
82 y2 = 0;
83 }
84
85 renderer->DrawLine(0, 0, x2, y2);
86 }
87
88 #endif // wxUSE_STATLINE
89