25 #define YUILogComponent "ncurses"
26 #include <yui/YUILog.h>
30 #define AUTO_WRAP_WIDTH 10
31 #define AUTO_WRAP_HEIGHT 1
36 NCLabel::NCLabel( YWidget * parent,
37 const string & nlabel,
40 : YLabel( parent, nlabel, isHeading, isOutputField )
42 , heading( isHeading )
44 yuiDebug() << std::endl;
53 yuiDebug() << std::endl;
57 int NCLabel::preferredWidth()
63 if ( layoutPass() == 2 )
88 width = AUTO_WRAP_WIDTH;
93 width = wGetDefsze().W;
100 int NCLabel::preferredHeight()
106 if ( layoutPass() == 2 )
115 height = wrapper.
lines();
120 height = AUTO_WRAP_HEIGHT;
125 height = wGetDefsze().H;
135 YLabel::setEnabled( do_bv );
139 void NCLabel::setSize(
int newWidth,
int newHeight )
141 if ( autoWrap() && layoutPass() == 1 )
144 wRelocate(
wpos( 0 ),
wsze( newHeight, newWidth ) );
148 void NCLabel::setText(
const string & newLabel )
151 defsze = label.size();
152 YLabel::setText( newLabel );
157 void NCLabel::wRedraw()
162 chtype bg = heading ? wStyle().dumb.title
163 : wStyle().dumb.text;
171 label.drawAt( *win, bg, bg );
175 void NCLabel::setAutoWrap(
bool autoWrap )
177 YLabel::setAutoWrap( autoWrap );
194 defsze = label.size();
virtual void setEnabled(bool do_bv)
Pure virtual to make sure every widget implements it.
void setLineWidth(int width)
Set the maximum line width to wrap into.
void setText(const std::wstring &origText)
Set the original text to wrap.
int lines()
Return the number of lines after wrapping the original text.
int lineWidth() const
Return the last used maximum line width.
const std::wstring & wrappedText()
Wrap the original text and return the wrapped text.
void clear()
Clear the old content.
int bkgd(const chtype ch)
Set the background property and apply it to the window.
int clear()
Clear the window.