# kmdi Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KMdiChildFrm Class Reference

Internal class. It's an MDI child frame widget. It contains a view widget and a frame caption. Usually you derive from its view. More...

`#include <kmdichildfrm.h>`

Inheritance diagram for KMdiChildFrm:

[legend]
Collaboration diagram for KMdiChildFrm:

[legend]
List of all members.

## Public Types

enum | MdiWindowState { Normal, Maximized, Minimized }

## Public Slots

void | slot_resizeViaSystemMenu ()

## Public Member Functions

| 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 ()
void | setState (MdiWindowState state, bool bAnimate=true)
MdiWindowState | state () const
QRect | mdiAreaContentsRect () const
QRect | restoreGeometry () const
void | setRestoreGeometry (const QRect &newRestGeo)
void | updateRects ()
QPopupMenu * | systemMenu () const
int | captionHeight () const
void | redecorateButtons ()
bool | isInDrag () const
bool | isInResize () const
void | raiseAndActivate ()
virtual void | setMinimumSize (int minw, int minh)

## Public Attributes

KMdiChildView * | m_pClient

## Protected Slots

void | maximizePressed ()
void | restorePressed ()
void | minimizePressed ()
void | closePressed ()
void | undockPressed ()
void | showSystemMenu ()

## Protected Member Functions

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)
void | linkChildren (QDict< FocusPolicy > *pFocPolDict)
QDict< QWidget::FocusPolicy > * | unlinkChildren ()
int | getResizeCorner (int ax, int ay)

## Protected Attributes

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

## Friends

class | KMdiChildArea
class | KMdiChildFrmCaption

## Detailed Description

Internal class. It's an MDI child frame widget. It contains a view widget and a frame caption. Usually you derive from its view.

Definition at line 130 of file kmdichildfrm.h.

## Constructor & Destructor Documentation

KMdiChildFrm::KMdiChildFrm | ( | KMdiChildArea * | parent | ) |

| Creates a new KMdiChildFrm class. Definition at line 101 of file kmdichildfrm.cpp. References closePressed(), QObject::connect(), KMdiChildFrmCaption::heightHint(), QPixmap::isNull(), m_pSystemMenu, maximizePressed(), minimizePressed(), redecorateButtons(), QFrame::setFrameStyle(), setMinimumSize(), and undockPressed().

KMdiChildFrm::~KMdiChildFrm | ( |  | ) |

| Destroys this KMdiChildFrm If a child is still here managed (no recreation was made) it is destroyed too. Definition at line 171 of file kmdichildfrm.cpp. References m_pSystemMenu.

## Member Function Documentation

void KMdiChildFrm::setClient | ( | KMdiChildView * | w,
|  | bool | bAutomaticResize = `false`
| ) |

Reparents the widget w to this KMdiChildFrm (if this is not already done) Installs an event filter to catch focus events.

Resizes this mdi child in a way that the child fits perfectly in.

Definition at line 726 of file kmdichildfrm.cpp.

References QObject::connect(), QWidget::focusPolicy(), QWidget::height(), QSize::height(), KMdiChildFrmCaption::heightHint(), QDict::insert(), QString::latin1(), linkChildren(), KMdiChildArea::m_defaultChildFrmSize, QWidget::minimumHeight(), QWidget::minimumSize(), QWidget::minimumWidth(), QDict::setAutoDelete(), setIcon(), QString::setNum(), KMdiChildArea::topChild(), QWidget::width(), and QSize::width().

Referenced by KMdiMainFrm::attachWindow().

void KMdiChildFrm::unsetClient | ( | QPoint | positionOffset = `QPoint(0, 0)` | ) |

Reparents the client widget to 0 (desktop), moves with an offset from the original position Removes the event filter.

Definition at line 812 of file kmdichildfrm.cpp.

References QObject::disconnect(), QDict::find(), KMdiChildView::focusedChildWidget(), QWidget::focusPolicy(), QSize::height(), QWidget::maximumSize(), QWidget::minimumSize(), QWidget::reparent(), KMdiChildView::setFirstFocusableChildWidget(), QWidget::setFocus(), QWidget::setFocusPolicy(), KMdiChildView::setLastFocusableChildWidget(), KMdiChildView::setMaximumSize(), KMdiChildView::setMinimumSize(), unlinkChildren(), and QSize::width().

