]>
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
11 #pragma implementation
14 #include "wx/wxprec.h"
18 #if wxUSE_HTML && wxUSE_STREAMS
29 #include "wx/html/forcelnk.h"
30 #include "wx/html/m_templ.h"
32 #include "wx/html/htmlcell.h"
34 FORCE_LINK_ME(m_hline
)
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
41 class wxHtmlLineCell
: public wxHtmlCell
44 wxHtmlLineCell(int size
, bool shading
) : wxHtmlCell() {m_Height
= size
; m_HasShading
= shading
;}
45 void Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
,
46 wxHtmlRenderingInfo
& info
);
48 { m_Width
= w
; wxHtmlCell::Layout(w
); }
51 // Should we draw 3-D shading or not
54 DECLARE_NO_COPY_CLASS(wxHtmlLineCell
)
58 void wxHtmlLineCell::Draw(wxDC
& dc
, int x
, int y
,
59 int WXUNUSED(view_y1
), int WXUNUSED(view_y2
),
60 wxHtmlRenderingInfo
& WXUNUSED(info
))
62 wxBrush
mybrush(wxT("GREY"), (m_HasShading
) ? wxTRANSPARENT
: wxSOLID
);
63 wxPen
mypen(wxT("GREY"), 1, wxSOLID
);
66 dc
.DrawRectangle(x
+ m_PosX
, y
+ m_PosY
, m_Width
, m_Height
);
72 //-----------------------------------------------------------------------------
74 //-----------------------------------------------------------------------------
77 TAG_HANDLER_BEGIN(HR
, "HR")
78 TAG_HANDLER_CONSTR(HR
) { }
82 wxHtmlContainerCell
*c
;
86 m_WParser
->CloseContainer();
87 c
= m_WParser
->OpenContainer();
89 c
->SetIndent(m_WParser
->GetCharHeight(), wxHTML_INDENT_VERTICAL
);
90 c
->SetAlignHor(wxHTML_ALIGN_CENTER
);
92 c
->SetWidthFloat(tag
);
94 tag
.GetParamAsInt(wxT("SIZE"), &sz
);
95 HasShading
= !(tag
.HasParam(wxT("NOSHADE")));
96 c
->InsertCell(new wxHtmlLineCell((int)((double)sz
* m_WParser
->GetPixelScale()), HasShading
));
98 m_WParser
->CloseContainer();
99 m_WParser
->OpenContainer();
110 TAGS_MODULE_BEGIN(HLine
)
114 TAGS_MODULE_END(HLine
)