]>
git.saurik.com Git - wxWidgets.git/blob - src/html/m_hline.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHtml module for horizontal line (HR tag)
4 // Author: Vaclav Slavik
6 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
13 #if wxUSE_HTML && wxUSE_STREAMS
24 #include "wx/html/forcelnk.h"
25 #include "wx/html/m_templ.h"
27 #include "wx/html/htmlcell.h"
29 FORCE_LINK_ME(m_hline
)
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 class wxHtmlLineCell
: public wxHtmlCell
39 wxHtmlLineCell(int size
, bool shading
) : wxHtmlCell() {m_Height
= size
; m_HasShading
= shading
;}
40 void Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
,
41 wxHtmlRenderingInfo
& info
);
43 { m_Width
= w
; wxHtmlCell::Layout(w
); }
46 // Should we draw 3-D shading or not
49 DECLARE_NO_COPY_CLASS(wxHtmlLineCell
)
53 void wxHtmlLineCell::Draw(wxDC
& dc
, int x
, int y
,
54 int WXUNUSED(view_y1
), int WXUNUSED(view_y2
),
55 wxHtmlRenderingInfo
& WXUNUSED(info
))
57 wxBrush
mybrush(wxT("GREY"), (m_HasShading
) ? wxTRANSPARENT
: wxSOLID
);
58 wxPen
mypen(wxT("GREY"), 1, wxSOLID
);
61 dc
.DrawRectangle(x
+ m_PosX
, y
+ m_PosY
, m_Width
, m_Height
);
67 //-----------------------------------------------------------------------------
69 //-----------------------------------------------------------------------------
72 TAG_HANDLER_BEGIN(HR
, "HR")
73 TAG_HANDLER_CONSTR(HR
) { }
77 wxHtmlContainerCell
*c
;
81 m_WParser
->CloseContainer();
82 c
= m_WParser
->OpenContainer();
84 c
->SetIndent(m_WParser
->GetCharHeight(), wxHTML_INDENT_VERTICAL
);
85 c
->SetAlignHor(wxHTML_ALIGN_CENTER
);
87 c
->SetWidthFloat(tag
);
89 tag
.GetParamAsInt(wxT("SIZE"), &sz
);
90 HasShading
= !(tag
.HasParam(wxT("NOSHADE")));
91 c
->InsertCell(new wxHtmlLineCell((int)((double)sz
* m_WParser
->GetPixelScale()), HasShading
));
93 m_WParser
->CloseContainer();
94 m_WParser
->OpenContainer();
105 TAGS_MODULE_BEGIN(HLine
)
109 TAGS_MODULE_END(HLine
)