kmdichildfrm.h
//----------------------------------------------------------------------------
// filename : kmdichildfrm.h
//----------------------------------------------------------------------------
// 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
// 2000-2003 maintained by the KDevelop project
// patches : */2000 Lars Beikirch (Lars.Beikirch@gmx.net)
//
// copyright : (C) 1999-2003 by Falk Brettschneider
// and
// Szymon Stefanek (stefanek@tin.it)
// email : falkbr@kdevelop.org (Falk Brettschneider)
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
//
// 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.
//
//------------------------------------------------------------------------------
#ifndef _KMDI_CHILD_FRM_H_
#define _KMDI_CHILD_FRM_H_
#include <qptrlist.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qdatetime.h>
#include <qlayout.h>
#include <qdict.h>
#include "kmdichildfrmcaption.h"
class KMdiChildArea;
class KMdiChildView;
class QPopupMenu;
class QToolButton;
//==============================================================================
class KMDI_EXPORT KMdiWin32IconButton : public QLabel
{
Q_OBJECT
public:
KMdiWin32IconButton( QWidget* parent, const char* name = 0 );
virtual void mousePressEvent( QMouseEvent* );
signals:
void pressed();
};
//==============================================================================
/* some special events, see kmdidefines.h
*/
//------------------------------------------------------------------------------
class KMDI_EXPORT KMdiChildFrmMoveEvent : public QCustomEvent
{
public:
KMdiChildFrmMoveEvent( QMoveEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_Move ) ), e ) {}
};
//------------------------------------------------------------------------------
class KMDI_EXPORT KMdiChildFrmDragBeginEvent : public QCustomEvent
{
public:
KMdiChildFrmDragBeginEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_DragBegin ) ), e ) {}
};
//------------------------------------------------------------------------------
class KMDI_EXPORT KMdiChildFrmDragEndEvent : public QCustomEvent
{
public:
KMdiChildFrmDragEndEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_DragEnd ) ), e ) {}
};
//------------------------------------------------------------------------------
class KMDI_EXPORT KMdiChildFrmResizeBeginEvent : public QCustomEvent
{
public:
KMdiChildFrmResizeBeginEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_ResizeBegin ) ), e ) {}
};
//------------------------------------------------------------------------------
class KMDI_EXPORT KMdiChildFrmResizeEndEvent : public QCustomEvent
{
public:
KMdiChildFrmResizeEndEvent( QMouseEvent *e ) : QCustomEvent( QEvent::Type( QEvent::User + int( KMdi::EV_ResizeEnd ) ), e ) {}
};
class KMdiChildFrmPrivate;
//==============================================================================
//------------------------------------------------------------------------------
class KMDI_EXPORT KMdiChildFrm : public QFrame
{
friend class KMdiChildArea;
friend class KMdiChildFrmCaption;
Q_OBJECT
// attributes
public:
enum MdiWindowState { Normal, Maximized, Minimized };
//positions same in h and cpp for fast order check
KMdiChildView* m_pClient;
protected:
KMdiChildArea* m_pManager;
KMdiChildFrmCaption* m_pCaption;
KMdiWin32IconButton* m_pWinIcon;
QToolButton* m_pUnixIcon;
QToolButton* m_pMinimize;
QToolButton* m_pMaximize;
QToolButton* m_pClose;
QToolButton* m_pUndock;
MdiWindowState m_state;
QRect m_restoredRect;
int m_iResizeCorner;
int m_iLastCursorCorner;
bool m_bResizing;
bool m_bDragging;
QPixmap* m_pIconButtonPixmap;
QPixmap* m_pMinButtonPixmap;
QPixmap* m_pMaxButtonPixmap;
QPixmap* m_pRestoreButtonPixmap;
QPixmap* m_pCloseButtonPixmap;
QPixmap* m_pUndockButtonPixmap;
int m_windowMenuID;
QPopupMenu* m_pSystemMenu;
QSize m_oldClientMinSize;
QSize m_oldClientMaxSize;
QLayout::ResizeMode m_oldLayoutResizeMode;
QTime m_timeMeasure;
// methods
public:
KMdiChildFrm( KMdiChildArea *parent );
~KMdiChildFrm();
void setClient( KMdiChildView *w, bool bAutomaticResize = false );
void unsetClient( QPoint positionOffset = QPoint( 0, 0 ) );
void setIcon( const QPixmap &pxm );
QPixmap* icon() const;
void enableClose( bool bEnable );
void setCaption( const QString& text );
const QString& caption() { return m_pCaption->m_szCaption; }
void setState( MdiWindowState state, bool bAnimate = true );
inline MdiWindowState state() const { return m_state; }
QRect mdiAreaContentsRect() const;
QRect restoreGeometry() const;
void setRestoreGeometry( const QRect& newRestGeo );
void updateRects() { resizeEvent( 0 ); }
QPopupMenu* systemMenu() const;
inline int captionHeight() const { return m_pCaption->height(); }
void redecorateButtons();
bool isInDrag() const { return m_bDragging; }
bool isInResize() const { return m_bResizing; }
void raiseAndActivate();
virtual void setMinimumSize ( int minw, int minh );
public slots:
void slot_resizeViaSystemMenu();
protected:
virtual void resizeEvent( QResizeEvent * );
virtual void mouseMoveEvent( QMouseEvent *e );
virtual void mousePressEvent( QMouseEvent *e );
virtual void mouseReleaseEvent( QMouseEvent * );
virtual void moveEvent( QMoveEvent* me );
virtual void leaveEvent( QEvent * );
virtual bool eventFilter( QObject*, QEvent* );
void resizeWindow( int resizeCorner, int x, int y );
void setResizeCursor( int resizeCorner );
void unsetResizeCursor();
virtual void switchToMinimizeLayout();
void doResize();
void doResize( bool captionOnly );
protected slots:
void maximizePressed();
void restorePressed();
void minimizePressed();
void closePressed();
void undockPressed();
void showSystemMenu();
protected:
void linkChildren( QDict<FocusPolicy>* pFocPolDict );
QDict<QWidget::FocusPolicy>* unlinkChildren();
int getResizeCorner( int ax, int ay );
private:
KMdiChildFrmPrivate *d;
};
#endif //_KMDICHILDFRM_H_
// kate: space-indent off; replace-tabs off; tab-width 4; indent-mode csands;
KMdiChildFrm::updateRects
void updateRects()
Forces updating the rects of the caption and so...
Definition: kmdichildfrm.h:261
KMdiChildFrm::m_windowMenuID
int m_windowMenuID
Every child frame window has an temporary ID in the Window menu of the child area.
Definition: kmdichildfrm.h:168
KMdiChildFrmCaption::setCaption
void setCaption(const QString &text)
Repaint with a new caption bar title.
Definition: kmdichildfrmcaption.cpp:190
KMdiChildFrm::caption
const QString & caption()
Gets the caption of this mdi child.
Definition: kmdichildfrm.h:230
KMdiChildFrm::m_pSystemMenu
QPopupMenu * m_pSystemMenu
Imitates a system menu for child frame windows.
Definition: kmdichildfrm.h:173
KMdiChildFrm::isInResize
bool isInResize() const
returns the mouse state "In Resize"
Definition: kmdichildfrm.h:286
KMdiChildFrmResizeBeginEvent
a QCustomEvent for begin of resizing This special event will be useful, to inform view about child fr...
Definition: kmdichildfrm.h:105
KMdiChildFrmCaption::mousePressEvent
virtual void mousePressEvent(QMouseEvent *)
The same as KMdiChildFrmCaption::slot_moveViaSystemMenu.
Definition: kmdichildfrmcaption.cpp:86
KMdiChildFrmCaption::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *e)
Checks if out of move range of the KMdiChildArea and calls KMdiChildFrm::move.
Definition: kmdichildfrmcaption.cpp:131
KMdiChildFrmResizeEndEvent
a QCustomEvent for end of resizing This special event will be useful, to inform view about child fram...
Definition: kmdichildfrm.h:116
KMdiChildFrm
Internal class.
Definition: kmdichildfrm.h:130
KMdiChildFrmCaption
Internal class.
Definition: kmdichildfrmcaption.h:44
KMdiChildFrmCaption::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *)
Restore the normal mouse cursor, set the state variable back to 'not moving'.
Definition: kmdichildfrmcaption.cpp:106
KMdiChildFrm::state
MdiWindowState state() const
Returns the current state of the window.
Definition: kmdichildfrm.h:240
KMdiChildFrm::isInDrag
bool isInDrag() const
returns the mouse state "In Drag"
Definition: kmdichildfrm.h:281
KMdiChildFrmDragBeginEvent
a QCustomEvent for begin of dragging This special event will be useful, to inform view about child fr...
Definition: kmdichildfrm.h:83
KMdiWin32IconButton
Internal class, only used on Win32.
Definition: kmdichildfrm.h:52
KMdiChildFrmMoveEvent
a QCustomEvent for move This special event will be useful, to inform view about child frame event...
Definition: kmdichildfrm.h:71
KMdiChildFrm::captionHeight
int captionHeight() const
Returns the caption bar height.
Definition: kmdichildfrm.h:271
KMdiChildFrmDragEndEvent
a QCustomEvent for end of dragging This special event will be useful, to inform view about child fram...
Definition: kmdichildfrm.h:94
KMdiChildView
Base class for all your special view windows.
Definition: kmdichildview.h:108
KMdiChildArea
Internal class.
Definition: kmdichildarea.h:52

KDE Home | KDE Accessibility Home | Description of Access Keys