25 #define YUILogComponent "ncurses" 26 #include <yui/YUILog.h> 28 #include "NCMenuButton.h" 29 #include "NCPopupMenu.h" 30 #include "YNCursesUI.h" 33 NCMenuButton::NCMenuButton( YWidget * parent,
35 : YMenuButton( parent, nlabel )
38 yuiDebug() << std::endl;
44 NCMenuButton::~NCMenuButton()
46 yuiDebug() << std::endl;
50 int NCMenuButton::preferredWidth()
52 return wGetDefsze().W;
56 int NCMenuButton::preferredHeight()
58 return wGetDefsze().H;
65 YMenuButton::setEnabled( do_bv );
69 void NCMenuButton::setSize(
int newwidth,
int newheight )
71 wRelocate(
wpos( 0 ),
wsze( newheight, newwidth ) );
93 void NCMenuButton::setLabel(
const std::string & nlabel )
97 defsze =
wsze( label.height(), label.width() + 3 );
98 YMenuButton::setLabel( nlabel );
103 void NCMenuButton::wRedraw()
112 if ( label.height() > 1 )
121 label.drawAt( *win, style,
wpos( 0, 1 ),
wsze( -1, win->
width() - 3 ),
128 : win->
addch( 0, win->
maxx() - 1, ACS_DARROW );
132 void NCMenuButton::rebuildMenuTree()
141 wpos at( ScreenPos() +
wpos( 1, 0 ) );
146 YUI_CHECK_NEW( dialog );
148 int selection = dialog->post();
152 YDialog::deleteTopmostDialog();
153 return NCursesEvent::none;
157 ret.selection = findMenuItem( selection );
158 YDialog::deleteTopmostDialog();
168 event.selection = item;
int printw(const char *fmt,...)
Do a formatted print to the window.
int height() const
Number of lines in this window.
int vline(int len, chtype ch=0)
Draw a vertical line of len characters with the given character.
void bkgdset(chtype ch)
Set the background property.
int box()
Draw a box around the window with the given vertical and horizontal drawing characters.
static YNCursesUI * ui()
Access the global Y2NCursesUI.
void sendEvent(NCursesEvent event)
Send an event to the UI.
int addch(const char ch)
Put attributed character to the window.
int maxx() const
Largest x coord in window.
int width() const
Number of columns in this window.
int add_wch(const cchar_t *cch)
Put a combined character to the window.