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