33 #include "tdemditaskbar.h"
34 #include "tdemditaskbar.moc"
36 #include "tdemdimainfrm.h"
37 #include "tdemdichildview.h"
38 #include "tdemdidefines.h"
40 #include <tqtooltip.h>
45 #include <tqnamespace.h>
63 : TQPushButton( pTaskBar ),
66 setToggleButton(
true );
70 setFocusPolicy( TQ_NoFocus );
78 switch ( e->button() )
109 int actualWidth = sizeHint().width();
110 int realLetterCount = origStr.length();
111 int newLetterCount = ( newWidth * realLetterCount ) / actualWidth;
112 int w = newWidth + 1;
113 TQString s = origStr;
114 while ( ( w > newWidth ) && ( newLetterCount >= 1 ) )
116 if ( newLetterCount < realLetterCount )
118 if ( newLetterCount > 3 )
119 s = origStr.left( newLetterCount / 2 ) +
"..." + origStr.right( newLetterCount / 2 );
122 if ( newLetterCount > 1 )
123 s = origStr.left( newLetterCount ) +
"..";
125 s = origStr.left( 1 );
128 TQFontMetrics fm = fontMetrics();
148 : TDEToolBar( parent,
"KMdiTaskBar", false, true )
149 , m_pCurrentFocusedWindow( 0 )
150 , m_pStretchSpace( 0 )
151 , m_layoutIsPending( false )
152 , m_bSwitchedOn( false )
158 setMinimumWidth( 1 );
159 setFocusPolicy( TQ_NoFocus );
160 parent->moveToolBar(
this, dock );
174 setStretchableWidget( 0L );
178 TQObject::connect( b, TQT_SIGNAL( clicked() ), win_ptr, TQT_SLOT( setFocus() ) );
182 TQObject::connect( b, TQT_SIGNAL( buttonTextChanged(
int ) ),
this, TQT_SLOT(
layoutTaskBar(
int ) ) );
184 b->setToggleButton(
true );
208 if ( haveToLayoutTaskBar )
246 if ( b->m_pWindow == win_ptr )
258 if ( b->m_pWindow == win_ptr )
263 if ( win_ptr != b->m_pWindow )
274 if ( b->m_pWindow == win_ptr )
279 if ( win_ptr != b->m_pWindow )
295 if ( b->m_pWindow == win_ptr )
296 newPressedButton = b;
298 oldPressedButton = b;
301 if ( newPressedButton != 0L && newPressedButton != oldPressedButton )
303 if ( oldPressedButton != 0L )
304 oldPressedButton->toggle();
305 newPressedButton->toggle();
312 if ( m_layoutIsPending )
314 m_layoutIsPending =
true;
318 taskBarWidth = width();
321 int allButtonsWidth = 0;
325 allButtonsWidth += b->width();
329 int allButtonsWidthHint = 0;
332 TQFontMetrics fm = b->fontMetrics();
334 TQSize sz = fm.size( ShowPrefix, s );
335 int w = sz.width() + 6;
336 int h = sz.height() + sz.height() / 8 + 10;
338 allButtonsWidthHint += w;
344 tbHandlePixel = style().pixelMetric( TQStyle::PM_DockWindowHandleExtent,
this );
345 int buttonAreaWidth = taskBarWidth - tbHandlePixel - style().pixelMetric( TQStyle::PM_DefaultFrameWidth,
this ) - 5;
346 if ( ( ( allButtonsWidthHint ) <= buttonAreaWidth ) || ( width() < parentWidget() ->width() ) )
351 if ( b->width() != b->sizeHint().width() )
353 b->setFixedWidth( b->sizeHint().width() );
362 if ( buttonCount != 0 )
363 newButtonWidth = buttonAreaWidth / buttonCount;
366 if ( orientation() == Qt::Vertical )
368 if ( newButtonWidth > 0 )
372 if ( b->width() != newButtonWidth )
374 b->setFixedWidth( newButtonWidth );
379 m_layoutIsPending =
false;
384 if ( !m_layoutIsPending )