65 void NCursesPanel::init()
72 UserHook* hook =
new UserHook;
80 ::set_panel_userptr( p, (
void * )hook );
83 NCursesPanel::~NCursesPanel()
85 UserHook* hook = ( UserHook* )::panel_userptr( p );
86 assert( hook && hook->m_back ==
this && hook->m_owner == p );
98 pan = ::panel_above( NULL );
103 pan = ::panel_above( pan );
129 frame( title, btitle );
138 if ( !title && !btitle )
147 label( title, btitle );
168 int x = (
maxx() - strlen(
label ) ) / 2;
179 int NCursesPanel::transparent(
int y,
int x )
182 || y < 0 ||
maxy() < y
183 || x < 0 ||
maxx() < x )
192 for ( PANEL * sp = ::panel_below( p ); 1; sp = ::panel_below( sp ) )
194 WINDOW * sw = ( sp ? ::panel_window( sp ) : ::stdscr );
198 int dy = ay - sw->_begy;
200 if ( 0 <= dy && dy <= sw->_maxy )
202 int dx = ax - sw->_begx;
204 if ( 0 <= dx && dx <= sw->_maxx )
206 return addch( y, x, ::mvwinch( sw, dy, dx ) );
219 std::ostream & operator<<( std::ostream & Stream,
const NCursesPanel * Obj_Cv )
222 return Stream << *Obj_Cv;
224 return Stream <<
"(NoNCPan)";
228 std::ostream & operator<<( std::ostream & Stream,
const NCursesPanel & Obj_Cv )
230 return Stream <<
"NCPan(" << Obj_Cv.p <<
')';
void OnError(int err) const THROWS(NCursesPanelException)
If err is equal to the curses error indicator ERR, an error handler is called.
static void redraw()
Redraw all panels.
bool hidden() const
Return TRUE if the panel is hidden, FALSE otherwise.
virtual void frame(const char *title=NULL, const char *btitle=NULL)
Put a frame around the panel and put the title centered in the top line and btitle in the bottom line...
virtual int refresh()
Propagate all panel changes to the virtual screen and update the physical screen.
virtual void centertext(int row, const char *label)
Put the label text centered in the specified row.
virtual int noutrefresh()
Propagate all panel changes to the virtual screen.
virtual void boldframe(const char *title=NULL, const char *btitle=NULL)
Same as frame(), but use highlighted attributes.
virtual void label(const char *topLabel, const char *bottomLabel)
Put the title centered in the top line and btitle in the bottom line.
int begy() const
Line of top left corner relative to stdscr.
int maxx() const
Largest x coord in window.
int addstr(const char *str, int n=-1)
Write the std::string str to the window, stop writing if the terminating NUL or the limit n is reache...
int touchwin()
Mark the whole window as modified.
int addch(const char ch)
Put attributed character to the window.
WINDOW * w
the curses WINDOW
int box()
Draw a box around the window with the given vertical and horizontal drawing characters.
int standout()
Enable "standout" attributes.
int maxy() const
Largest y coord in window.
int standend()
Disable "standout" attributes.
int begx() const
Column of top left corner relative to stdscr.
int doupdate()
Do all outputs to make the physical screen looking like the virtual one.
int width() const
Number of columns in this window.