diff options
Diffstat (limited to 'doc/html/customstyles.html')
-rw-r--r-- | doc/html/customstyles.html | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/doc/html/customstyles.html b/doc/html/customstyles.html index 47e6afc4b..541b5ee39 100644 --- a/doc/html/customstyles.html +++ b/doc/html/customstyles.html @@ -54,16 +54,16 @@ applications. <a name="1-1"></a><p> The first step is to pick one of the base styles provided with TQt to build your custom style from. The choice will depend on what look and feel you are trying to achieve. We recommend that you choose from the -<a href="qwindowsstyle.html">TQWindowsStyle</a> derived classes or the <a href="qmotifstyle.html">TQMotifStyle</a> derived classes. +<a href="ntqwindowsstyle.html">TQWindowsStyle</a> derived classes or the <a href="ntqmotifstyle.html">TQMotifStyle</a> derived classes. These are the two base look and feel classes in the TQt style engine. -Inheriting directly from <a href="qcommonstyle.html">TQCommonStyle</a> is also an option if you want to +Inheriting directly from <a href="ntqcommonstyle.html">TQCommonStyle</a> is also an option if you want to start almost from scratch when implementing your style. In this simple example we will inherit from TQWindowsStyle. <p> <h3> 2. Re-implement the necessary functions in your derived class. </h3> <a name="1-2"></a><p> Depending on which parts of the base style you want to change, you must re-implement the functions that are used to draw those parts -of the interface. If you take a look at the <a href="qstyle.html">TQStyle</a> documentation, +of the interface. If you take a look at the <a href="ntqstyle.html">TQStyle</a> documentation, you will find a list of the different primitives, controls and complex controls. In this example we will first change the look of the standard arrows that are used in the TQWindowsStyle. The arrows are @@ -71,17 +71,17 @@ PrimitiveElements that are drawn by the drawPrimitive() function, so we need to re-implement that function. We need the following class declaration: <p> <pre> -#include <<a href="qwindowsstyle-h.html">qwindowsstyle.h</a>> +#include <<a href="qwindowsstyle-h.html">ntqwindowsstyle.h</a>> -class CustomStyle : public <a href="qwindowsstyle.html">TQWindowsStyle</a> { +class CustomStyle : public <a href="ntqwindowsstyle.html">TQWindowsStyle</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: CustomStyle(); ~CustomStyle(); void drawPrimitive( PrimitiveElement pe, - <a href="qpainter.html">TQPainter</a> *p, - const <a href="qrect.html">TQRect</a> & r, + <a href="ntqpainter.html">TQPainter</a> *p, + const <a href="ntqrect.html">TQRect</a> & r, const <a href="qcolorgroup.html">TQColorGroup</a> & cg, SFlags flags = Style_Default, const <a href="qstyleoption.html">TQStyleOption</a> & = TQStyleOption::Default ) const; @@ -94,10 +94,10 @@ private: </pre> <p> Note that we disable the copy constructor and the '=' operator for our -style. <a href="qobject.html">TQObject</a> is the base class for all style classes in TQt, and a +style. <a href="ntqobject.html">TQObject</a> is the base class for all style classes in TQt, and a TQObject inherently cannot be copied since there are some aspects of it that are not copyable. -<p> From the <a href="qstyle.html">TQStyle</a> docs we see that <tt>PE_ArrowUp</tt>, <tt>PE_ArrowDown</tt>, <tt>PE_ArrowLeft</tt> and <tt>PE_ArrowRight</tt> are the primitives we need to do +<p> From the <a href="ntqstyle.html">TQStyle</a> docs we see that <tt>PE_ArrowUp</tt>, <tt>PE_ArrowDown</tt>, <tt>PE_ArrowLeft</tt> and <tt>PE_ArrowRight</tt> are the primitives we need to do something with. We get the following in our drawPrimitive() function: <p> <pre> CustomStyle::CustomStyle() @@ -109,44 +109,44 @@ CustomStyle::~CustomStyle() } void CustomStyle::drawPrimitive( PrimitiveElement pe, - <a href="qpainter.html">TQPainter</a> * p, - const <a href="qrect.html">TQRect</a> & r, + <a href="ntqpainter.html">TQPainter</a> * p, + const <a href="ntqrect.html">TQRect</a> & r, const <a href="qcolorgroup.html">TQColorGroup</a> & cg, SFlags flags, const <a href="qstyleoption.html">TQStyleOption</a> & opt ) const { // we are only interested in the arrows if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) { - <a href="qpointarray.html">TQPointArray</a> pa( 3 ); + <a href="ntqpointarray.html">TQPointArray</a> pa( 3 ); // make the arrow cover half the area it is supposed to be // painted on - int x = r.<a href="qrect.html#x">x</a>(); - int y = r.<a href="qrect.html#y">y</a>(); - int w = r.<a href="qrect.html#width">width</a>() / 2; - int h = r.<a href="qrect.html#height">height</a>() / 2; - x += (r.<a href="qrect.html#width">width</a>() - w) / 2; - y += (r.<a href="qrect.html#height">height</a>() - h) /2; + int x = r.<a href="ntqrect.html#x">x</a>(); + int y = r.<a href="ntqrect.html#y">y</a>(); + int w = r.<a href="ntqrect.html#width">width</a>() / 2; + int h = r.<a href="ntqrect.html#height">height</a>() / 2; + x += (r.<a href="ntqrect.html#width">width</a>() - w) / 2; + y += (r.<a href="ntqrect.html#height">height</a>() - h) /2; switch( pe ) { case PE_ArrowDown: - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 0, x, y ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 1, x + w, y ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 2, x + w / 2, y + h ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 0, x, y ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 1, x + w, y ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 2, x + w / 2, y + h ); break; case PE_ArrowUp: - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 0, x, y + h ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 1, x + w, y + h ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 2, x + w / 2, y ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 0, x, y + h ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 1, x + w, y + h ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 2, x + w / 2, y ); break; case PE_ArrowLeft: - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 0, x + w, y ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 1, x + w, y + h ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 2, x, y + h / 2 ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 0, x + w, y ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 1, x + w, y + h ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 2, x, y + h / 2 ); break; case PE_ArrowRight: - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 0, x, y ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 1, x, y + h ); - pa.<a href="qpointarray.html#setPoint">setPoint</a>( 2, x + w, y + h / 2 ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 0, x, y ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 1, x, y + h ); + pa.<a href="ntqpointarray.html#setPoint">setPoint</a>( 2, x + w, y + h / 2 ); break; default: break; @@ -155,16 +155,16 @@ void CustomStyle::drawPrimitive( PrimitiveElement pe, // use different colors to indicate that the arrow is // enabled/disabled if ( flags & Style_Enabled ) { - p-><a href="qpainter.html#setPen">setPen</a>( cg.<a href="qcolorgroup.html#mid">mid</a>() ); - p-><a href="qpainter.html#setBrush">setBrush</a>( cg.<a href="qcolorgroup.html#brush">brush</a>( TQColorGroup::ButtonText ) ); + p-><a href="ntqpainter.html#setPen">setPen</a>( cg.<a href="qcolorgroup.html#mid">mid</a>() ); + p-><a href="ntqpainter.html#setBrush">setBrush</a>( cg.<a href="qcolorgroup.html#brush">brush</a>( TQColorGroup::ButtonText ) ); } else { - p-><a href="qpainter.html#setPen">setPen</a>( cg.<a href="qcolorgroup.html#buttonText">buttonText</a>() ); - p-><a href="qpainter.html#setBrush">setBrush</a>( cg.<a href="qcolorgroup.html#brush">brush</a>( TQColorGroup::Mid ) ); + p-><a href="ntqpainter.html#setPen">setPen</a>( cg.<a href="qcolorgroup.html#buttonText">buttonText</a>() ); + p-><a href="ntqpainter.html#setBrush">setBrush</a>( cg.<a href="qcolorgroup.html#brush">brush</a>( TQColorGroup::Mid ) ); } - p-><a href="qpainter.html#drawPolygon">drawPolygon</a>( pa ); + p-><a href="ntqpainter.html#drawPolygon">drawPolygon</a>( pa ); } else { // let the base style handle the other primitives - TQWindowsStyle::<a href="qstyle.html#drawPrimitive">drawPrimitive</a>( pe, p, r, cg, flags, data ); + TQWindowsStyle::<a href="ntqstyle.html#drawPrimitive">drawPrimitive</a>( pe, p, r, cg, flags, data ); } } </pre> @@ -179,7 +179,7 @@ application's main() function: int main( int argc, char ** argv ) { - TQApplication::<a href="qapplication.html#setStyle">setStyle</a>( new CustomStyle() ); + TQApplication::<a href="ntqapplication.html#setStyle">setStyle</a>( new CustomStyle() ); // do the usual routine on creating your TQApplication object etc. } </pre> |