25 #define YUILogComponent "ncurses"
26 #include <yui/YUILog.h>
27 #include "NCLogView.h"
30 NCLogView::NCLogView( YWidget * parent,
31 const std::string & nlabel,
34 : YLogView( parent, nlabel, visibleLines, maxLines )
37 yuiDebug() << std::endl;
38 defsze =
wsze( visibleLines, 5 ) + 2;
43 NCLogView::~NCLogView()
45 yuiDebug() << std::endl;
49 int NCLogView::preferredWidth()
51 defsze.W = ( 5 > labelWidth() ? 5 : labelWidth() ) + 2;
52 return wGetDefsze().W;
56 int NCLogView::preferredHeight()
58 return wGetDefsze().H;
65 YLogView::setEnabled( do_bv );
69 void NCLogView::setSize(
int newwidth,
int newheight )
71 wRelocate(
wpos( 0 ),
wsze( newheight, newwidth ) );
75 void NCLogView::setLabel(
const std::string & nlabel )
77 YLogView::setLabel( nlabel );
78 NCPadWidget::setLabel(
NCstring( nlabel ) );
82 void NCLogView::displayLogText(
const std::string & ntext )
90 void NCLogView::wRedraw()
95 bool initial = ( !
myPad() || !
myPad()->Destwin() );
100 NCPadWidget::wRedraw();
103 myPad()->ScrlTo(
wpos( text.Lines(), 0 ) );
107 void NCLogView::wRecoded()
117 return NCursesEvent::none;
121 NCPad * NCLogView::CreatePad()
123 wsze psze( defPadSze() );
124 NCPad * npad =
new NCPad( psze.H, psze.W, *
this );
125 npad->
bkgd( listStyle().item.plain );
130 void NCLogView::DrawPad()
133 unsigned int maxLines = 20000;
134 unsigned int skipLines = 0;
135 unsigned int lines = text.Lines();
138 if ( lines > maxLines )
140 skipLines = lines - maxLines;
144 AdjustPad(
wsze( lines, Columns() ) );
146 for ( NCtext::const_iterator line = text.begin(); line != text.end(); ++line )
148 if ( skipLines == 0 )
151 std::wstring cline = ( *line ).str();
int bkgd(const chtype ch)
int addwstr(const wchar_t *str, int n=-1)
virtual void setEnabled(bool do_bv)