]>
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 ///////////////////////////////////////////////////////////////////////////// 
  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
) : wxHtmlCell() {m_Height 
= size
;} 
  45         void Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
); 
  46         void Layout(int w
) {m_Width 
= w
; if (m_Next
) m_Next 
-> Layout(w
);} 
  50 void wxHtmlLineCell::Draw(wxDC
& dc
, int x
, int y
, int view_y1
, int view_y2
) 
  52     wxBrush 
mybrush("BLACK", wxSOLID
); 
  53     wxPen 
mypen("BLACK", 1, wxSOLID
); 
  56     dc
.DrawRectangle(x 
+ m_PosX
, y 
+ m_PosY
, m_Width
, m_Height
); 
  57     wxHtmlCell::Draw(dc
, x
, y
, view_y1
, view_y2
); 
  63 //----------------------------------------------------------------------------- 
  65 //----------------------------------------------------------------------------- 
  68 TAG_HANDLER_BEGIN(HR
, "HR") 
  72         wxHtmlContainerCell 
*c
; 
  75         m_WParser 
-> CloseContainer(); 
  76         c 
= m_WParser 
-> OpenContainer(); 
  78         c 
-> SetIndent(m_WParser 
-> GetCharHeight(), wxHTML_INDENT_VERTICAL
); 
  79         c 
-> SetAlignHor(wxHTML_ALIGN_CENTER
); 
  81         c 
-> SetWidthFloat(tag
); 
  83         if (tag
.HasParam(wxT("SIZE")) && tag
.ScanParam(wxT("SIZE"), wxT("%i"), &sz
) == 1) {} 
  84         c 
-> InsertCell(new wxHtmlLineCell((int)((double)sz 
* m_WParser 
-> GetPixelScale()))); 
  86         m_WParser 
-> CloseContainer(); 
  87         m_WParser 
-> OpenContainer(); 
  98 TAGS_MODULE_BEGIN(HLine
) 
 102 TAGS_MODULE_END(HLine
)