]> git.saurik.com Git - wxWidgets.git/blame - src/html/m_hline.cpp
No real changes, just make wxWindow::CanScroll() virtual.
[wxWidgets.git] / src / html / m_hline.cpp
CommitLineData
5526e819 1/////////////////////////////////////////////////////////////////////////////
93763ad5 2// Name: src/html/m_hline.cpp
5526e819
VS
3// Purpose: wxHtml module for horizontal line (HR tag)
4// Author: Vaclav Slavik
5// Copyright: (c) 1999 Vaclav Slavik
65571936 6// Licence: wxWindows licence
5526e819
VS
7/////////////////////////////////////////////////////////////////////////////
8
3096bd2f 9#include "wx/wxprec.h"
3364ab79 10
2b5f62a0 11#ifdef __BORLANDC__
93763ad5 12 #pragma hdrstop
3364ab79
RS
13#endif
14
93763ad5
WS
15#if wxUSE_HTML && wxUSE_STREAMS
16
b4f4d3dd 17#ifndef WX_PRECOMP
04dbb646
VZ
18 #include "wx/brush.h"
19 #include "wx/pen.h"
20 #include "wx/dc.h"
3364ab79
RS
21#endif
22
69941f05
VS
23#include "wx/html/forcelnk.h"
24#include "wx/html/m_templ.h"
5526e819 25
69941f05 26#include "wx/html/htmlcell.h"
5526e819 27
c88293a4 28FORCE_LINK_ME(m_hline)
5526e819
VS
29
30
31//-----------------------------------------------------------------------------
32// wxHtmlLineCell
33//-----------------------------------------------------------------------------
34
35class wxHtmlLineCell : public wxHtmlCell
36{
37 public:
51072df2 38 wxHtmlLineCell(int size, bool shading) : wxHtmlCell() {m_Height = size; m_HasShading = shading;}
36c4ff4d 39 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
285f58ab 40 wxHtmlRenderingInfo& info);
d699f48b 41 void Layout(int w)
bf7d7ee7 42 { m_Width = w; wxHtmlCell::Layout(w); }
51072df2
VS
43
44 private:
45 // Should we draw 3-D shading or not
46 bool m_HasShading;
fc7a2a60 47
c0c133e1 48 wxDECLARE_NO_COPY_CLASS(wxHtmlLineCell);
5526e819
VS
49};
50
51
36c4ff4d 52void wxHtmlLineCell::Draw(wxDC& dc, int x, int y,
2a2e4f4a 53 int WXUNUSED(view_y1), int WXUNUSED(view_y2),
285f58ab 54 wxHtmlRenderingInfo& WXUNUSED(info))
5526e819 55{
04ee05f9
PC
56 wxBrush mybrush(wxT("GREY"), (m_HasShading) ? wxBRUSHSTYLE_TRANSPARENT : wxBRUSHSTYLE_SOLID);
57 wxPen mypen(wxT("GREY"), 1, wxPENSTYLE_SOLID);
5526e819
VS
58 dc.SetBrush(mybrush);
59 dc.SetPen(mypen);
60 dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
5526e819
VS
61}
62
63
64
65
66//-----------------------------------------------------------------------------
67// The list handler:
68//-----------------------------------------------------------------------------
69
70
71TAG_HANDLER_BEGIN(HR, "HR")
fc7a2a60 72 TAG_HANDLER_CONSTR(HR) { }
5526e819
VS
73
74 TAG_HANDLER_PROC(tag)
75 {
76 wxHtmlContainerCell *c;
77 int sz;
51072df2 78 bool HasShading;
5526e819 79
4f9297b0
VS
80 m_WParser->CloseContainer();
81 c = m_WParser->OpenContainer();
5526e819 82
4f9297b0
VS
83 c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL);
84 c->SetAlignHor(wxHTML_ALIGN_CENTER);
85 c->SetAlign(tag);
86 c->SetWidthFloat(tag);
ec74539c 87 sz = 1;
8bd72d90 88 tag.GetParamAsInt(wxT("SIZE"), &sz);
51072df2
VS
89 HasShading = !(tag.HasParam(wxT("NOSHADE")));
90 c->InsertCell(new wxHtmlLineCell((int)((double)sz * m_WParser->GetPixelScale()), HasShading));
5526e819 91
4f9297b0
VS
92 m_WParser->CloseContainer();
93 m_WParser->OpenContainer();
5526e819 94
d1da8872 95 return false;
5526e819
VS
96 }
97
98TAG_HANDLER_END(HR)
99
100
101
102
103
104TAGS_MODULE_BEGIN(HLine)
105
106 TAGS_MODULE_ADD(HR)
107
108TAGS_MODULE_END(HLine)
109
110#endif