25 #define YUILogComponent "ncurses" 26 #include <yui/YUILog.h> 32 #define PAD_PAGESIZE 1024 37 #define MAX_PAD_HEIGHT NCursesWindow::maxcoord() 40 NCPad::NCPad(
int lines,
int cols,
const NCWidget & p )
41 :
NCursesPad( lines > MAX_PAD_HEIGHT ? PAD_PAGESIZE : lines, cols )
42 , _vheight( lines > MAX_PAD_HEIGHT ? lines : 0 )
54 if ( dwin != destwin )
63 srect =
wrect( 0, wsze::min( mysze, drect.Sze ) );
64 maxdpos = drect.Pos + srect.Sze - 1;
65 maxspos = mysze - srect.Sze;
67 dclear = ( drect.Sze != srect.Sze );
72 drect = srect =
wrect();
73 maxdpos = maxspos = 0;
79 void NCPad::resize(
wsze nsze )
84 || nsze.W !=
width() )
91 if ( nsze.H > MAX_PAD_HEIGHT )
93 yuiDebug() <<
"TRUCNATE PAD: " << nsze.H <<
" > " << MAX_PAD_HEIGHT << std::endl;
94 NCursesPad::resize( PAD_PAGESIZE, nsze.W );
99 NCursesPad::resize( nsze.H, nsze.W );
103 yuiDebug() <<
"Pageing ?: " <<
pageing() << std::endl;
111 void NCPad::updateScrollHint()
113 NCScrollHint::VSet( srect.Sze.H + maxspos.L, srect.Sze.H, srect.Pos.L );
114 NCScrollHint::HSet( srect.Sze.W + maxspos.C, srect.Sze.W, srect.Pos.C );
135 srect.Pos.L, srect.Pos.C,
136 drect.Pos.L, drect.Pos.C,
137 maxdpos.L, maxdpos.C,
144 for (
int i = 0; i <= maxdpos.L; ++i )
150 drect.Pos.L, drect.Pos.C,
151 maxdpos.L, maxdpos.C,
158 int NCPad::setpos(
const wpos & newpos )
160 srect.Pos = newpos.between( 0, maxspos );
165 void NCPad::wRecoded()
167 yuiDebug() <<
"NCPad::wRecoded" << std::endl;
171 bool NCPad::handleInput( wint_t key )
182 ScrlUp( destwin->
maxy() );
194 ScrlDown( destwin->
maxy() );
int clear()
Clear the window.
virtual void directDraw(NCursesWindow &w, const wrect at, unsigned lineno)
Directly draw a table item at a specific location.
int vheight() const
The (virtual) height of the Pad (even if truncated).
int height() const
Number of lines in this window.
int copywin(NCursesWindow &win, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, bool overlay=TRUE)
Overlay or overwrite the rectangle in win given by dminrow,dmincol, dmaxrow,dmaxcol with the rectangl...
int width() const
Number of columns in this window.
bool pageing() const
Whether the Pad is truncated (we're pageing).
int maxy() const
Largest y coord in window.