]>
git.saurik.com Git - wxWidgets.git/blob - src/html/m_hline.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/html/m_hline.cpp
3 // Purpose: wxHtml module for horizontal line (HR tag)
4 // Author: Vaclav Slavik
5 // Copyright: (c) 1999 Vaclav Slavik
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
15 #if wxUSE_HTML && wxUSE_STREAMS
23 #include "wx/html/forcelnk.h"
24 #include "wx/html/m_templ.h"
26 #include "wx/html/htmlcell.h"
28 FORCE_LINK_ME(m_hline
)
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 class wxHtmlLineCell
: public wxHtmlCell
38 wxHtmlLineCell(int size
, bool shading
) : wxHtmlCell() {m_Height
= size
; m_HasShading
= shading
;}
39 void Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
,
40 wxHtmlRenderingInfo
& info
);
42 { m_Width
= w
; wxHtmlCell::Layout(w
); }
45 // Should we draw 3-D shading or not
48 wxDECLARE_NO_COPY_CLASS(wxHtmlLineCell
);
52 void wxHtmlLineCell::Draw(wxDC
& dc
, int x
, int y
,
53 int WXUNUSED(view_y1
), int WXUNUSED(view_y2
),
54 wxHtmlRenderingInfo
& WXUNUSED(info
))
56 wxBrush
mybrush(wxT("GREY"), (m_HasShading
) ? wxBRUSHSTYLE_TRANSPARENT
: wxBRUSHSTYLE_SOLID
);
57 wxPen
mypen(wxT("GREY"), 1, wxPENSTYLE_SOLID
);
60 dc
.DrawRectangle(x
+ m_PosX
, y
+ m_PosY
, m_Width
, m_Height
);
66 //-----------------------------------------------------------------------------
68 //-----------------------------------------------------------------------------
71 TAG_HANDLER_BEGIN(HR
, "HR")
72 TAG_HANDLER_CONSTR(HR
) { }
76 wxHtmlContainerCell
*c
;
80 m_WParser
->CloseContainer();
81 c
= m_WParser
->OpenContainer();
83 c
->SetIndent(m_WParser
->GetCharHeight(), wxHTML_INDENT_VERTICAL
);
84 c
->SetAlignHor(wxHTML_ALIGN_CENTER
);
86 c
->SetWidthFloat(tag
);
88 tag
.GetParamAsInt(wxT("SIZE"), &sz
);
89 HasShading
= !(tag
.HasParam(wxT("NOSHADE")));
90 c
->InsertCell(new wxHtmlLineCell((int)((double)sz
* m_WParser
->GetPixelScale()), HasShading
));
92 m_WParser
->CloseContainer();
93 m_WParser
->OpenContainer();
104 TAGS_MODULE_BEGIN(HLine
)
108 TAGS_MODULE_END(HLine
)