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