Referenced by KMdiMainFrm::detachWindow().

void KMdiChildFrm::setIcon | ( | const QPixmap & | pxm | ) |

| Sets the window icon pointer. Definition at line 702 of file kmdichildfrm.cpp. References QPixmap::convertToImage(), doResize(), QPixmap::height(), QLabel::setPixmap(), QPixmap::size(), QImage::smoothScale(), and QPixmap::width(). Referenced by KMdiMainFrm::detachWindow(), and setClient().

QPixmap * KMdiChildFrm::icon | ( |  | ) | const

| Returns the child frame icon. Definition at line 720 of file kmdichildfrm.cpp. Referenced by KMdiMainFrm::detachWindow(), KMdiChildFrmCaption::paintEvent(), redecorateButtons(), and KMdiMainFrm::setEnableMaximizedChildFrmMode().

void KMdiChildFrm::enableClose | ( | bool | bEnable | ) |

| Enables or disables the close button. Definition at line 694 of file kmdichildfrm.cpp.

void KMdiChildFrm::setCaption | ( | const QString & | text | ) |

| Sets the caption of this window. Definition at line 687 of file kmdichildfrm.cpp. References KMdiChildFrmCaption::setCaption(). Referenced by KMdiChildView::setCaption(), and KMdiChildView::youAreAttached().

const QString& KMdiChildFrm::caption | ( |  | ) | `[inline]`

| Gets the caption of this mdi child. Definition at line 230 of file kmdichildfrm.h. Referenced by KMdiChildArea::destroyChild(), KMdiMainFrm::detachWindow(), and KMdiChildArea::focusTopChild().

void KMdiChildFrm::setState | ( | MdiWindowState | state,
|  | bool | bAnimate = `true`
| ) |

Minimizes, Maximizes, or restores the window.

Definition at line 511 of file kmdichildfrm.cpp.

References KMdiChildArea::childMinimized(), QObject::connect(), QObject::disconnect(), QSize::height(), QWidget::height(), KMdiChildFrmCaption::heightHint(), KMdiChildView::isMaximized(), QWidget::layout(), m_pClient, KMdiChildView::m_stateChanged, QWidget::maximumSize(), minimizePressed(), QWidget::minimumHeight(), QWidget::minimumSize(), QWidget::minimumWidth(), restorePressed(), KMdiChildView::setMaximumSize(), KMdiChildView::setMinimumSize(), switchToMinimizeLayout(), KMdiChildArea::topChild(), QSize::width(), QWidget::width(), QWidget::x(), and QWidget::y().

Referenced by KMdiChildArea::childMinimized(), KMdiChildArea::destroyChild(), KMdiChildArea::destroyChildButNotItsView(), KMdiChildArea::manageChild(), KMdiChildView::maximize(), maximizePressed(), KMdiChildView::minimize(), minimizePressed(), KMdiChildView::restore(), restorePressed(), KMdiChildArea::setTopChild(), and undockPressed().

MdiWindowState KMdiChildFrm::state | ( |  | ) | const`[inline]`

Returns the current state of the window.

Definition at line 240 of file kmdichildfrm.h.

Referenced by KMdiChildArea::cascadeMaximized(), KMdiChildArea::cascadeWindows(), KMdiChildArea::expandHorizontal(), KMdiChildArea::expandVertical(), KMdiChildArea::layoutMinimizedChildren(), KMdiChildArea::manageChild(), KMdiChildArea::resizeEvent(), KMdiMainFrm::setEnableMaximizedChildFrmMode(), KMdiChildArea::setTopChild(), systemMenu(), KMdiChildArea::tileAllInternal(), KMdiChildArea::tileAnodine(), and KMdiChildArea::tileVertically().

QRect KMdiChildFrm::mdiAreaContentsRect | ( |  | ) | const

| Returns the inner client area of the parent of this (which is KMdiChildArea). Definition at line 1395 of file kmdichildfrm.cpp. References QFrame::contentsRect().

QRect KMdiChildFrm::restoreGeometry | ( |  | ) | const

| Returns the geometry that will be restored by calling restore(). Definition at line 673 of file kmdichildfrm.cpp. Referenced by KMdiChildView::restoreGeometry().

void KMdiChildFrm::setRestoreGeometry | ( | const QRect & | newRestGeo | ) |

