25 #define YUILogComponent "ncurses"
26 #include <yui/YUILog.h>
31 NCFrame::NCFrame( YWidget * parent,
const std::string & nlabel )
32 : YFrame( parent, nlabel )
35 yuiDebug() << std::endl;
37 framedim.Pos =
wpos( 1 );
38 framedim.Sze =
wsze( 2 );
39 setLabel( YFrame::label() );
46 yuiDebug() << std::endl;
50 int NCFrame::preferredWidth()
52 defsze.W = hasChildren() ? firstChild()->preferredWidth() : 0;
54 if ( label.width() > ( unsigned )defsze.W )
55 defsze.W = label.width();
57 defsze.W += framedim.Sze.W;
63 int NCFrame::preferredHeight()
65 defsze.H = hasChildren() ? firstChild()->preferredHeight() : 0;
66 defsze.H += framedim.Sze.H;
72 void NCFrame::setSize(
int newwidth,
int newheight )
74 wsze csze( newheight, newwidth );
75 wRelocate(
wpos( 0 ), csze );
76 csze = wsze::max( 0, csze - framedim.Sze );
79 firstChild()->setSize( csze.W, csze.H );
83 void NCFrame::setLabel(
const std::string & nlabel )
85 YFrame::setLabel( nlabel );
96 YFrame::setEnabled( do_bv );
100 bool NCFrame::gotBuddy()
102 if ( !label.hasHotkey() )
106 c && c->IsDescendantOf(
this );
109 if ( c->Value()->GetState() != NC::WSdumb )
117 void NCFrame::wRedraw()
122 chtype bg = wStyle().dumb.text;
127 label.drawAt( *win, widgetStyle(),
wpos( 0, 1 ),
128 wsze( 1, win->
width() - 2 ), NC::TOPLEFT,
false );
130 label.drawAt( *win, bg, bg,
wpos( 0, 1 ),
131 wsze( 1, win->
width() - 2 ), NC::TOPLEFT,
false );
int bkgd(const chtype ch)
virtual void setEnabled(bool do_bv)