You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1410 lines
43 KiB
1410 lines
43 KiB
15 years ago
|
//----------------------------------------------------------------------------
|
||
12 years ago
|
// filename : tdemdichildfrm.cpp
|
||
15 years ago
|
//----------------------------------------------------------------------------
|
||
|
// Project : KDE MDI extension
|
||
|
//
|
||
|
// begin : 07/1999 by Szymon Stefanek as part of kvirc
|
||
|
// (an IRC application)
|
||
|
// changes : 09/1999 by Falk Brettschneider to create an
|
||
|
// - 06/2000 stand-alone Qt extension set of
|
||
|
// classes and a Qt-based library
|
||
|
// : 01/2003 by Jens Zurheide to allow switching
|
||
|
// between views based on timestamps
|
||
|
// 2000-2003 maintained by the KDevelop project
|
||
|
//
|
||
|
// copyright : (C) 1999-2003 by Szymon Stefanek (stefanek@tin.it)
|
||
|
// and
|
||
|
// Falk Brettschneider
|
||
13 years ago
|
// email : falkbr@tdevelop.org (Falk Brettschneider)
|
||
15 years ago
|
//----------------------------------------------------------------------------
|
||
|
//
|
||
|
//----------------------------------------------------------------------------
|
||
|
//
|
||
|
// This program is free software; you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU Library General Public License as
|
||
|
// published by the Free Software Foundation; either version 2 of the
|
||
|
// License, or (at your option) any later version.
|
||
|
//
|
||
|
//----------------------------------------------------------------------------
|
||
|
|
||
12 years ago
|
#include "tdemdichildfrm.h"
|
||
|
#include "tdemdichildfrm.moc"
|
||
15 years ago
|
|
||
12 years ago
|
#include "tdemdidefines.h"
|
||
|
#include "tdemdichildfrmcaption.h"
|
||
|
#include "tdemdichildarea.h"
|
||
|
#include "tdemdimainfrm.h"
|
||
15 years ago
|
|
||
15 years ago
|
#include <tqpainter.h>
|
||
|
#include <tqapplication.h>
|
||
|
#include <tqcursor.h>
|
||
|
#include <tqobjectlist.h>
|
||
|
#include <tqframe.h>
|
||
|
#include <tqpopupmenu.h>
|
||
|
#include <tqtoolbutton.h>
|
||
|
#include <tqnamespace.h>
|
||
|
#include <tqimage.h>
|
||
15 years ago
|
|
||
|
#include <klocale.h>
|
||
|
#include <kiconloader.h>
|
||
|
|
||
|
//////////////////////////////////////////////////////////////////////////////
|
||
|
// KMdiChildFrm
|
||
|
//////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#define KMDI_NORESIZE 0
|
||
|
#define KMDI_RESIZE_TOP 1
|
||
|
#define KMDI_RESIZE_LEFT 2
|
||
|
#define KMDI_RESIZE_RIGHT 4
|
||
|
#define KMDI_RESIZE_BOTTOM 8
|
||
|
#define KMDI_RESIZE_TOPLEFT (1|2)
|
||
|
#define KMDI_RESIZE_TOPRIGHT (1|4)
|
||
|
#define KMDI_RESIZE_BOTTOMLEFT (8|2)
|
||
|
#define KMDI_RESIZE_BOTTOMRIGHT (8|4)
|
||
|
|
||
|
#include "filenew.xpm"
|
||
|
#include "win_closebutton.xpm"
|
||
|
#include "win_minbutton.xpm"
|
||
|
#include "win_maxbutton.xpm"
|
||
|
#include "win_restorebutton.xpm"
|
||
|
#include "win_undockbutton.xpm"
|
||
|
#include "kde_closebutton.xpm"
|
||
|
#include "kde_minbutton.xpm"
|
||
|
#include "kde_maxbutton.xpm"
|
||
|
#include "kde_restorebutton.xpm"
|
||
|
#include "kde_undockbutton.xpm"
|
||
|
#include "kde2_closebutton.xpm"
|
||
|
#include "kde2_minbutton.xpm"
|
||
|
#include "kde2_maxbutton.xpm"
|
||
|
#include "kde2_restorebutton.xpm"
|
||
|
#include "kde2_undockbutton.xpm"
|
||
|
#include "kde2laptop_closebutton.xpm"
|
||
|
#include "kde2laptop_minbutton.xpm"
|
||
|
#include "kde2laptop_maxbutton.xpm"
|
||
|
#include "kde2laptop_restorebutton.xpm"
|
||
|
#include "kde2laptop_undockbutton.xpm"
|
||
|
|
||
|
|
||
15 years ago
|
KMdiWin32IconButton::KMdiWin32IconButton( TQWidget* parent, const char* name )
|
||
|
: TQLabel( parent, name )
|
||
15 years ago
|
{}
|
||
|
|
||
|
//============ mousePressEvent ============//
|
||
|
|
||
15 years ago
|
void KMdiWin32IconButton::mousePressEvent( TQMouseEvent* )
|
||
15 years ago
|
{
|
||
|
//emit pressed();
|
||
|
}
|
||
|
|
||
|
//============ KMdiChildFrm ============//
|
||
|
|
||
|
KMdiChildFrm::KMdiChildFrm( KMdiChildArea *parent )
|
||
12 years ago
|
: TQFrame( parent, "tdemdi_childfrm" )
|
||
15 years ago
|
, m_pClient( 0L )
|
||
|
, m_pManager( 0L )
|
||
|
, m_pCaption( 0L )
|
||
|
, m_pWinIcon( 0L )
|
||
|
, m_pUnixIcon( 0L )
|
||
|
, m_pMinimize( 0L )
|
||
|
, m_pMaximize( 0L )
|
||
|
, m_pClose( 0L )
|
||
|
, m_pUndock( 0L )
|
||
|
, m_state( Normal )
|
||
|
, m_restoredRect()
|
||
|
, m_iResizeCorner( KMDI_NORESIZE )
|
||
|
, m_iLastCursorCorner( KMDI_NORESIZE )
|
||
|
, m_bResizing( false )
|
||
|
, m_bDragging( false )
|
||
|
, m_pIconButtonPixmap( 0L )
|
||
|
, m_pMinButtonPixmap( 0L )
|
||
|
, m_pMaxButtonPixmap( 0L )
|
||
|
, m_pRestoreButtonPixmap( 0L )
|
||
|
, m_pCloseButtonPixmap( 0L )
|
||
|
, m_pUndockButtonPixmap( 0L )
|
||
|
, m_windowMenuID( 0 )
|
||
|
, m_pSystemMenu( 0L )
|
||
|
, m_oldClientMinSize()
|
||
|
, m_oldClientMaxSize()
|
||
15 years ago
|
, m_oldLayoutResizeMode( TQLayout::Minimum )
|
||
15 years ago
|
{
|
||
|
m_pCaption = new KMdiChildFrmCaption( this );
|
||
|
|
||
|
m_pManager = parent;
|
||
|
|
||
12 years ago
|
m_pWinIcon = new KMdiWin32IconButton( m_pCaption, "tdemdi_iconbutton_icon" );
|
||
|
m_pUnixIcon = new TQToolButton( m_pCaption, "tdemdi_toolbutton_icon" );
|
||
|
m_pMinimize = new TQToolButton( m_pCaption, "tdemdi_toolbutton_min" );
|
||
|
m_pMaximize = new TQToolButton( m_pCaption, "tdemdi_toolbutton_max" );
|
||
|
m_pClose = new TQToolButton( m_pCaption, "tdemdi_toolbutton_close" );
|
||
|
m_pUndock = new TQToolButton( m_pCaption, "tdemdi_toolbutton_undock" );
|
||
15 years ago
|
|
||
|
TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
|
||
|
TQObject::connect( m_pMaximize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( maximizePressed() ) );
|
||
|
TQObject::connect( m_pClose, TQT_SIGNAL( clicked() ), this, TQT_SLOT( closePressed() ) );
|
||
|
TQObject::connect( m_pUndock, TQT_SIGNAL( clicked() ), this, TQT_SLOT( undockPressed() ) );
|
||
|
|
||
|
m_pIconButtonPixmap = new TQPixmap( SmallIcon( "filenew" ) );
|
||
15 years ago
|
if ( m_pIconButtonPixmap->isNull() )
|
||
15 years ago
|
* m_pIconButtonPixmap = TQPixmap( filenew );
|
||
15 years ago
|
|
||
|
redecorateButtons();
|
||
|
|
||
14 years ago
|
m_pWinIcon->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pUnixIcon->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pClose->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pMinimize->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pMaximize->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pUndock->setFocusPolicy( TQ_NoFocus );
|
||
15 years ago
|
|
||
15 years ago
|
setFrameStyle( TQFrame::WinPanel | TQFrame::Raised );
|
||
14 years ago
|
setFocusPolicy( TQ_NoFocus );
|
||
15 years ago
|
|
||
|
setMouseTracking( true );
|
||
|
|
||
|
setMinimumSize( KMDI_CHILDFRM_MIN_WIDTH, m_pCaption->heightHint() );
|
||
|
|
||
15 years ago
|
m_pSystemMenu = new TQPopupMenu();
|
||
15 years ago
|
}
|
||
|
|
||
|
//============ ~KMdiChildFrm ============//
|
||
|
|
||
|
KMdiChildFrm::~KMdiChildFrm()
|
||
|
{
|
||
|
delete m_pMinButtonPixmap;
|
||
|
delete m_pMaxButtonPixmap;
|
||
|
delete m_pRestoreButtonPixmap;
|
||
|
delete m_pCloseButtonPixmap;
|
||
|
delete m_pUndockButtonPixmap;
|
||
|
delete m_pSystemMenu;
|
||
|
delete m_pIconButtonPixmap;
|
||
|
}
|
||
|
|
||
|
//============ mousePressEvent =============//
|
||
15 years ago
|
void KMdiChildFrm::mousePressEvent( TQMouseEvent *e )
|
||
15 years ago
|
{
|
||
|
if ( m_bResizing )
|
||
|
{
|
||
15 years ago
|
if ( TQApplication::overrideCursor() )
|
||
|
TQApplication::restoreOverrideCursor();
|
||
15 years ago
|
|
||
|
m_bResizing = false;
|
||
|
releaseMouse();
|
||
|
}
|
||
|
|
||
|
m_pCaption->setActive( true );
|
||
|
m_pManager->setTopChild( this, false );
|
||
|
|
||
|
m_iResizeCorner = getResizeCorner( e->pos().x(), e->pos().y() );
|
||
|
if ( m_iResizeCorner != KMDI_NORESIZE )
|
||
|
{
|
||
|
m_bResizing = true;
|
||
|
//notify child view
|
||
|
KMdiChildFrmResizeBeginEvent ue( e );
|
||
|
if ( m_pClient != 0L )
|
||
15 years ago
|
TQApplication::sendEvent( m_pClient, &ue );
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
|
//============ mouseReleaseEvent ==============//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::mouseReleaseEvent( TQMouseEvent *e )
|
||
15 years ago
|
{
|
||
|
if ( m_bResizing )
|
||
|
{
|
||
15 years ago
|
if ( TQApplication::overrideCursor() )
|
||
|
TQApplication::restoreOverrideCursor();
|
||
15 years ago
|
|
||
|
m_bResizing = false;
|
||
|
//notify child view
|
||
|
KMdiChildFrmResizeEndEvent ue( e );
|
||
|
if ( m_pClient != 0L )
|
||
15 years ago
|
TQApplication::sendEvent( m_pClient, &ue );
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
|
//============= setResizeCursor ===============//
|
||
|
|
||
|
void KMdiChildFrm::setResizeCursor( int resizeCorner )
|
||
|
{
|
||
|
if ( resizeCorner == m_iLastCursorCorner )
|
||
|
return ; //Don't do it twice
|
||
|
|
||
|
m_iLastCursorCorner = resizeCorner;
|
||
|
switch ( resizeCorner )
|
||
|
{
|
||
|
case KMDI_NORESIZE:
|
||
15 years ago
|
if ( TQApplication::overrideCursor() )
|
||
|
TQApplication::restoreOverrideCursor();
|
||
15 years ago
|
break;
|
||
|
case KMDI_RESIZE_LEFT:
|
||
|
case KMDI_RESIZE_RIGHT:
|
||
14 years ago
|
TQApplication::setOverrideCursor( tqsizeHorCursor, true );
|
||
15 years ago
|
break;
|
||
|
case KMDI_RESIZE_TOP:
|
||
|
case KMDI_RESIZE_BOTTOM:
|
||
14 years ago
|
TQApplication::setOverrideCursor( tqsizeVerCursor, true );
|
||
15 years ago
|
break;
|
||
|
case KMDI_RESIZE_TOPLEFT:
|
||
|
case KMDI_RESIZE_BOTTOMRIGHT:
|
||
14 years ago
|
TQApplication::setOverrideCursor( tqsizeFDiagCursor, true );
|
||
15 years ago
|
break;
|
||
|
case KMDI_RESIZE_BOTTOMLEFT:
|
||
|
case KMDI_RESIZE_TOPRIGHT:
|
||
14 years ago
|
TQApplication::setOverrideCursor( tqsizeBDiagCursor, true );
|
||
15 years ago
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//============= unsetResizeCursor ===============//
|
||
|
|
||
|
void KMdiChildFrm::unsetResizeCursor()
|
||
|
{
|
||
|
if ( !m_bResizing && m_iResizeCorner != KMDI_NORESIZE )
|
||
|
{
|
||
|
m_iResizeCorner = KMDI_NORESIZE;
|
||
|
m_iLastCursorCorner = KMDI_NORESIZE;
|
||
15 years ago
|
if ( TQApplication::overrideCursor() )
|
||
|
TQApplication::restoreOverrideCursor();
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
|
//============= mouseMoveEvent ===============//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::mouseMoveEvent( TQMouseEvent *e )
|
||
15 years ago
|
{
|
||
|
if ( m_state != Normal )
|
||
|
return;
|
||
|
|
||
|
if ( !m_pClient )
|
||
|
return;
|
||
|
|
||
13 years ago
|
if ( m_pClient->minimumSize() == m_pClient->maximumSize() )
|
||
15 years ago
|
return;
|
||
|
|
||
|
if ( m_bResizing )
|
||
|
{
|
||
14 years ago
|
if ( !( e->state() & Qt::RightButton ) && !( e->state() & Qt::MidButton ) )
|
||
15 years ago
|
{
|
||
|
// same as: if no button or left button pressed
|
||
14 years ago
|
TQPoint p = parentWidget()->mapFromGlobal( e->globalPos() );
|
||
15 years ago
|
resizeWindow( m_iResizeCorner, p.x(), p.y() );
|
||
|
}
|
||
|
else
|
||
|
m_bResizing = false;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_iResizeCorner = getResizeCorner( e->pos().x(), e->pos().y() );
|
||
|
setResizeCursor( m_iResizeCorner );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//============= moveEvent ===============//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::moveEvent( TQMoveEvent* me )
|
||
15 years ago
|
{
|
||
|
// give its child view the chance to notify a childframe move
|
||
|
KMdiChildFrmMoveEvent cfme( me );
|
||
|
if ( m_pClient != 0L )
|
||
15 years ago
|
TQApplication::sendEvent( m_pClient, &cfme );
|
||
15 years ago
|
}
|
||
|
|
||
|
//=============== leaveEvent ===============//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::leaveEvent( TQEvent * )
|
||
15 years ago
|
{
|
||
|
unsetResizeCursor();
|
||
|
}
|
||
|
|
||
|
void KMdiChildFrm::resizeWindow( int resizeCorner, int xPos, int yPos )
|
||
|
{
|
||
15 years ago
|
TQRect resizeRect( x(), y(), width(), height() );
|
||
15 years ago
|
|
||
|
// Calculate the minimum width & height
|
||
|
int minWidth = 0;
|
||
|
int minHeight = 0;
|
||
13 years ago
|
int maxWidth = TQWIDGETSIZE_MAX;
|
||
|
int maxHeight = TQWIDGETSIZE_MAX;
|
||
15 years ago
|
|
||
|
// it could be the client forces the childframe to enlarge its minimum size
|
||
|
if ( m_pClient )
|
||
|
{
|
||
13 years ago
|
minWidth = m_pClient->minimumSize().width() + KMDI_CHILDFRM_DOUBLE_BORDER;
|
||
|
minHeight = m_pClient->minimumSize().height() + KMDI_CHILDFRM_DOUBLE_BORDER +
|
||
15 years ago
|
m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR;
|
||
13 years ago
|
maxWidth = m_pClient->maximumSize().width() + KMDI_CHILDFRM_DOUBLE_BORDER;
|
||
|
maxHeight = m_pClient->maximumSize().height() + KMDI_CHILDFRM_DOUBLE_BORDER +
|
||
15 years ago
|
m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR;
|
||
|
}
|
||
|
|
||
|
if ( minWidth < minimumWidth() )
|
||
|
minWidth = minimumWidth();
|
||
|
|
||
|
if ( minHeight < minimumHeight() )
|
||
|
minHeight = minimumHeight();
|
||
|
|
||
|
if ( maxWidth > maximumWidth() )
|
||
|
maxWidth = maximumWidth();
|
||
|
|
||
|
if ( maxHeight > maximumHeight() )
|
||
|
maxHeight = maximumHeight();
|
||
|
|
||
15 years ago
|
TQPoint mousePos( xPos, yPos );
|
||
15 years ago
|
|
||
|
// manipulate width
|
||
|
switch ( resizeCorner )
|
||
|
{
|
||
|
//left sides
|
||
|
case KMDI_RESIZE_TOPLEFT:
|
||
|
case KMDI_RESIZE_LEFT:
|
||
|
case KMDI_RESIZE_BOTTOMLEFT:
|
||
|
resizeRect.setLeft( mousePos.x() );
|
||
|
if ( resizeRect.width() < minWidth )
|
||
|
resizeRect.setLeft( resizeRect.right() - minWidth + 1 );
|
||
|
if ( resizeRect.width() > maxWidth )
|
||
|
resizeRect.setLeft( resizeRect.right() - maxWidth + 1 );
|
||
|
break;
|
||
|
//right sides
|
||
|
case KMDI_RESIZE_TOPRIGHT:
|
||
|
case KMDI_RESIZE_RIGHT:
|
||
|
case KMDI_RESIZE_BOTTOMRIGHT:
|
||
|
resizeRect.setRight( mousePos.x() );
|
||
|
if ( resizeRect.width() < minWidth )
|
||
|
resizeRect.setRight( resizeRect.left() + minWidth - 1 );
|
||
|
if ( resizeRect.width() > maxWidth )
|
||
|
resizeRect.setRight( resizeRect.left() + maxWidth - 1 );
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
// manipulate height
|
||
|
switch ( resizeCorner )
|
||
|
{
|
||
|
case KMDI_RESIZE_TOPLEFT:
|
||
|
case KMDI_RESIZE_TOP:
|
||
|
case KMDI_RESIZE_TOPRIGHT:
|
||
|
resizeRect.setTop( mousePos.y() );
|
||
|
if ( resizeRect.height() < minHeight )
|
||
|
resizeRect.setTop( resizeRect.bottom() - minHeight + 1 );
|
||
|
if ( resizeRect.height() > maxHeight )
|
||
|
resizeRect.setTop( resizeRect.bottom() - maxHeight + 1 );
|
||
|
break;
|
||
|
case KMDI_RESIZE_BOTTOMLEFT:
|
||
|
case KMDI_RESIZE_BOTTOM:
|
||
|
case KMDI_RESIZE_BOTTOMRIGHT:
|
||
|
resizeRect.setBottom( mousePos.y() );
|
||
|
if ( resizeRect.height() < minHeight )
|
||
|
resizeRect.setBottom( resizeRect.top() + minHeight - 1 );
|
||
|
if ( resizeRect.height() > maxHeight )
|
||
|
resizeRect.setBottom( resizeRect.top() + maxHeight - 1 );
|
||
|
break;
|
||
|
default:
|
||
|
// nothing to do
|
||
|
break;
|
||
|
}
|
||
|
// actually resize
|
||
|
setGeometry( resizeRect );
|
||
|
|
||
|
if ( m_state == Maximized )
|
||
|
{
|
||
|
m_state = Normal;
|
||
|
m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//================= getResizeCorner =============//
|
||
|
|
||
|
int KMdiChildFrm::getResizeCorner( int ax, int ay )
|
||
|
{
|
||
|
int ret = KMDI_NORESIZE;
|
||
|
if ( m_pClient->minimumWidth() != m_pClient->maximumWidth() )
|
||
|
{
|
||
|
if ( ( ax > 0 ) && ( ax < ( KMDI_CHILDFRM_BORDER + 2 ) ) )
|
||
|
ret |= KMDI_RESIZE_LEFT;
|
||
|
|
||
|
if ( ( ax < width() ) && ( ax > ( width() - ( KMDI_CHILDFRM_BORDER + 2 ) ) ) )
|
||
|
ret |= KMDI_RESIZE_RIGHT;
|
||
|
}
|
||
|
if ( m_pClient->minimumHeight() != m_pClient->maximumHeight() )
|
||
|
{
|
||
|
if ( ( ay > 0 ) && ( ay < ( KMDI_CHILDFRM_BORDER + 2 ) ) )
|
||
|
ret |= KMDI_RESIZE_TOP;
|
||
|
|
||
|
if ( ( ay < ( height() ) ) && ( ay > ( height() - ( KMDI_CHILDFRM_BORDER + 2 ) ) ) )
|
||
|
ret |= KMDI_RESIZE_BOTTOM;
|
||
|
}
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
//============= maximizePressed ============//
|
||
|
|
||
|
void KMdiChildFrm::maximizePressed()
|
||
|
{
|
||
|
switch ( m_state )
|
||
|
{
|
||
|
case Maximized:
|
||
|
emit m_pManager->nowMaximized( false );
|
||
|
setState( Normal );
|
||
|
break;
|
||
|
case Normal:
|
||
|
case Minimized:
|
||
|
setState( Maximized );
|
||
|
emit m_pManager->nowMaximized( true );
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void KMdiChildFrm::restorePressed()
|
||
|
{
|
||
|
if ( m_state == Normal )
|
||
|
return ;
|
||
|
|
||
|
if ( m_state == Maximized )
|
||
|
emit m_pManager->nowMaximized( false );
|
||
|
|
||
|
setState( Normal );
|
||
|
}
|
||
|
|
||
|
//============= minimizePressed ============//
|
||
|
|
||
|
void KMdiChildFrm::minimizePressed()
|
||
|
{
|
||
|
switch ( m_state )
|
||
|
{
|
||
|
case Minimized:
|
||
|
setState( Normal );
|
||
|
break;
|
||
|
case Normal:
|
||
|
setState( Minimized );
|
||
|
break;
|
||
|
case Maximized:
|
||
|
emit m_pManager->nowMaximized( false );
|
||
|
setState( Normal );
|
||
|
setState( Minimized );
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//============= closePressed ============//
|
||
|
|
||
|
void KMdiChildFrm::closePressed()
|
||
|
{
|
||
|
if ( m_pClient )
|
||
|
m_pClient->close();
|
||
|
}
|
||
|
|
||
|
//============= undockPressed ============//
|
||
|
|
||
|
void KMdiChildFrm::undockPressed()
|
||
|
{
|
||
|
if ( m_pClient )
|
||
|
{
|
||
|
if ( m_state == Minimized )
|
||
|
setState( Normal );
|
||
|
m_pClient->detach();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//============ setState =================//
|
||
|
|
||
|
void KMdiChildFrm::setState( MdiWindowState state, bool /*bAnimate*/ )
|
||
|
{
|
||
|
if ( m_state == Normal ) //save the current rect
|
||
15 years ago
|
m_restoredRect = TQRect( x(), y(), width(), height() );
|
||
15 years ago
|
|
||
|
switch ( state )
|
||
|
{
|
||
|
case Normal:
|
||
|
switch ( m_state )
|
||
|
{
|
||
|
case Maximized:
|
||
|
m_pClient->m_stateChanged = true;
|
||
|
m_state = state;
|
||
14 years ago
|
// client min / max size / layout behavior don't change
|
||
15 years ago
|
// set frame max size indirectly by setting the clients max size to
|
||
|
// it's current value (calls setMaxSize() of frame)
|
||
13 years ago
|
m_pClient->setMaximumSize( m_pClient->maximumSize().width(), m_pClient->maximumSize().height() );
|
||
15 years ago
|
m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
|
||
|
setGeometry( m_restoredRect );
|
||
|
break;
|
||
|
case Minimized:
|
||
|
m_pClient->m_stateChanged = true;
|
||
|
m_state = state;
|
||
14 years ago
|
// restore client min / max size / layout behavior
|
||
15 years ago
|
m_pClient->setMinimumSize( m_oldClientMinSize.width(), m_oldClientMinSize.height() );
|
||
|
m_pClient->setMaximumSize( m_oldClientMaxSize.width(), m_oldClientMaxSize.height() );
|
||
13 years ago
|
if ( m_pClient->layout() != 0L )
|
||
15 years ago
|
{
|
||
13 years ago
|
m_pClient->layout() ->setResizeMode( m_oldLayoutResizeMode );
|
||
15 years ago
|
}
|
||
|
m_pMinimize->setPixmap( *m_pMinButtonPixmap );
|
||
|
m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
|
||
15 years ago
|
TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( restorePressed() ) );
|
||
|
TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
|
||
15 years ago
|
setGeometry( m_restoredRect );
|
||
|
break;
|
||
|
case Normal:
|
||
|
break;
|
||
|
}
|
||
|
break;
|
||
|
case Maximized:
|
||
|
switch ( m_state )
|
||
|
{
|
||
|
case Minimized:
|
||
|
{
|
||
|
m_pClient->m_stateChanged = true;
|
||
|
m_state = state;
|
||
14 years ago
|
// restore client min / max size / layout behavior
|
||
15 years ago
|
m_pClient->setMinimumSize( m_oldClientMinSize.width(), m_oldClientMinSize.height() );
|
||
|
m_pClient->setMaximumSize( m_oldClientMaxSize.width(), m_oldClientMaxSize.height() );
|
||
13 years ago
|
if ( m_pClient->layout() != 0L )
|
||
15 years ago
|
{
|
||
13 years ago
|
m_pClient->layout() ->setResizeMode( m_oldLayoutResizeMode );
|
||
15 years ago
|
}
|
||
13 years ago
|
setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
|
||
15 years ago
|
// reset to maximize-captionbar
|
||
|
m_pMaximize->setPixmap( *m_pRestoreButtonPixmap );
|
||
|
m_pMinimize->setPixmap( *m_pMinButtonPixmap );
|
||
15 years ago
|
TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( restorePressed() ) );
|
||
|
TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
|
||
15 years ago
|
int nFrameWidth = KMDI_CHILDFRM_DOUBLE_BORDER;
|
||
|
int nFrameHeight = KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR +
|
||
|
m_pCaption->heightHint();
|
||
|
setGeometry( -m_pClient->x(), -m_pClient->y(),
|
||
|
m_pManager->width() + nFrameWidth,
|
||
|
m_pManager->height() + nFrameHeight );
|
||
|
raise();
|
||
|
}
|
||
|
break;
|
||
|
case Normal:
|
||
|
{
|
||
|
m_pClient->m_stateChanged = true;
|
||
|
m_state = state;
|
||
14 years ago
|
// client min / max size / layout behavior don't change
|
||
13 years ago
|
setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
|
||
15 years ago
|
m_pMaximize->setPixmap( *m_pRestoreButtonPixmap );
|
||
|
int nFrameWidth = KMDI_CHILDFRM_DOUBLE_BORDER;
|
||
|
int nFrameHeight = KMDI_CHILDFRM_DOUBLE_BORDER + KMDI_CHILDFRM_SEPARATOR +
|
||
|
m_pCaption->heightHint();
|
||
15 years ago
|
TQRect maximizedFrmRect( -m_pClient->x(), -m_pClient->y(),
|
||
15 years ago
|
m_pManager->width() + nFrameWidth,
|
||
|
m_pManager->height() + nFrameHeight );
|
||
14 years ago
|
if ( geometry() != maximizedFrmRect )
|
||
15 years ago
|
{
|
||
|
setGeometry( maximizedFrmRect );
|
||
|
}
|
||
|
raise();
|
||
|
}
|
||
|
break;
|
||
|
case Maximized:
|
||
|
break;
|
||
|
}
|
||
|
break;
|
||
|
case Minimized:
|
||
|
switch ( m_state )
|
||
|
{
|
||
|
case Maximized:
|
||
|
m_pClient->m_stateChanged = true;
|
||
|
m_state = state;
|
||
14 years ago
|
// save client min / max size / layout behavior
|
||
13 years ago
|
m_oldClientMinSize = m_pClient->minimumSize();
|
||
|
m_oldClientMaxSize = m_pClient->maximumSize();
|
||
13 years ago
|
if ( m_pClient->layout() != 0L )
|
||
15 years ago
|
{
|
||
13 years ago
|
m_oldLayoutResizeMode = m_pClient->layout() ->resizeMode();
|
||
15 years ago
|
}
|
||
|
m_pClient->setMinimumSize( 0, 0 );
|
||
|
m_pClient->setMaximumSize( 0, 0 );
|
||
13 years ago
|
if ( m_pClient->layout() != 0L )
|
||
15 years ago
|
{
|
||
13 years ago
|
m_pClient->layout() ->setResizeMode( TQLayout::FreeResize );
|
||
15 years ago
|
}
|
||
|
switchToMinimizeLayout();
|
||
|
m_pManager->childMinimized( this, true );
|
||
|
break;
|
||
|
case Normal:
|
||
|
m_pClient->m_stateChanged = true;
|
||
|
m_state = state;
|
||
14 years ago
|
// save client min / max size / layout behavior
|
||
13 years ago
|
m_oldClientMinSize = m_pClient->minimumSize();
|
||
|
m_oldClientMaxSize = m_pClient->maximumSize();
|
||
13 years ago
|
if ( m_pClient->layout() != 0L )
|
||
15 years ago
|
{
|
||
13 years ago
|
m_oldLayoutResizeMode = m_pClient->layout() ->resizeMode();
|
||
15 years ago
|
}
|
||
14 years ago
|
m_restoredRect = geometry();
|
||
15 years ago
|
m_pClient->setMinimumSize( 0, 0 );
|
||
|
m_pClient->setMaximumSize( 0, 0 );
|
||
13 years ago
|
if ( m_pClient->layout() != 0L )
|
||
15 years ago
|
{
|
||
13 years ago
|
m_pClient->layout() ->setResizeMode( TQLayout::FreeResize );
|
||
15 years ago
|
}
|
||
|
switchToMinimizeLayout();
|
||
|
m_pManager->childMinimized( this, false );
|
||
|
break;
|
||
|
case Minimized:
|
||
|
break;
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
KMdiChildFrm* pTopFrame = m_pManager->topChild();
|
||
|
KMdiChildView* pTopChild = 0L;
|
||
|
if ( pTopFrame != 0L )
|
||
|
{
|
||
|
pTopChild = pTopFrame->m_pClient;
|
||
|
}
|
||
|
if ( ( pTopChild != 0L ) && pTopChild->isMaximized() )
|
||
|
{
|
||
|
m_pManager->setMinimumSize( pTopChild->minimumWidth(), pTopChild->minimumHeight() );
|
||
|
/// @todo: setting the maximum size doesn't work properly - fix this later
|
||
|
/// m_pManager->setMaximumSize(pTopChild->maximumWidth(), pTopChild->maximumHeight());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_pManager->setMinimumSize( 0, 0 );
|
||
13 years ago
|
m_pManager->setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
|
//============== restoreGeometry ================//
|
||
|
|
||
15 years ago
|
TQRect KMdiChildFrm::restoreGeometry() const
|
||
15 years ago
|
{
|
||
|
return m_restoredRect;
|
||
|
}
|
||
|
|
||
|
//============== setRestoreGeometry ================//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::setRestoreGeometry( const TQRect& newRestGeo )
|
||
15 years ago
|
{
|
||
|
m_restoredRect = newRestGeo;
|
||
|
}
|
||
|
|
||
|
//============ setCaption ===============//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::setCaption( const TQString& text )
|
||
15 years ago
|
{
|
||
|
m_pCaption->setCaption( text );
|
||
|
}
|
||
|
|
||
|
//============ enableClose ==============//
|
||
|
|
||
|
void KMdiChildFrm::enableClose( bool bEnable )
|
||
|
{
|
||
|
m_pClose->setEnabled( bEnable );
|
||
13 years ago
|
m_pClose->repaint( false );
|
||
15 years ago
|
}
|
||
|
|
||
|
//============ setIcon ==================//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::setIcon( const TQPixmap& pxm )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQPixmap p = pxm;
|
||
15 years ago
|
if ( p.width() != 18 || p.height() != 18 )
|
||
|
{
|
||
15 years ago
|
TQImage img = p.convertToImage();
|
||
14 years ago
|
p = img.smoothScale( 18, 18, TQ_ScaleMin );
|
||
15 years ago
|
}
|
||
|
const bool do_resize = m_pIconButtonPixmap->size() != p.size();
|
||
|
*m_pIconButtonPixmap = p;
|
||
|
m_pWinIcon->setPixmap( p );
|
||
|
m_pUnixIcon->setPixmap( p );
|
||
|
if ( do_resize )
|
||
|
doResize( true );
|
||
|
}
|
||
|
|
||
|
//============ icon =================//
|
||
|
|
||
15 years ago
|
TQPixmap* KMdiChildFrm::icon() const
|
||
15 years ago
|
{
|
||
|
return m_pIconButtonPixmap;
|
||
|
}
|
||
|
|
||
|
//============ setClient ============//
|
||
|
void KMdiChildFrm::setClient( KMdiChildView *w, bool bAutomaticResize )
|
||
|
{
|
||
|
m_pClient = w;
|
||
|
|
||
|
if ( w->icon() )
|
||
|
setIcon( *( w->icon() ) );
|
||
|
|
||
|
//resize to match the client
|
||
|
int clientYPos = m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_BORDER;
|
||
15 years ago
|
if ( bAutomaticResize || w->size().isEmpty() || ( w->size() == TQSize( 1, 1 ) ) )
|
||
15 years ago
|
{
|
||
|
if ( m_pManager->topChild() )
|
||
|
{
|
||
|
resize( m_pManager->topChild() ->size() );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
resize( m_pManager->m_defaultChildFrmSize.width() + KMDI_CHILDFRM_DOUBLE_BORDER,
|
||
|
m_pManager->m_defaultChildFrmSize.height() + KMDI_CHILDFRM_BORDER + clientYPos );
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
resize( w->width() + KMDI_CHILDFRM_DOUBLE_BORDER, w->height() + KMDI_CHILDFRM_BORDER + clientYPos );
|
||
|
}
|
||
|
|
||
|
// memorize the focuses in a dictionary because they will get lost during reparenting
|
||
14 years ago
|
TQDict<TQ_FocusPolicy>* pFocPolDict = new TQDict<TQ_FocusPolicy>;
|
||
15 years ago
|
pFocPolDict->setAutoDelete( true );
|
||
14 years ago
|
TQObjectList *list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
|
||
15 years ago
|
TQObjectListIt it( *list ); // iterate over the buttons
|
||
|
TQObject * obj;
|
||
15 years ago
|
int i = 1;
|
||
|
while ( ( obj = it.current() ) != 0 )
|
||
|
{ // for each found object...
|
||
|
++it;
|
||
15 years ago
|
TQWidget* widg = ( TQWidget* ) obj;
|
||
15 years ago
|
if ( widg->name( 0 ) == 0 )
|
||
|
{
|
||
15 years ago
|
TQString tmpStr;
|
||
15 years ago
|
tmpStr.setNum( i );
|
||
|
tmpStr = "unnamed" + tmpStr;
|
||
|
widg->setName( tmpStr.latin1() );
|
||
|
i++;
|
||
|
}
|
||
14 years ago
|
TQ_FocusPolicy* pFocPol = new TQ_FocusPolicy;
|
||
15 years ago
|
*pFocPol = widg->focusPolicy();
|
||
|
pFocPolDict->insert( widg->name(), pFocPol );
|
||
|
}
|
||
|
delete list; // delete the list, not the objects
|
||
|
|
||
|
//Reparent if needed
|
||
13 years ago
|
if ( TQT_BASE_OBJECT(w->parent()) != TQT_BASE_OBJECT(this) )
|
||
15 years ago
|
{
|
||
|
//reparent to this widget , no flags , point , show it
|
||
15 years ago
|
TQPoint pnt2( KMDI_CHILDFRM_BORDER, clientYPos );
|
||
13 years ago
|
TQSize mincs = w->minimumSize();
|
||
|
TQSize maxcs = w->maximumSize();
|
||
15 years ago
|
w->setMinimumSize( 0, 0 );
|
||
13 years ago
|
w->setMaximumSize( TQWIDGETSIZE_MAX, TQWIDGETSIZE_MAX );
|
||
15 years ago
|
|
||
|
// min/max sizes, flags, DND get lost. :-(
|
||
|
w->reparent( this, 0, pnt2, w->isVisible() );
|
||
|
|
||
|
w->setMinimumSize( mincs.width(), mincs.height() );
|
||
|
w->setMaximumSize( maxcs.width(), maxcs.height() );
|
||
|
}
|
||
|
else
|
||
|
w->move( KMDI_CHILDFRM_BORDER, clientYPos );
|
||
|
|
||
|
linkChildren( pFocPolDict );
|
||
|
|
||
15 years ago
|
TQObject::connect( m_pClient, TQT_SIGNAL( mdiParentNowMaximized( bool ) ), m_pManager, TQT_SIGNAL( nowMaximized( bool ) ) );
|
||
15 years ago
|
|
||
|
if ( m_pClient->minimumWidth() > m_pManager->m_defaultChildFrmSize.width() )
|
||
13 years ago
|
setMinimumWidth( m_pClient->minimumSize().width() + KMDI_CHILDFRM_DOUBLE_BORDER );
|
||
15 years ago
|
|
||
|
if ( m_pClient->minimumHeight() > m_pManager->m_defaultChildFrmSize.height() )
|
||
|
{
|
||
13 years ago
|
setMinimumHeight( m_pClient->minimumSize().height() + KMDI_CHILDFRM_DOUBLE_BORDER +
|
||
15 years ago
|
m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//============ unsetClient ============//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::unsetClient( TQPoint positionOffset )
|
||
15 years ago
|
{
|
||
|
if ( !m_pClient )
|
||
|
return ;
|
||
|
|
||
15 years ago
|
TQObject::disconnect( m_pClient, TQT_SIGNAL( mdiParentNowMaximized( bool ) ), m_pManager, TQT_SIGNAL( nowMaximized( bool ) ) );
|
||
15 years ago
|
|
||
|
//reparent to desktop widget , no flags , point , show it
|
||
14 years ago
|
TQDict<TQ_FocusPolicy>* pFocPolDict;
|
||
15 years ago
|
pFocPolDict = unlinkChildren();
|
||
|
|
||
|
// get name of focused child widget
|
||
15 years ago
|
TQWidget* focusedChildWidget = m_pClient->focusedChildWidget();
|
||
15 years ago
|
const char* nameOfFocusedWidget = "";
|
||
|
if ( focusedChildWidget != 0 )
|
||
|
nameOfFocusedWidget = focusedChildWidget->name();
|
||
|
|
||
13 years ago
|
TQSize mins = m_pClient->minimumSize();
|
||
|
TQSize maxs = m_pClient->maximumSize();
|
||
15 years ago
|
m_pClient->reparent( 0, 0, mapToGlobal( pos() ) - pos() + positionOffset, isVisible() );
|
||
|
m_pClient->setMinimumSize( mins.width(), mins.height() );
|
||
|
m_pClient->setMaximumSize( maxs.width(), maxs.height() );
|
||
|
|
||
|
// remember the focus policies using the dictionary and reset them
|
||
14 years ago
|
TQObjectList *list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
|
||
15 years ago
|
TQObjectListIt it( *list ); // iterate over all child widgets of child frame
|
||
|
TQObject * obj;
|
||
|
TQWidget* firstFocusableChildWidget = 0;
|
||
|
TQWidget* lastFocusableChildWidget = 0;
|
||
15 years ago
|
while ( ( obj = it.current() ) != 0 )
|
||
|
{ // for each found object...
|
||
15 years ago
|
TQWidget * widg = ( TQWidget* ) obj;
|
||
15 years ago
|
++it;
|
||
13 years ago
|
TQ_FocusPolicy* pFocPol = pFocPolDict->find( widg->name() ); // remember the focus policy from before the reparent
|
||
15 years ago
|
if ( pFocPol )
|
||
|
widg->setFocusPolicy( *pFocPol );
|
||
|
|
||
|
// reset focus to old position (doesn't work :-( for its own unexplicable reasons)
|
||
|
if ( widg->name() == nameOfFocusedWidget )
|
||
|
widg->setFocus();
|
||
|
|
||
|
// get first and last focusable widget
|
||
14 years ago
|
if ( ( widg->focusPolicy() == TQ_StrongFocus ) || ( widg->focusPolicy() == TQ_TabFocus ) )
|
||
15 years ago
|
{
|
||
|
if ( firstFocusableChildWidget == 0 )
|
||
|
firstFocusableChildWidget = widg; // first widget
|
||
|
lastFocusableChildWidget = widg; // last widget
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
14 years ago
|
if ( widg->focusPolicy() == TQ_WheelFocus )
|
||
15 years ago
|
{
|
||
|
if ( firstFocusableChildWidget == 0 )
|
||
|
firstFocusableChildWidget = widg; // first widget
|
||
|
lastFocusableChildWidget = widg; // last widget
|
||
13 years ago
|
//tqDebug("*** %s (%s)",widg->name(),widg->className());
|
||
15 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
delete list; // delete the list, not the objects
|
||
|
delete pFocPolDict;
|
||
|
|
||
|
// reset first and last focusable widget
|
||
|
m_pClient->setFirstFocusableChildWidget( firstFocusableChildWidget );
|
||
|
m_pClient->setLastFocusableChildWidget( lastFocusableChildWidget );
|
||
|
|
||
|
// reset the focus policy of the view
|
||
14 years ago
|
m_pClient->setFocusPolicy( TQ_ClickFocus );
|
||
15 years ago
|
|
||
|
// lose information about the view (because it's undocked now)
|
||
|
m_pClient = 0;
|
||
|
}
|
||
|
|
||
|
//============== linkChildren =============//
|
||
14 years ago
|
void KMdiChildFrm::linkChildren( TQDict<TQ_FocusPolicy>* pFocPolDict )
|
||
15 years ago
|
{
|
||
|
// reset the focus policies for all widgets in the view (take them from the dictionary)
|
||
14 years ago
|
TQObjectList* list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
|
||
15 years ago
|
TQObjectListIt it( *list ); // iterate over all child widgets of child frame
|
||
|
TQObject* obj;
|
||
15 years ago
|
while ( ( obj = it.current() ) != 0 )
|
||
|
{ // for each found object...
|
||
15 years ago
|
TQWidget* widg = ( TQWidget* ) obj;
|
||
15 years ago
|
++it;
|
||
13 years ago
|
TQ_FocusPolicy* pFocPol = pFocPolDict->find( widg->name() ); // remember the focus policy from before the reparent
|
||
15 years ago
|
|
||
|
if ( pFocPol != 0 )
|
||
|
widg->setFocusPolicy( *pFocPol );
|
||
|
|
||
14 years ago
|
if ( !( widg->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ) ) )
|
||
15 years ago
|
widg->installEventFilter( this );
|
||
|
|
||
|
}
|
||
|
delete list; // delete the list, not the objects
|
||
|
delete pFocPolDict;
|
||
|
|
||
|
// reset the focus policies for the rest
|
||
14 years ago
|
m_pWinIcon->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pUnixIcon->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pClient->setFocusPolicy( TQ_ClickFocus );
|
||
|
m_pCaption->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pUndock->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pMinimize->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pMaximize->setFocusPolicy( TQ_NoFocus );
|
||
|
m_pClose->setFocusPolicy( TQ_NoFocus );
|
||
15 years ago
|
|
||
|
// install the event filter (catch mouse clicks) for the rest
|
||
|
m_pWinIcon->installEventFilter( this );
|
||
|
m_pUnixIcon->installEventFilter( this );
|
||
|
m_pCaption->installEventFilter( this );
|
||
|
m_pUndock->installEventFilter( this );
|
||
|
m_pMinimize->installEventFilter( this );
|
||
|
m_pMaximize->installEventFilter( this );
|
||
|
m_pClose->installEventFilter( this );
|
||
|
m_pClient->installEventFilter( this );
|
||
|
// m_pClient->installEventFilterForAllChildren();
|
||
|
}
|
||
|
|
||
|
//============== unlinkChildren =============//
|
||
|
|
||
14 years ago
|
TQDict<TQ_FocusPolicy>* KMdiChildFrm::unlinkChildren()
|
||
15 years ago
|
{
|
||
|
// memorize the focuses in a dictionary because they will get lost during reparenting
|
||
14 years ago
|
TQDict<TQ_FocusPolicy>* pFocPolDict = new TQDict<TQ_FocusPolicy>;
|
||
15 years ago
|
pFocPolDict->setAutoDelete( true );
|
||
|
|
||
14 years ago
|
TQObjectList *list = m_pClient->queryList( TQWIDGET_OBJECT_NAME_STRING );
|
||
15 years ago
|
TQObjectListIt it( *list ); // iterate over all child widgets of child frame
|
||
|
TQObject * obj;
|
||
15 years ago
|
int i = 1;
|
||
|
while ( ( obj = it.current() ) != 0 )
|
||
|
{ // for each found object...
|
||
|
++it;
|
||
15 years ago
|
TQWidget* w = ( TQWidget* ) obj;
|
||
15 years ago
|
// get current widget object name
|
||
|
if ( w->name( 0 ) == 0 )
|
||
|
{
|
||
15 years ago
|
TQString tmpStr;
|
||
15 years ago
|
tmpStr.setNum( i );
|
||
|
tmpStr = "unnamed" + tmpStr;
|
||
|
w->setName( tmpStr.latin1() );
|
||
|
i++;
|
||
|
}
|
||
14 years ago
|
TQ_FocusPolicy* pFocPol = new TQ_FocusPolicy;
|
||
15 years ago
|
*pFocPol = w->focusPolicy();
|
||
|
// memorize focus policy
|
||
|
pFocPolDict->insert( w->name(), pFocPol );
|
||
|
// remove event filter
|
||
15 years ago
|
( ( TQWidget* ) obj ) ->removeEventFilter( this );
|
||
15 years ago
|
}
|
||
|
delete list; // delete the list, not the objects
|
||
|
|
||
|
// remove the event filter (catch mouse clicks) for the rest
|
||
|
m_pWinIcon->removeEventFilter( this );
|
||
|
m_pUnixIcon->removeEventFilter( this );
|
||
|
m_pCaption->removeEventFilter( this );
|
||
|
m_pUndock->removeEventFilter( this );
|
||
|
m_pMinimize->removeEventFilter( this );
|
||
|
m_pMaximize->removeEventFilter( this );
|
||
|
m_pClose->removeEventFilter( this );
|
||
|
m_pClient->removeEventFilter( this );
|
||
|
|
||
|
//SCHEDULED_FOR_REMOVE m_pClient->removeEventFilterForAllChildren();
|
||
|
|
||
|
return pFocPolDict;
|
||
|
}
|
||
|
|
||
|
//============== resizeEvent ===============//
|
||
|
|
||
15 years ago
|
void KMdiChildFrm::resizeEvent( TQResizeEvent * )
|
||
15 years ago
|
{
|
||
|
doResize(); // an extra method because it can also called directly
|
||
|
}
|
||
|
|
||
|
void KMdiChildFrm::doResize()
|
||
|
{
|
||
|
doResize( false );
|
||
|
}
|
||
|
|
||
|
void KMdiChildFrm::doResize( bool captionOnly )
|
||
|
{
|
||
|
//Resize the caption
|
||
|
int captionHeight = m_pCaption->heightHint();
|
||
|
int captionWidth = width() - KMDI_CHILDFRM_DOUBLE_BORDER;
|
||
|
int buttonHeight = m_pClose->pixmap() ->height();
|
||
|
int buttonWidth = m_pClose->pixmap() ->width();
|
||
|
int heightOffset = captionHeight / 2 - buttonHeight / 2;
|
||
|
int rightOffset1 = 1;
|
||
|
int rightOffset2 = 1;
|
||
|
int frmIconHeight = m_pWinIcon->pixmap() ->height();
|
||
|
int frmIconWidth = m_pWinIcon->pixmap() ->width();
|
||
|
int frmIconOffset = 1;
|
||
15 years ago
|
TQWidget* pIconWidget = m_pWinIcon;
|
||
15 years ago
|
m_pCaption->setGeometry( KMDI_CHILDFRM_BORDER, KMDI_CHILDFRM_BORDER, captionWidth, captionHeight );
|
||
|
|
||
|
//The buttons are caption children
|
||
|
if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
|
||
|
{
|
||
|
rightOffset2 += 2;
|
||
|
m_pUnixIcon->hide();
|
||
|
}
|
||
|
else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
|
||
|
{
|
||
|
buttonWidth += 4;
|
||
|
buttonHeight += 4;
|
||
|
heightOffset -= 2;
|
||
|
rightOffset1 = 0;
|
||
|
rightOffset2 = 0;
|
||
|
m_pWinIcon->hide();
|
||
|
frmIconHeight = buttonHeight;
|
||
|
frmIconWidth = buttonWidth;
|
||
|
frmIconOffset = 0;
|
||
|
pIconWidget = m_pUnixIcon;
|
||
|
}
|
||
|
else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDELook )
|
||
|
{
|
||
|
buttonWidth += 3;
|
||
|
buttonHeight += 3;
|
||
|
heightOffset -= 1;
|
||
|
m_pUnixIcon->hide();
|
||
|
}
|
||
|
if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::KDELaptopLook )
|
||
|
{
|
||
|
pIconWidget->setGeometry( frmIconOffset, captionHeight / 2 - frmIconHeight / 2, frmIconWidth, frmIconHeight );
|
||
|
m_pClose->setGeometry( ( captionWidth - buttonWidth ) - rightOffset1, heightOffset, buttonWidth, buttonHeight );
|
||
|
m_pMaximize->setGeometry( ( captionWidth - ( buttonWidth * 2 ) ) - rightOffset2, heightOffset, buttonWidth, buttonHeight );
|
||
|
m_pMinimize->setGeometry( ( captionWidth - ( buttonWidth * 3 ) ) - rightOffset2, heightOffset, buttonWidth, buttonHeight );
|
||
|
m_pUndock->setGeometry( ( captionWidth - ( buttonWidth * 4 ) ) - rightOffset2, heightOffset, buttonWidth, buttonHeight );
|
||
|
}
|
||
|
else
|
||
|
{ // KDELaptopLook
|
||
|
m_pWinIcon->hide();
|
||
|
m_pUnixIcon->hide();
|
||
|
buttonHeight += 5;
|
||
|
heightOffset -= 2;
|
||
|
m_pClose->setGeometry ( 0, heightOffset, 27, buttonHeight );
|
||
|
m_pMaximize->setGeometry( captionWidth - 27, heightOffset, 27, buttonHeight );
|
||
|
m_pMinimize->setGeometry( captionWidth - 27 * 2, heightOffset, 27, buttonHeight );
|
||
|
m_pUndock->setGeometry ( captionWidth - 27 * 3, heightOffset, 27, buttonHeight );
|
||
|
}
|
||
|
|
||
|
//Resize the client
|
||
|
if ( !captionOnly && m_pClient )
|
||
|
{
|
||
15 years ago
|
TQSize newClientSize( captionWidth,
|
||
15 years ago
|
height() - ( KMDI_CHILDFRM_DOUBLE_BORDER + captionHeight + KMDI_CHILDFRM_SEPARATOR ) );
|
||
|
if ( newClientSize != m_pClient->size() )
|
||
|
{
|
||
|
m_pClient->setGeometry( KMDI_CHILDFRM_BORDER,
|
||
|
m_pCaption->heightHint() + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_BORDER,
|
||
|
newClientSize.width(), newClientSize.height() );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
15 years ago
|
static bool hasParent( TQObject* par, TQObject* o )
|
||
15 years ago
|
{
|
||
|
while ( o && o != par )
|
||
13 years ago
|
o = o->parent();
|
||
15 years ago
|
return o == par;
|
||
|
}
|
||
|
|
||
|
//============= eventFilter ===============//
|
||
|
|
||
15 years ago
|
bool KMdiChildFrm::eventFilter( TQObject *obj, TQEvent *e )
|
||
15 years ago
|
{
|
||
|
switch ( e->type() )
|
||
|
{
|
||
15 years ago
|
case TQEvent::Enter:
|
||
15 years ago
|
{
|
||
|
// check if the receiver is really a child of this frame
|
||
|
bool bIsChild = false;
|
||
15 years ago
|
TQObject* pObj = obj;
|
||
15 years ago
|
while ( ( pObj != 0L ) && !bIsChild )
|
||
|
{
|
||
14 years ago
|
bIsChild = ( TQT_BASE_OBJECT(pObj) == TQT_BASE_OBJECT(this) );
|
||
13 years ago
|
pObj = pObj->parent();
|
||
15 years ago
|
}
|
||
|
// unset the resize cursor if the cursor moved from the frame into a inner widget
|
||
|
if ( bIsChild )
|
||
|
unsetResizeCursor();
|
||
|
}
|
||
|
break;
|
||
15 years ago
|
case TQEvent::MouseButtonPress:
|
||
15 years ago
|
{
|
||
14 years ago
|
if ( !hasParent( TQT_TQOBJECT(m_pClient), obj ) )
|
||
15 years ago
|
{
|
||
|
bool bIsSecondClick = false;
|
||
15 years ago
|
if ( m_timeMeasure.elapsed() <= TQApplication::doubleClickInterval() )
|
||
15 years ago
|
bIsSecondClick = true; // of a possible double click
|
||
|
|
||
14 years ago
|
if ( !( ( ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pWinIcon) ) || ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pUnixIcon) ) ) && bIsSecondClick ) )
|
||
15 years ago
|
{
|
||
|
// in case we didn't click on the icon button
|
||
15 years ago
|
TQFocusEvent focusEvent( TQFocusEvent::FocusIn );
|
||
14 years ago
|
TQApplication::sendEvent( tqApp->mainWidget(), &focusEvent );
|
||
15 years ago
|
if ( m_pClient )
|
||
|
{
|
||
|
m_pClient->updateTimeStamp();
|
||
|
m_pClient->activate();
|
||
|
}
|
||
|
|
||
13 years ago
|
if ( ( TQT_BASE_OBJECT(obj->parent()) != TQT_BASE_OBJECT(m_pCaption) ) && ( TQT_BASE_OBJECT(obj) != TQT_BASE_OBJECT(m_pCaption) ) )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQWidget* w = ( TQWidget* ) obj;
|
||
14 years ago
|
if ( ( w->focusPolicy() == TQ_ClickFocus ) || ( w->focusPolicy() == TQ_StrongFocus ) )
|
||
15 years ago
|
{
|
||
|
w->setFocus();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
14 years ago
|
if ( ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pWinIcon) ) || ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(m_pUnixIcon) ) )
|
||
15 years ago
|
{
|
||
|
// in case we clicked on the icon button
|
||
15 years ago
|
if ( m_timeMeasure.elapsed() > TQApplication::doubleClickInterval() )
|
||
15 years ago
|
{
|
||
|
showSystemMenu();
|
||
|
m_timeMeasure.start();
|
||
|
}
|
||
|
else
|
||
|
closePressed(); // double click on icon button closes the view
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
15 years ago
|
case TQEvent::Resize:
|
||
15 years ago
|
{
|
||
15 years ago
|
if ( ( ( TQWidget* ) obj == m_pClient ) && ( m_state == Normal ) )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQResizeEvent* re = ( TQResizeEvent* ) e;
|
||
15 years ago
|
int captionHeight = m_pCaption->heightHint();
|
||
15 years ago
|
TQSize newChildFrmSize( re->size().width() + KMDI_CHILDFRM_DOUBLE_BORDER,
|
||
15 years ago
|
re->size().height() + captionHeight + KMDI_CHILDFRM_SEPARATOR + KMDI_CHILDFRM_DOUBLE_BORDER );
|
||
|
if ( newChildFrmSize != size() )
|
||
|
resize( newChildFrmSize );
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
15 years ago
|
case TQEvent::ChildRemoved:
|
||
15 years ago
|
{
|
||
|
// if we lost a child we uninstall ourself as event filter for the lost
|
||
|
// child and its children
|
||
14 years ago
|
TQObject* pLostChild = TQT_TQOBJECT(( ( TQChildEvent* ) e )->child());
|
||
14 years ago
|
if ( ( pLostChild != 0L ) /*&& (pLostChild->inherits(TQWIDGET_OBJECT_NAME_STRING))*/ )
|
||
15 years ago
|
{
|
||
15 years ago
|
TQObjectList* list = pLostChild->queryList();
|
||
15 years ago
|
list->insert( 0, pLostChild ); // add the lost child to the list too, just to save code
|
||
15 years ago
|
TQObjectListIt it( *list ); // iterate over all lost child widgets
|
||
|
TQObject* obj;
|
||
15 years ago
|
while ( ( obj = it.current() ) != 0 )
|
||
|
{ // for each found object...
|
||
15 years ago
|
TQWidget* widg = ( TQWidget* ) obj;
|
||
15 years ago
|
++it;
|
||
|
widg->removeEventFilter( this );
|
||
|
}
|
||
|
delete list; // delete the list, not the objects
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
15 years ago
|
case TQEvent::ChildInserted:
|
||
15 years ago
|
{
|
||
|
// if we got a new child we install ourself as event filter for the new
|
||
|
// child and its children (as we did when we got our client).
|
||
|
// XXX see linkChildren() and focus policy stuff
|
||
14 years ago
|
TQObject* pNewChild = TQT_TQOBJECT(( ( TQChildEvent* ) e ) ->child());
|
||
14 years ago
|
if ( ( pNewChild != 0L ) && ::tqqt_cast<TQWidget*>( pNewChild ) )
|
||
15 years ago
|
{
|
||
14 years ago
|
TQWidget * pNewWidget = TQT_TQWIDGET( pNewChild );
|
||
14 years ago
|
TQObjectList *list = pNewWidget->queryList( TQWIDGET_OBJECT_NAME_STRING );
|
||
15 years ago
|
list->insert( 0, pNewChild ); // add the new child to the list too, just to save code
|
||
15 years ago
|
TQObjectListIt it( *list ); // iterate over all new child widgets
|
||
|
TQObject * obj;
|
||
15 years ago
|
while ( ( obj = it.current() ) != 0 )
|
||
|
{ // for each found object...
|
||
15 years ago
|
TQWidget * widg = ( TQWidget* ) obj;
|
||
15 years ago
|
++it;
|
||
14 years ago
|
if ( !::tqqt_cast<TQPopupMenu*>( widg ) )
|
||
15 years ago
|
{
|
||
|
widg->installEventFilter( this );
|
||
|
}
|
||
|
}
|
||
|
delete list; // delete the list, not the objects
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
return false; // standard event processing (see Qt documentation)
|
||
|
}
|
||
|
|
||
|
//============= raiseAndActivate ===============//
|
||
|
|
||
|
void KMdiChildFrm::raiseAndActivate()
|
||
|
{
|
||
|
m_pCaption->setActive( true );
|
||
|
m_pManager->setTopChild( this, false ); //Do not focus by now...
|
||
|
}
|
||
|
|
||
|
//============= setMinimumSize ===============//
|
||
|
|
||
|
void KMdiChildFrm::setMinimumSize ( int minw, int minh )
|
||
|
{
|
||
15 years ago
|
TQWidget::setMinimumSize( minw, minh );
|
||
15 years ago
|
if ( m_state == Maximized )
|
||
|
{
|
||
|
m_pManager->setMinimumSize( minw, minh );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//============= systemMenu ===============//
|
||
|
|
||
15 years ago
|
TQPopupMenu* KMdiChildFrm::systemMenu() const
|
||
15 years ago
|
{
|
||
|
if ( m_pSystemMenu == 0 )
|
||
|
return 0;
|
||
|
|
||
|
m_pSystemMenu->clear();
|
||
|
|
||
|
if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
|
||
|
{
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "&Restore" ), this, TQT_SLOT( restorePressed() ) );
|
||
|
m_pSystemMenu->insertItem( i18n( "&Move" ), m_pCaption, TQT_SLOT( slot_moveViaSystemMenu() ) );
|
||
|
m_pSystemMenu->insertItem( i18n( "R&esize" ), this, TQT_SLOT( slot_resizeViaSystemMenu() ) );
|
||
|
m_pSystemMenu->insertItem( i18n( "M&inimize" ), this, TQT_SLOT( minimizePressed() ) );
|
||
|
m_pSystemMenu->insertItem( i18n( "M&aximize" ), this, TQT_SLOT( maximizePressed() ) );
|
||
15 years ago
|
if ( state() == Normal )
|
||
|
m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 0 ), false );
|
||
|
else if ( state() == Maximized )
|
||
|
{
|
||
|
m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 1 ), false );
|
||
|
m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 2 ), false );
|
||
|
m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 4 ), false );
|
||
|
}
|
||
|
else if ( state() == Minimized )
|
||
|
{
|
||
|
m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 2 ), false );
|
||
|
m_pSystemMenu->setItemEnabled( m_pSystemMenu->idAt( 3 ), false );
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if ( state() != Normal )
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "&Restore" ), this, TQT_SLOT( restorePressed() ) );
|
||
15 years ago
|
if ( state() != Maximized )
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "&Maximize" ), this, TQT_SLOT( maximizePressed() ) );
|
||
15 years ago
|
if ( state() != Minimized )
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "&Minimize" ), this, TQT_SLOT( minimizePressed() ) );
|
||
15 years ago
|
if ( state() != Maximized )
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "M&ove" ), m_pCaption, TQT_SLOT( slot_moveViaSystemMenu() ) );
|
||
15 years ago
|
if ( state() == Normal )
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "&Resize" ), this, TQT_SLOT( slot_resizeViaSystemMenu() ) );
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "&Undock" ), this, TQT_SLOT( undockPressed() ) );
|
||
15 years ago
|
m_pSystemMenu->insertSeparator();
|
||
15 years ago
|
m_pSystemMenu->insertItem( i18n( "&Close" ), this, TQT_SLOT( closePressed() ) );
|
||
15 years ago
|
|
||
|
return m_pSystemMenu;
|
||
|
}
|
||
|
|
||
|
/** Shows a system menu for child frame windows. */
|
||
|
void KMdiChildFrm::showSystemMenu()
|
||
|
{
|
||
|
if ( KMdiMainFrm::frameDecorOfAttachedViews() != KMdi::Win95Look )
|
||
|
m_pUnixIcon->setDown( false );
|
||
|
|
||
15 years ago
|
TQPoint popupmenuPosition;
|
||
15 years ago
|
|
||
15 years ago
|
TQRect iconGeom;
|
||
15 years ago
|
if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
|
||
14 years ago
|
iconGeom = m_pWinIcon->geometry();
|
||
15 years ago
|
else
|
||
14 years ago
|
iconGeom = m_pUnixIcon->geometry();
|
||
15 years ago
|
|
||
15 years ago
|
popupmenuPosition = TQPoint( iconGeom.x(), iconGeom.y() + captionHeight() + KMDI_CHILDFRM_BORDER );
|
||
15 years ago
|
systemMenu() ->popup( mapToGlobal( popupmenuPosition ) );
|
||
|
}
|
||
|
|
||
|
void KMdiChildFrm::switchToMinimizeLayout()
|
||
|
{
|
||
|
setMinimumWidth( KMDI_CHILDFRM_MIN_WIDTH );
|
||
|
setFixedHeight( m_pCaption->height() + KMDI_CHILDFRM_DOUBLE_BORDER );
|
||
|
|
||
|
m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
|
||
|
|
||
|
// temporary use of minimize button for restore function
|
||
|
m_pMinimize->setPixmap( *m_pRestoreButtonPixmap );
|
||
15 years ago
|
TQObject::disconnect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( minimizePressed() ) );
|
||
|
TQObject::connect( m_pMinimize, TQT_SIGNAL( clicked() ), this, TQT_SLOT( restorePressed() ) );
|
||
15 years ago
|
|
||
|
// resizing
|
||
|
resize( 300, minimumHeight() );
|
||
|
|
||
|
// positioning
|
||
14 years ago
|
m_pManager->layoutMinimizedChildren();
|
||
15 years ago
|
}
|
||
|
|
||
|
void KMdiChildFrm::slot_resizeViaSystemMenu()
|
||
|
{
|
||
|
grabMouse();
|
||
|
m_bResizing = true;
|
||
|
m_iResizeCorner = KMDI_RESIZE_BOTTOMLEFT;
|
||
|
setResizeCursor( m_iResizeCorner );
|
||
|
}
|
||
|
|
||
|
void KMdiChildFrm::redecorateButtons()
|
||
|
{
|
||
|
delete m_pMinButtonPixmap;
|
||
|
delete m_pMaxButtonPixmap;
|
||
|
delete m_pRestoreButtonPixmap;
|
||
|
delete m_pCloseButtonPixmap;
|
||
|
delete m_pUndockButtonPixmap;
|
||
|
|
||
|
if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::Win95Look )
|
||
|
{
|
||
15 years ago
|
m_pMinButtonPixmap = new TQPixmap( win_minbutton );
|
||
|
m_pMaxButtonPixmap = new TQPixmap( win_maxbutton );
|
||
|
m_pRestoreButtonPixmap = new TQPixmap( win_restorebutton );
|
||
|
m_pCloseButtonPixmap = new TQPixmap( win_closebutton );
|
||
|
m_pUndockButtonPixmap = new TQPixmap( win_undockbutton );
|
||
15 years ago
|
}
|
||
|
else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
|
||
|
{
|
||
15 years ago
|
m_pMinButtonPixmap = new TQPixmap( kde_minbutton );
|
||
|
m_pMaxButtonPixmap = new TQPixmap( kde_maxbutton );
|
||
|
m_pRestoreButtonPixmap = new TQPixmap( kde_restorebutton );
|
||
|
m_pCloseButtonPixmap = new TQPixmap( kde_closebutton );
|
||
|
m_pUndockButtonPixmap = new TQPixmap( kde_undockbutton );
|
||
15 years ago
|
}
|
||
|
else if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDELook )
|
||
|
{
|
||
15 years ago
|
m_pMinButtonPixmap = new TQPixmap( kde2_minbutton );
|
||
|
m_pMaxButtonPixmap = new TQPixmap( kde2_maxbutton );
|
||
|
m_pRestoreButtonPixmap = new TQPixmap( kde2_restorebutton );
|
||
|
m_pCloseButtonPixmap = new TQPixmap( kde2_closebutton );
|
||
|
m_pUndockButtonPixmap = new TQPixmap( kde2_undockbutton );
|
||
15 years ago
|
}
|
||
|
else
|
||
|
{ // kde2laptop look
|
||
15 years ago
|
m_pMinButtonPixmap = new TQPixmap( kde2laptop_minbutton );
|
||
|
m_pMaxButtonPixmap = new TQPixmap( kde2laptop_maxbutton );
|
||
|
m_pRestoreButtonPixmap = new TQPixmap( kde2laptop_restorebutton );
|
||
|
m_pCloseButtonPixmap = new TQPixmap( kde2laptop_closebutton );
|
||
|
m_pUndockButtonPixmap = new TQPixmap( kde2laptop_undockbutton );
|
||
15 years ago
|
}
|
||
|
|
||
|
m_pUnixIcon->setAutoRaise( true );
|
||
|
if ( KMdiMainFrm::frameDecorOfAttachedViews() == KMdi::KDE1Look )
|
||
|
{
|
||
|
m_pMinimize->setAutoRaise( true );
|
||
|
m_pMaximize->setAutoRaise( true );
|
||
|
m_pClose->setAutoRaise( true );
|
||
|
m_pUndock->setAutoRaise( true );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_pMinimize->setAutoRaise( false );
|
||
|
m_pMaximize->setAutoRaise( false );
|
||
|
m_pClose->setAutoRaise( false );
|
||
|
m_pUndock->setAutoRaise( false );
|
||
|
}
|
||
|
|
||
|
if ( m_pClient && m_pClient->icon() )
|
||
|
{
|
||
|
m_pWinIcon->setPixmap( *( m_pClient )->icon() );
|
||
|
m_pUnixIcon->setPixmap( *( m_pClient )->icon() );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_pWinIcon->setPixmap( *m_pIconButtonPixmap );
|
||
|
m_pUnixIcon->setPixmap( *m_pIconButtonPixmap );
|
||
|
}
|
||
|
m_pClose->setPixmap( *m_pCloseButtonPixmap );
|
||
|
m_pMinimize->setPixmap( *m_pMinButtonPixmap );
|
||
|
m_pMaximize->setPixmap( *m_pMaxButtonPixmap );
|
||
|
m_pUndock->setPixmap( *m_pUndockButtonPixmap );
|
||
|
}
|
||
|
|
||
15 years ago
|
TQRect KMdiChildFrm::mdiAreaContentsRect() const
|
||
15 years ago
|
{
|
||
14 years ago
|
TQFrame * p = ( TQFrame* ) parentWidget();
|
||
15 years ago
|
if ( p )
|
||
|
{
|
||
|
return p->contentsRect();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
15 years ago
|
TQRect empty;
|
||
15 years ago
|
return empty;
|
||
|
}
|
||
|
}
|
||
|
|
||
14 years ago
|
// kate: indent-mode csands; tab-width 4; space-indent off; replace-tabs off;
|