| Sets the geometry that will be restored by calling restore(). Definition at line 680 of file kmdichildfrm.cpp. Referenced by KMdiMainFrm::attachWindow(), and KMdiChildView::setRestoreGeometry().

void KMdiChildFrm::updateRects | ( |  | ) | `[inline]`

| Forces updating the rects of the caption and so... It may be useful when setting the mdiCaptionFont of the MdiManager Definition at line 261 of file kmdichildfrm.h. References QFrame::resizeEvent().

QPopupMenu * KMdiChildFrm::systemMenu | ( |  | ) | const

Returns the system menu.

Definition at line 1228 of file kmdichildfrm.cpp.

References QPopupMenu::clear(), closePressed(), QPopupMenu::idAt(), QPopupMenu::insertItem(), QPopupMenu::insertSeparator(), m_pSystemMenu, maximizePressed(), minimizePressed(), restorePressed(), QPopupMenu::setItemEnabled(), state(), and undockPressed().

Referenced by KMdiChildFrmCaption::mousePressEvent(), KMdiMainFrm::setEnableMaximizedChildFrmMode(), and showSystemMenu().

int KMdiChildFrm::captionHeight | ( |  | ) | const`[inline]`

| Returns the caption bar height. Definition at line 271 of file kmdichildfrm.h. Referenced by KMdiMainFrm::attachWindow(), doResize(), KMdiChildView::setMaximumSize(), and showSystemMenu().

void KMdiChildFrm::redecorateButtons | ( |  | ) |

| sets new raise behavior and pixmaps of the buttons depending on the current decoration style Definition at line 1322 of file kmdichildfrm.cpp. References icon(), QWidget::icon(), QToolButton::setAutoRaise(), and QLabel::setPixmap(). Referenced by KMdiChildFrm(), and KMdiMainFrm::setFrameDecorOfAttachedViews().

bool KMdiChildFrm::isInDrag | ( |  | ) | const`[inline]`

| returns the mouse state "In Drag" Definition at line 281 of file kmdichildfrm.h.

bool KMdiChildFrm::isInResize | ( |  | ) | const`[inline]`

| returns the mouse state "In Resize" Definition at line 286 of file kmdichildfrm.h.

void KMdiChildFrm::raiseAndActivate | ( |  | ) |

| Internally called from the signal focusInEventOccurs. It raises the MDI childframe to the top of all other MDI child frames and sets the focus on it. Definition at line 1209 of file kmdichildfrm.cpp. References KMdiChildFrmCaption::setActive(), and KMdiChildArea::setTopChild().

void KMdiChildFrm::setMinimumSize | ( | int | minw,
|  | int | minh
| ) | `[virtual]`

| Sets the minimum size of the widget to w by h pixels. It extends it's base clase method in a way that the minimum size of the child area will be set additionally if the view is maximized. Definition at line 1217 of file kmdichildfrm.cpp. References QWidget::setMinimumSize(). Referenced by KMdiChildFrm(), and KMdiChildView::setMinimumSize().

void KMdiChildFrm::resizeEvent | ( | QResizeEvent * |  | ) | `[protected, virtual]`

| Reimplemented from the base class. Resizes the captionbar, relayouts the position of the system buttons, and calls resize for its embedded KMdiChildView with the proper size Reimplemented from QFrame. Definition at line 982 of file kmdichildfrm.cpp. References doResize().

void KMdiChildFrm::mouseMoveEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

| Reimplemented from the base class. Detects if the mouse is on the edge of window and what resize cursor must be set. Calls KMdiChildFrm::resizeWindow if it is in m_bResizing. Definition at line 273 of file kmdichildfrm.cpp. References getResizeCorner(), QWidget::maximumSize(), QWidget::minimumSize(), resizeWindow(), setResizeCursor(), QPoint::x(), and QPoint::y().

void KMdiChildFrm::mousePressEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

| Reimplemented from the base class. Colours the caption, raises the childfrm widget and turns to resize mode if it is on the edge (resize-sensitive area) Definition at line 183 of file kmdichildfrm.cpp. References getResizeCorner(), QApplication::restoreOverrideCursor(), QApplication::sendEvent(), KMdiChildFrmCaption::setActive(), and KMdiChildArea::setTopChild().

