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