31 #include <yui/YRichText.h>
32 #include "NCPadWidget.h"
39 friend std::ostream & operator<<( std::ostream & STREAM,
const NCRichText & OBJ );
48 static std::map<std::wstring, std::wstring> _charentity;
56 static const std::wstring entityLookup(
const std::wstring & val_r );
61 static const std::wstring filterEntities(
const std::wstring & text );
79 static const unsigned Tfontmask = 0xff00;
99 static const unsigned listindent;
100 static const std::wstring listleveltags;
102 std::stack<int> liststack;
104 void PadChangeLevel(
bool down,
int tag );
106 size_t textWidth( std::wstring wstr );
115 static const unsigned unset = ( unsigned ) - 1;
126 sline = scol = eline = ecol = unset;
129 Anchor(
int sl,
int sc )
134 void open(
int sl,
int sc )
138 eline = ecol = unset;
142 void close(
int el,
int ec )
150 if ( sline == unset || scol == unset
151 || eline == unset || ecol == unset )
154 if (( eline == sline && ecol <= scol )
161 bool within(
unsigned firstvisible,
unsigned nextinvisible )
163 return sline < nextinvisible && eline >= firstvisible;
166 void draw(
NCPad & pad,
const chtype attr,
int color );
169 static const bool showLinkTarget;
172 std::vector<Anchor> anchors;
175 unsigned vScrollFirstvisible;
176 unsigned vScrollNextinvisible;
178 void openAnchor( std::wstring args );
181 void arm(
unsigned i );
182 void disarm() { arm( Anchor::unset ); }
193 void PadWS(
const bool tab =
false );
194 void PadTXT(
const wchar_t * sch,
const unsigned len );
195 void PadPreTXT(
const wchar_t * sch,
const unsigned len );
196 void AdjustPrePad(
const wchar_t * sch );
197 bool PadTOKEN(
const wchar_t * sch,
const wchar_t *& ech );
201 virtual const char * location()
const {
return "NCRichText"; }
203 virtual void wRedraw();
204 virtual void wRecoded();
206 virtual NCPad * CreatePad();
207 virtual void DrawPad();
209 virtual void HScroll(
unsigned total,
unsigned visible,
unsigned start );
210 virtual void VScroll(
unsigned total,
unsigned visible,
unsigned start );
212 virtual bool handleInput( wint_t key );
216 NCRichText( YWidget * parent,
const std::string & text,
217 bool plainTextMode =
false );
220 virtual int preferredWidth();
221 virtual int preferredHeight();
223 virtual void setSize(
int newWidth,
int newHeight );
225 virtual void setLabel(
const std::string & nlabel );
229 virtual void setValue(
const std::string & ntext );
233 virtual bool setKeyboardFocus()
236 return YWidget::setKeyboardFocus();
243 #endif // NCRichText_h
virtual void setEnabled(bool do_bv)