void KMdiChildFrm::mouseReleaseEvent | ( | QMouseEvent * |  | ) | `[protected, virtual]`

| Reimplemented from the base class. Sets a normal cursor and leaves the resize mode. Definition at line 210 of file kmdichildfrm.cpp. References QApplication::restoreOverrideCursor(), and QApplication::sendEvent().

void KMdiChildFrm::moveEvent | ( | QMoveEvent * | me | ) | `[protected, virtual]`

| Reimplemented from the base class. give its child view the chance to notify a childframe move... that's why it sends a KMdiChildMovedEvent to the embedded KMdiChildView . Definition at line 304 of file kmdichildfrm.cpp. References QApplication::sendEvent().

void KMdiChildFrm::leaveEvent | ( | QEvent * |  | ) | `[protected, virtual]`

| Reimplemented from the base class. If not in resize mode, it sets the mouse cursor to normal appearance. Definition at line 314 of file kmdichildfrm.cpp. References unsetResizeCursor().

bool KMdiChildFrm::eventFilter | ( | QObject * | ,
|  | QEvent * |
| ) | `[protected, virtual]`

Reimplemented from the base class.

In addition, the following are caught -the client's mousebutton press events which raises and activates the childframe -the client's resize event which resizes this widget as well

Definition at line 1077 of file kmdichildfrm.cpp.

References closePressed(), QApplication::doubleClickInterval(), QWidget::focusPolicy(), QObject::installEventFilter(), QObject::parent(), QObject::queryList(), QApplication::sendEvent(), QWidget::setFocus(), showSystemMenu(), QResizeEvent::size(), and unsetResizeCursor().

void KMdiChildFrm::resizeWindow | ( | int | resizeCorner,
|  | int | x,
|  | int | y
| ) | `[protected]`

Calculates the new geometry from the new mouse position given as parameters and calls KMdiChildFrm::setGeometry.

Definition at line 319 of file kmdichildfrm.cpp.

References QRect::bottom(), QRect::height(), QWidget::height(), KMdiChildFrmCaption::heightHint(), QRect::left(), QWidget::maximumSize(), QWidget::minimumSize(), QRect::right(), QRect::setBottom(), QRect::setLeft(), QRect::setRight(), QRect::setTop(), QRect::top(), QRect::width(), QWidget::width(), QPoint::x(), and QPoint::y().

Referenced by mouseMoveEvent().

void KMdiChildFrm::setResizeCursor | ( | int | resizeCorner | ) | `[protected]`

| Override the cursor appearance depending on the widget corner given as parameter. Definition at line 227 of file kmdichildfrm.cpp. References QApplication::restoreOverrideCursor(), and QApplication::setOverrideCursor(). Referenced by mouseMoveEvent().

void KMdiChildFrm::unsetResizeCursor | ( |  | ) | `[protected]`

| Changes from the resize cursor to the normal (previous) cursor. Definition at line 260 of file kmdichildfrm.cpp. References QApplication::restoreOverrideCursor(). Referenced by eventFilter(), and leaveEvent().

void KMdiChildFrm::switchToMinimizeLayout | ( |  | ) | `[protected, virtual]`

| That means to show a mini window showing the childframe's caption bar, only. It cannot be resized. Definition at line 1295 of file kmdichildfrm.cpp. References QObject::connect(), QObject::disconnect(), QWidget::height(), KMdiChildArea::layoutMinimizedChildren(), minimizePressed(), and restorePressed(). Referenced by setState().

void KMdiChildFrm::doResize | ( |  | ) | `[protected]`

| Does the actual resize. Called from various places but from resizeEvent in general. Definition at line 987 of file kmdichildfrm.cpp. Referenced by resizeEvent(), and setIcon().

void KMdiChildFrm::doResize | ( | bool | captionOnly | ) | `[protected]`

| Does the actual resize, like doResize() but skips resize of the client if captionOnly is true. Definition at line 992 of file kmdichildfrm.cpp. References captionHeight(), QSize::height(), KMdiChildFrmCaption::heightHint(), QLabel::pixmap(), QWidget::setGeometry(), QWidget::size(), and QSize::width().

void KMdiChildFrm::maximizePressed | ( |  | ) | `[protected, slot]`

