35 #include "KDGanttSemiSizingControl.h"
36 #include <tqpushbutton.h>
37 #include <tqpointarray.h>
38 #include <tqpainter.h>
40 #include <tqtooltip.h>
41 #include <tqwhatsthis.h>
69 _arrowPos( Before ), _minimizedWidget(0), _maximizedWidget(0)
91 _arrowPos( Before ), _minimizedWidget(0), _maximizedWidget(0)
111 TQt::Orientation orientation,
115 _arrowPos( arrowPosition ), _minimizedWidget(0), _maximizedWidget(0)
132 _minimizedWidget = widget;
133 if( _minimizedWidget ) _minimizedWidget->hide();
148 return _minimizedWidget;
162 _maximizedWidget = widget;
177 return _maximizedWidget;
247 void KDGanttSemiSizingControl::init()
249 _but =
new TQPushButton(
this );
250 _but->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) );
251 connect( _but, TQ_SIGNAL( clicked() ),
this, TQ_SLOT(
changeState()) );
253 TQWhatsThis::add( _but,
"Click on this button to show the \nlegend at the bottom of the widget");
254 TQToolTip::add( _but,
"Show / hide legend");
259 void KDGanttSemiSizingControl::setup()
263 TQBoxLayout* butLayout;
266 _layout =
new TQHBoxLayout(
this );
268 _layout =
new TQVBoxLayout(
this );
271 butLayout =
new TQHBoxLayout( _layout );
273 butLayout =
new TQVBoxLayout( _layout );
279 _but->setPixmap( pixmap( Down ) );
282 if ( _arrowPos == Before ) {
283 _but->setPixmap( pixmap( Right ) );
286 _but->setPixmap( pixmap( Left ) );
291 if ( _arrowPos == After && _orient == TQt::Vertical && !
isMinimized() ) {
292 butLayout->addStretch( 1 );
293 butLayout->addWidget( _but, 0, TQt::AlignLeft );
296 butLayout->addWidget( _but, 0, TQt::AlignRight );
297 butLayout->addStretch( 1 );
319 widget = _minimizedWidget;
321 if ( _arrowPos == Before || _orient == TQt::Vertical && !
isMinimized() )
322 _layout->addWidget( widget, 1 );
324 _layout->insertWidget( 0, widget, 1 );
328 if ( _arrowPos == Before || _orient == TQt::Vertical && !
isMinimized() )
329 _layout->addStretch( 1 );
331 _layout->insertStretch( 0, 1 );
332 widget = _maximizedWidget;
354 if( _maximizedWidget ) _maximizedWidget->show();
355 if( _minimizedWidget ) _minimizedWidget->hide();
376 if( _minimizedWidget ) _minimizedWidget->show();
377 if( _maximizedWidget ) _maximizedWidget->hide();
383 TQPixmap KDGanttSemiSizingControl::pixmap( Direction direction ) {
385 TQPixmap pix( s, s );
389 switch ( direction ) {
390 case Up: arr.setPoints( 3, 0, s-1, s-1, s-1, 0, s/2 ); ;
break;
391 case Down: arr.setPoints( 3, 0, 0, s-1, 0, s/2, s-1 );
break;
392 case Left: arr.setPoints( 3, s-1, 0, s-1, s-1, 0, s/2 );
break;
393 case Right: arr.setPoints( 3, 0,0, s-1, s/2, 0, s-1 );
break;
398 p.setBrush( colorGroup().button() );
399 p.drawPolygon( arr );
400 TQBitmap bit( s, s );
403 TQPainter p2( &bit );
405 p2.setBrush( color1 );
406 p2.drawPolygon( arr );
411 #ifndef KDGANTT_MASTER_CVS
412 #include "KDGanttSemiSizingControl.moc"
virtual void restore(bool restore)
TQt::Orientation orientation() const
void setArrowPosition(ArrowPosition arrowPosition)
KDGanttSemiSizingControl(TQWidget *parent=0, const char *name=0)
void setOrientation(TQt::Orientation orientation)
TQWidget * minimizedWidget() const
void setMaximizedWidget(TQWidget *widget)
virtual void minimize(bool minimize)
ArrowPosition arrowPosition() const
void setMinimizedWidget(TQWidget *widget)
TQWidget * maximizedWidget() const
virtual void minimize(bool minimize)
virtual void restore(bool restore)