]> git.saurik.com Git - wxWidgets.git/blame - src/univ/statline.cpp
minimize searching for tlw parent, remove useless code
[wxWidgets.git] / src / univ / statline.cpp
CommitLineData
1e6feb95
VZ
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$
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_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
41IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
42
43// ----------------------------------------------------------------------------
44// wxStaticLine
45// ----------------------------------------------------------------------------
46
47bool wxStaticLine::Create(wxWindow *parent,
48 wxWindowID id,
49 const wxPoint &pos,
50 const wxSize &size,
51 long style,
52 const wxString &name)
53{
54 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
a290fa5a 55 return false;
1e6feb95
VZ
56
57 wxSize sizeReal = AdjustSize(size);
58 if ( sizeReal != size )
59 SetSize(sizeReal);
60
a290fa5a 61 return true;
1e6feb95
VZ
62}
63
64void wxStaticLine::DoDraw(wxControlRenderer *renderer)
65{
66 // we never have a border, so don't call the base class version whcih draws
67 // it
68 wxSize sz = GetSize();
69 wxCoord x2, y2;
70 if ( IsVertical() )
71 {
72 x2 = 0;
73 y2 = sz.y;
74 }
75 else // horizontal
76 {
77 x2 = sz.x;
78 y2 = 0;
79 }
80
81 renderer->DrawLine(0, 0, x2, y2);
82}
83
84#endif // wxUSE_STATLINE
85