| Handles a click on the Maximize button. Definition at line 442 of file kmdichildfrm.cpp. References KMdiChildArea::nowMaximized(), and setState(). Referenced by KMdiChildFrm(), KMdiChildFrmCaption::mouseDoubleClickEvent(), and systemMenu().

void KMdiChildFrm::restorePressed | ( |  | ) | `[protected, slot]`

Handles a click on the Restore (Normalize) button.

Definition at line 458 of file kmdichildfrm.cpp.

References KMdiChildArea::nowMaximized(), and setState().

Referenced by KMdiChildArea::cascadeMaximized(), KMdiChildArea::cascadeWindows(), KMdiChildArea::expandHorizontal(), KMdiChildArea::expandVertical(), setState(), switchToMinimizeLayout(), systemMenu(), KMdiChildArea::tileAllInternal(), KMdiChildArea::tileAnodine(), and KMdiChildArea::tileVertically().

void KMdiChildFrm::minimizePressed | ( |  | ) | `[protected, slot]`

| Handles a click on the Minimize button. Definition at line 471 of file kmdichildfrm.cpp. References KMdiChildArea::nowMaximized(), and setState(). Referenced by KMdiChildFrm(), setState(), switchToMinimizeLayout(), and systemMenu().

void KMdiChildFrm::closePressed | ( |  | ) | `[protected, slot]`

| Handles a click on the Close button. Definition at line 491 of file kmdichildfrm.cpp. References QWidget::close(). Referenced by eventFilter(), KMdiChildFrm(), and systemMenu().

void KMdiChildFrm::undockPressed | ( |  | ) | `[protected, slot]`

| Handles a click on the Undock (Detach) button. Definition at line 499 of file kmdichildfrm.cpp. References KMdiChildView::detach(), and setState(). Referenced by KMdiChildFrm(), and systemMenu().

void KMdiChildFrm::showSystemMenu | ( |  | ) | `[protected, slot]`

| Shows a system menu for child frame windows. Definition at line 1278 of file kmdichildfrm.cpp. References captionHeight(), QPopupMenu::popup(), systemMenu(), QRect::x(), and QRect::y(). Referenced by eventFilter().

void KMdiChildFrm::linkChildren | ( | QDict< FocusPolicy > * | pFocPolDict | ) | `[protected]`

| Restore the focus policies for _all_ widgets in the view using the list given as parameter. Install the event filter for all direct child widgets of this. (See KMdiChildFrm::eventFilter) Definition at line 887 of file kmdichildfrm.cpp. References QWidget::setFocusPolicy(). Referenced by setClient().

QDict< QWidget::FocusPolicy > * KMdiChildFrm::unlinkChildren | ( |  | ) | `[protected]`

Backups all focus policies of _all_ child widgets in the MDI childview since they get lost during a reparent.

Remove all event filters for all direct child widgets of this. (See KMdiChildFrm::eventFilter)

Definition at line 933 of file kmdichildfrm.cpp.

References QWidget::focusPolicy(), QDict::insert(), QString::latin1(), QDict::setAutoDelete(), and QString::setNum().

Referenced by unsetClient().

int KMdiChildFrm::getResizeCorner | ( | int | ax,
|  | int | ay
| ) | `[protected]`

Calculates the corner id for the resize cursor.

The return value can be tested for: KMDI_RESIZE_LEFT, KMDI_RESIZE_RIGHT, KMDI_RESIZE_TOP, KMDI_RESIZE_BOTTOM or an OR'd variant of them for the corners.

Definition at line 418 of file kmdichildfrm.cpp.

References QWidget::maximumHeight(), QWidget::maximumWidth(), QWidget::minimumHeight(), and QWidget::minimumWidth().

Referenced by mouseMoveEvent(), and mousePressEvent().

## Member Data Documentation

int KMdiChildFrm::m_windowMenuID `[protected]`

| Every child frame window has an temporary ID in the Window menu of the child area. Definition at line 168 of file kmdichildfrm.h.

QPopupMenu* KMdiChildFrm::m_pSystemMenu `[protected]`

| Imitates a system menu for child frame windows. Definition at line 173 of file kmdichildfrm.h. Referenced by KMdiChildFrm(), systemMenu(), and ~KMdiChildFrm().

The documentation for this class was generated from the following files:

- kmdichildfrm.h
- kmdichildfrm.cpp

This file is part of the documentation for kmdi Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:32:08 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003