#include <ShapesWidget.h>
Inherits Wt::WPaintedWidget.
Public Member Functions | |
ShapesWidget (WContainerWidget *parent=0) | |
void | setAngle (double angle) |
double | angle () const |
void | setRelativeSize (double size) |
double | relativeSize () const |
Protected Member Functions | |
virtual void | paintEvent (WPaintDevice *paintDevice) |
Private Member Functions | |
void | drawEmwebLogo (WPainter &p) |
void | drawEmwebE (WPainter &p) |
void | drawEmwebMW (WPainter &p) |
Private Attributes | |
double | angle_ |
double | size_ |
Definition at line 19 of file ShapesWidget.h.
ShapesWidget::ShapesWidget | ( | WContainerWidget * | parent = 0 |
) |
Definition at line 24 of file ShapesWidget.C.
00025 : WPaintedWidget(parent), 00026 angle_(0), 00027 size_(1) 00028 { 00029 resize(710, 400); 00030 }
double ShapesWidget::angle | ( | ) | const [inline] |
Definition at line 25 of file ShapesWidget.h.
00025 { return angle_; }
void ShapesWidget::drawEmwebE | ( | WPainter & | p | ) | [private] |
Definition at line 67 of file ShapesWidget.C.
00068 { 00069 WPainterPath p; 00070 00071 /* Path copied from our SVG for half of the E */ 00072 00073 p.moveTo(46.835084,58.783624); 00074 p.cubicTo(45.700172,58.783624,35.350098,58.911502,24.656354,63.283309); 00075 p.cubicTo(8.7595992,69.78907,0,82.38499,0,98.809238); 00076 p.cubicTo(0,115.20152,08.7595992,127.82141,24.656354,134.31119); 00077 p.cubicTo(35.350098,138.69099,45.700172,138.81088,46.835084,138.81088); 00078 p.lineTo(94.509362,138.81088); 00079 p.lineTo(94.509362,117.58323); 00080 p.lineTo(46.835084,117.58323); 00081 p.cubicTo(46.811106,117.58323,39.466151,117.47134,32.608727,114.53815); 00082 p.cubicTo(25.095932,111.34122,21.747144,106.47389,21.747144,98.809238); 00083 p.cubicTo(21.747144,91.120612,25.095932,86.269265,32.608727,83.064338); 00084 p.cubicTo(39.466151,80.123159,46.811106,80.027251,46.89103,80.027251); 00085 p.lineTo(94.509362,80.027251); 00086 p.lineTo(94.509362,58.783624); 00087 p.lineTo(46.835084,58.783624); 00088 00089 painter.drawPath(p); 00090 00091 painter.save(); 00092 painter.translate(0,-58.783624); 00093 painter.drawPath(p); 00094 painter.restore(); 00095 }
void ShapesWidget::drawEmwebLogo | ( | WPainter & | p | ) | [private] |
Definition at line 145 of file ShapesWidget.C.
00146 { 00147 painter.save(); 00148 painter.setPen(NoPen); 00149 00150 /* 00151 * The emweb logo can be drawn as 3 e's, and one combined m/w 00152 */ 00153 00154 // Emweb 00155 painter.setBrush(black); 00156 drawEmwebE(painter); 00157 00158 // emwEb 00159 painter.save(); 00160 painter.translate(397, 0); 00161 drawEmwebE(painter); 00162 00163 // emweB 00164 painter.translate(210, 0); 00165 painter.scale(-1, 1); 00166 drawEmwebE(painter); 00167 00168 painter.restore(); 00169 00170 // eMWeb 00171 painter.setBrush(emweb); 00172 drawEmwebMW(painter); 00173 00174 painter.restore(); 00175 }
void ShapesWidget::drawEmwebMW | ( | WPainter & | p | ) | [private] |
Definition at line 97 of file ShapesWidget.C.
00098 { 00099 WPainterPath p; 00100 00101 /* Path copied from our SVG for one fourth of the MW */ 00102 00103 p.moveTo(120.59634,24.072913); 00104 p.cubicTo(116.12064,34.518895,115.98477,44.605222,115.98477,45.732141); 00105 p.lineTo(115.98477,138.81088); 00106 p.lineTo(137.7399,138.81088); 00107 p.lineTo(137.7399,45.732141); 00108 p.cubicTo(137.7399,45.708164,137.83581,38.53904,140.84892,31.841463); 00109 p.cubicTo(144.14176,24.512492,149.113,21.235634,156.98545,21.235634); 00110 p.cubicTo(164.8499,21.235634,169.81314,24.512492,173.10599,31.841463); 00111 p.cubicTo(176.10311,38.53904,176.215,45.708164,176.215,45.780095); 00112 p.lineTo(176.215,70.41343); 00113 p.lineTo(197.97014,70.41343); 00114 p.lineTo(197.97014,45.732141); 00115 p.cubicTo(197.97014,44.605222,197.83427,34.518895,193.35057,24.072913); 00116 p.cubicTo(186.70894,8.5517985,173.77734,0,156.99344,0); 00117 p.cubicTo(140.17756,0,127.25396,8.5517985,120.59634,24.072913); 00118 00119 /* 00120 * Paint it four times, translated and inverted 00121 */ 00122 00123 painter.drawPath(p); 00124 00125 const double dx = 176. - 115.98477; 00126 00127 painter.save(); 00128 00129 painter.translate(dx, 0); 00130 painter.drawPath(p); 00131 00132 painter.translate(dx, 0); 00133 00134 painter.scale(-1, -1); 00135 painter.translate(0, -138.81088); 00136 painter.translate(-115.98477 - 197.95 - dx, 0); 00137 painter.drawPath(p); 00138 00139 painter.translate(dx, 0); 00140 painter.drawPath(p); 00141 00142 painter.restore(); 00143 }
void ShapesWidget::paintEvent | ( | WPaintDevice * | paintDevice | ) | [protected, virtual] |
Implements Wt::WPaintedWidget.
Definition at line 52 of file ShapesWidget.C.
00053 { 00054 WPainter painter(paintDevice); 00055 00056 painter.setShadow(WShadow(10, 10, WColor(0, 0, 0, 50), 10)); 00057 painter.setRenderHint(WPainter::Antialiasing); 00058 00059 painter.translate(width().value()/2, height().value()/2); 00060 painter.rotate(angle_); 00061 painter.scale(size_, size_); 00062 painter.translate(-width().value()/2 + 50, -height().value()/2 + 150); 00063 00064 drawEmwebLogo(painter); 00065 }
double ShapesWidget::relativeSize | ( | ) | const [inline] |
Definition at line 28 of file ShapesWidget.h.
00028 { return size_; }
void ShapesWidget::setAngle | ( | double | angle | ) |
void ShapesWidget::setRelativeSize | ( | double | size | ) |
Definition at line 42 of file ShapesWidget.C.
double ShapesWidget::angle_ [private] |
Definition at line 34 of file ShapesWidget.h.
double ShapesWidget::size_ [private] |
Definition at line 35 of file ShapesWidget.h.