28 #include "tdemdichildfrmcaption.h"
29 #include "tdemdichildfrmcaption.moc"
31 #include <tqpainter.h>
32 #include <tqapplication.h>
34 #include <tqtoolbutton.h>
35 #include <tqpopupmenu.h>
37 #include "tdemdidefines.h"
38 #include "tdemdichildfrm.h"
39 #include "tdemdichildarea.h"
40 #include "tdemdimainfrm.h"
41 #include <tdelocale.h>
47 #ifndef SPI_GETGRADIENTCAPTIONS
48 # define SPI_GETGRADIENTCAPTIONS 0x1008
50 #ifndef COLOR_GRADIENTACTIVECAPTION
51 # define COLOR_GRADIENTACTIVECAPTION 27
53 #ifndef COLOR_GRADIENTINACTIVECAPTION
54 # define COLOR_GRADIENTINACTIVECAPTION 28
69 : TQWidget( parent,
"tdemdi_childfrmcaption" )
74 setBackgroundMode( NoBackground );
75 setFocusPolicy( TQ_NoFocus );
88 if ( e->button() == Qt::LeftButton )
90 setMouseTracking(
false );
93 TQApplication::setOverrideCursor( tqsizeAllCursor,
true );
98 else if ( e->button() == Qt::RightButton )
108 if ( e->button() == Qt::LeftButton )
111 TQApplication::restoreOverrideCursor();
122 TQApplication::sendEvent(
m_pParent->m_pClient, &ue );
141 TQApplication::sendEvent(
m_pParent->m_pClient, &ue );
146 TQPoint relMousePosInChildArea =
m_pParent->m_pManager->mapFromGlobal( e->globalPos() );
149 if ( !
m_pParent->m_pManager->rect().contains( relMousePosInChildArea ) )
151 if ( relMousePosInChildArea.x() < 0 )
152 relMousePosInChildArea.rx() = 0;
154 if ( relMousePosInChildArea.y() < 0 )
155 relMousePosInChildArea.ry() = 0;
157 if ( relMousePosInChildArea.x() >
m_pParent->m_pManager->width() )
158 relMousePosInChildArea.rx() =
m_pParent->m_pManager->width();
160 if ( relMousePosInChildArea.y() >
m_pParent->m_pManager->height() )
161 relMousePosInChildArea.ry() =
m_pParent->m_pManager->height();
163 TQPoint mousePosInChildArea = relMousePosInChildArea -
m_offset;
166 parentWidget() ->move( mousePosInChildArea );
177 m_pParent->m_pWinIcon->setBackgroundColor( bActive ?
180 m_pParent->m_pUnixIcon->setBackgroundColor( bActive ?
200 int hint =
m_pParent->m_pManager->m_captionFontLineSpacing + 3;
248 r.setLeft( r.left() + 22 );
252 r.setLeft( r.left() + 30 );
256 p.drawText( r, AlignVCenter | AlignLeft | SingleLine, text );
263 TQFontMetrics fm = fontMetrics();
264 int actualWidth = fm.width( origStr );
266 int realLetterCount = origStr.length();
269 if ( actualWidth != 0 )
270 newLetterCount = ( maxWidth * realLetterCount ) / actualWidth;
272 newLetterCount = realLetterCount;
274 int w = maxWidth + 1;
275 TQString s = origStr;
277 if ( newLetterCount <= 0 )
280 while ( ( w > maxWidth ) && ( newLetterCount >= 1 ) )
282 if ( newLetterCount < realLetterCount )
284 if ( newLetterCount > 3 )
285 s = origStr.left( newLetterCount / 2 ) +
"..." + origStr.right( newLetterCount / 2 );
288 if ( newLetterCount > 1 )
289 s = origStr.left( newLetterCount ) +
"..";
291 s = origStr.left( 1 );
294 TQFontMetrics fm = fontMetrics();
312 setMouseTracking(
true );
316 TQApplication::setOverrideCursor( tqsizeAllCursor,
true );
319 m_offset = mapFromGlobal( TQCursor::pos() );