namespace { class XText : public Wt::WText { public: XText( std::string s ) : Wt::WText( s ) { setStyleClass( "test" ); } }; class TestText : public Wt::WApplication { public: TestText( const Wt::WEnvironment& env ) : Wt::WApplication( env ) { Wt::WContainerWidget* c = new Wt::WContainerWidget( root() ); c->resize( 100, 300 ); Wt::WTable* t = new Wt::WTable( c ); styleSheet().addRule( ".test", "font-size: 12px;", ".test" ); t->elementAt( 0, 0 )->addWidget( new XText( "X" ) ); t->elementAt( 0, 1 )->addWidget( new XText( "Test Test Test Test" ) ); } }; }