]> git.saurik.com Git - wxWidgets.git/blame - src/html/m_hline.cpp
using separate imaglist on mac
[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 6// Copyright: (c) 1999 Vaclav Slavik
65571936 7// Licence: wxWindows licence
5526e819
VS
8/////////////////////////////////////////////////////////////////////////////
9
14f355c2 10#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
3364ab79
RS
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
2b5f62a0 19#ifdef __BORLANDC__
3364ab79
RS
20#pragma hdrstop
21#endif
22
23#ifndef WXPRECOMP
04dbb646
VZ
24 #include "wx/brush.h"
25 #include "wx/pen.h"
26 #include "wx/dc.h"
3364ab79
RS
27#endif
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:
51072df2 44 wxHtmlLineCell(int size, bool shading) : wxHtmlCell() {m_Height = size; m_HasShading = shading;}
36c4ff4d 45 void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
285f58ab 46 wxHtmlRenderingInfo& info);
d699f48b 47 void Layout(int w)
bf7d7ee7 48 { m_Width = w; wxHtmlCell::Layout(w); }
51072df2
VS
49
50 private:
51 // Should we draw 3-D shading or not
52 bool m_HasShading;
fc7a2a60
VZ
53
54 DECLARE_NO_COPY_CLASS(wxHtmlLineCell)
5526e819
VS
55};
56
57
36c4ff4d 58void wxHtmlLineCell::Draw(wxDC& dc, int x, int y,
2a2e4f4a 59 int WXUNUSED(view_y1), int WXUNUSED(view_y2),
285f58ab 60 wxHtmlRenderingInfo& WXUNUSED(info))
5526e819 61{
51072df2
VS
62 wxBrush mybrush(wxT("GREY"), (m_HasShading) ? wxTRANSPARENT : wxSOLID);
63 wxPen mypen(wxT("GREY"), 1, wxSOLID);
5526e819
VS
64 dc.SetBrush(mybrush);
65 dc.SetPen(mypen);
66 dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
5526e819
VS
67}
68
69
70
71
72//-----------------------------------------------------------------------------
73// The list handler:
74//-----------------------------------------------------------------------------
75
76
77TAG_HANDLER_BEGIN(HR, "HR")
fc7a2a60 78 TAG_HANDLER_CONSTR(HR) { }
5526e819
VS
79
80 TAG_HANDLER_PROC(tag)
81 {
82 wxHtmlContainerCell *c;
83 int sz;
51072df2 84 bool HasShading;
5526e819 85
4f9297b0
VS
86 m_WParser->CloseContainer();
87 c = m_WParser->OpenContainer();
5526e819 88
4f9297b0
VS
89 c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL);
90 c->SetAlignHor(wxHTML_ALIGN_CENTER);
91 c->SetAlign(tag);
92 c->SetWidthFloat(tag);
ec74539c 93 sz = 1;
8bd72d90 94 tag.GetParamAsInt(wxT("SIZE"), &sz);
51072df2
VS
95 HasShading = !(tag.HasParam(wxT("NOSHADE")));
96 c->InsertCell(new wxHtmlLineCell((int)((double)sz * m_WParser->GetPixelScale()), HasShading));
5526e819 97
4f9297b0
VS
98 m_WParser->CloseContainer();
99 m_WParser->OpenContainer();
5526e819 100
d1da8872 101 return false;
5526e819
VS
102 }
103
104TAG_HANDLER_END(HR)
105
106
107
108
109
110TAGS_MODULE_BEGIN(HLine)
111
112 TAGS_MODULE_ADD(HR)
113
114TAGS_MODULE_END(HLine)
115
116#endif