]> git.saurik.com Git - wxWidgets.git/blame - src/html/mod_hline.cpp
Changes for mingw32/gcc-2.95
[wxWidgets.git] / src / html / mod_hline.cpp
CommitLineData
5526e819
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: mod_hline.cpp
3// Purpose: wxHtml module for horizontal line (HR tag)
4// Author: Vaclav Slavik
5// Copyright: (c) 1999 Vaclav Slavik
6// Licence: wxWindows Licence
7/////////////////////////////////////////////////////////////////////////////
8
3364ab79
RS
9#ifdef __GNUG__
10#pragma implementation
11#endif
12
13#include <wx/wxprec.h>
14
5526e819
VS
15
16#include "wx/defs.h"
17#if wxUSE_HTML
3364ab79
RS
18#ifdef __BORDLANDC__
19#pragma hdrstop
20#endif
21
22#ifndef WXPRECOMP
23#include <wx/wx.h>
24#endif
25
26
5526e819
VS
27
28#include <wx/html/forcelink.h>
29#include <wx/html/mod_templ.h>
30
31#include <wx/html/htmlcell.h>
32
33FORCE_LINK_ME(mod_hline)
34
35
36//-----------------------------------------------------------------------------
37// wxHtmlLineCell
38//-----------------------------------------------------------------------------
39
40class wxHtmlLineCell : public wxHtmlCell
41{
42 public:
43 wxHtmlLineCell(int size) : wxHtmlCell() {m_Height = size;}
44 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
45 void Layout(int w) {m_Width = w; if (m_Next) m_Next -> Layout(w);}
46};
47
48
49void wxHtmlLineCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
50{
51 wxBrush mybrush("BLACK", wxSOLID);
52 wxPen mypen("BLACK", 1, wxSOLID);
53 dc.SetBrush(mybrush);
54 dc.SetPen(mypen);
55 dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
56 wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
57}
58
59
60
61
62//-----------------------------------------------------------------------------
63// The list handler:
64//-----------------------------------------------------------------------------
65
66
67TAG_HANDLER_BEGIN(HR, "HR")
68
69 TAG_HANDLER_PROC(tag)
70 {
71 wxHtmlContainerCell *c;
72 int sz;
73
74 m_WParser -> CloseContainer();
75 c = m_WParser -> OpenContainer();
76
77 c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_VERTICAL);
78 c -> SetAlignHor(HTML_ALIGN_CENTER);
79 c -> SetAlign(tag);
80 c -> SetWidthFloat(tag);
72aa4a98 81 if (tag.HasParam("SIZE") && tag.ScanParam("SIZE", "%i", &sz) == 1) {}
5526e819
VS
82 else sz = 1;
83 c -> InsertCell(new wxHtmlLineCell(sz));
84
85 m_WParser -> CloseContainer();
86 m_WParser -> OpenContainer();
87
88 return FALSE;
89 }
90
91TAG_HANDLER_END(HR)
92
93
94
95
96
97TAGS_MODULE_BEGIN(HLine)
98
99 TAGS_MODULE_ADD(HR)
100
101TAGS_MODULE_END(HLine)
102
103#endif