]>
Commit | Line | Data |
---|---|---|
5526e819 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: mod_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 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | ||
10 | #include "wx/defs.h" | |
11 | #if wxUSE_HTML | |
12 | ||
13 | #include <wx/html/forcelink.h> | |
14 | #include <wx/html/mod_templ.h> | |
15 | ||
16 | #include <wx/html/htmlcell.h> | |
17 | ||
18 | FORCE_LINK_ME(mod_hline) | |
19 | ||
20 | ||
21 | //----------------------------------------------------------------------------- | |
22 | // wxHtmlLineCell | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
25 | class wxHtmlLineCell : public wxHtmlCell | |
26 | { | |
27 | public: | |
28 | wxHtmlLineCell(int size) : wxHtmlCell() {m_Height = size;} | |
29 | void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); | |
30 | void Layout(int w) {m_Width = w; if (m_Next) m_Next -> Layout(w);} | |
31 | }; | |
32 | ||
33 | ||
34 | void wxHtmlLineCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) | |
35 | { | |
36 | wxBrush mybrush("BLACK", wxSOLID); | |
37 | wxPen mypen("BLACK", 1, wxSOLID); | |
38 | dc.SetBrush(mybrush); | |
39 | dc.SetPen(mypen); | |
40 | dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height); | |
41 | wxHtmlCell::Draw(dc, x, y, view_y1, view_y2); | |
42 | } | |
43 | ||
44 | ||
45 | ||
46 | ||
47 | //----------------------------------------------------------------------------- | |
48 | // The list handler: | |
49 | //----------------------------------------------------------------------------- | |
50 | ||
51 | ||
52 | TAG_HANDLER_BEGIN(HR, "HR") | |
53 | ||
54 | TAG_HANDLER_PROC(tag) | |
55 | { | |
56 | wxHtmlContainerCell *c; | |
57 | int sz; | |
58 | ||
59 | m_WParser -> CloseContainer(); | |
60 | c = m_WParser -> OpenContainer(); | |
61 | ||
62 | c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_VERTICAL); | |
63 | c -> SetAlignHor(HTML_ALIGN_CENTER); | |
64 | c -> SetAlign(tag); | |
65 | c -> SetWidthFloat(tag); | |
66 | if (tag.HasParam("SIZE")) tag.ScanParam("SIZE", "%i", &sz); | |
67 | else sz = 1; | |
68 | c -> InsertCell(new wxHtmlLineCell(sz)); | |
69 | ||
70 | m_WParser -> CloseContainer(); | |
71 | m_WParser -> OpenContainer(); | |
72 | ||
73 | return FALSE; | |
74 | } | |
75 | ||
76 | TAG_HANDLER_END(HR) | |
77 | ||
78 | ||
79 | ||
80 | ||
81 | ||
82 | TAGS_MODULE_BEGIN(HLine) | |
83 | ||
84 | TAGS_MODULE_ADD(HR) | |
85 | ||
86 | TAGS_MODULE_END(HLine) | |
87 | ||
88 | #endif |