# class PartManager | The part manager is an object which knows about a collection of parts (even nested ones) and handles activation/deactivation. More...
Full name | `KParts::PartManager`
Definition | `#include <partmanager.h>`
Inherits | QObject (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum SelectionPolicy { Direct, TriState }

#### Public Methods

- PartManager ( QWidget * parent, const char * name = 0L )
- PartManager ( QWidget * topLevel, QObject *parent, const char *name = 0 )
- virtual ~PartManager ()
- void setSelectionPolicy ( SelectionPolicy policy )
- SelectionPolicy selectionPolicy () const
- void setAllowNestedParts ( bool allow )
- bool allowNestedParts () const
- void setIgnoreScrollBars ( bool ignore )
- bool ignoreScrollBars () const
- virtual bool eventFilter ( QObject *obj, QEvent *ev )
- virtual void addPart ( Part *part, bool setActive = true )
- virtual void removePart ( Part *part )
- virtual void replacePart ( Part * oldPart, Part * newPart, bool setActive = true )
- virtual void setActivePart ( Part *part, QWidget *widget = 0L )
- virtual Part * activePart () const
- virtual QWidget * activeWidget () const
- virtual void setSelectedPart ( Part *part, QWidget *widget = 0L )
- virtual Part * selectedPart () const
- virtual QWidget * selectedWidget () const
- const QList<Part> * parts () const
- void addManagedTopLevelWidget ( const QWidget *topLevel )
- void removeManagedTopLevelWidget ( const QWidget *topLevel )

#### Signals

- void partAdded ( KParts::Part *part )
- void partRemoved ( KParts::Part *part )
- void activePartChanged ( KParts::Part *newPart )

#### Protected Methods

- virtual void setActiveInstance ( KInstance * instance )

#### Protected Slots

- void slotObjectDestroyed ()
- void slotWidgetDestroyed ()
- void slotManagedTopLevelWidgetDestroyed ()

## Detailed Description

The part manager is an object which knows about a collection of parts (even nested ones) and handles activation/deactivation.

Applications that want to embed parts without merging GUIs only use a KPartManager. Those who want to merge GUIs use a KPartsMainWindow for example, in addition to a part manager.

Parts know about the part manager to add nested parts to it. See also KParts::Part::manager() and KParts::Part::setManager().

enum SelectionPolicy { Direct, TriState } | ### SelectionPolicy

PartManager ( QWidget * parent, const char * name = 0L ) | ### PartManager

Create a part manager.

Parameters:

parent | The toplevel widget (window / dialog) the partmanager should monitor for activation/selection events

PartManager ( QWidget * topLevel, QObject *parent, const char *name = 0 ) | ### PartManager

Create a part manager.

Parameters:

topLevel | The toplevel widget (window / dialog ) the partmanager should monitor for activation/selection events
parent | The parent QObject.

~PartManager () | ### ~PartManager

[virtual]

void setSelectionPolicy ( SelectionPolicy policy ) | ### setSelectionPolicy

Set the selection policy of the partmanager.

SelectionPolicy selectionPolicy () | ### selectionPolicy

[const]

Retrieve the current selection policy.

void setAllowNestedParts ( bool allow ) | ### setAllowNestedParts

Specify whether the partmanager should handle/allow nested parts or not.

This is a property the shell has to set/specify. Per default we assume that the shell cannot handle nested parts. However in case of a KOffice shell for example we allow nested parts. A Part is nested (a child part) if its parent object inherits KParts::Part. If a child part is activated and nested parts are not allowed/handled, then the top parent part in the tree is activated.

bool allowNestedParts () | ### allowNestedParts

[const]

See also: setAllowNestedParts

void setIgnoreScrollBars ( bool ignore ) | ### setIgnoreScrollBars

Specify whether the partmanager should ignore mouse click events for scrollbars or not. If the partmanager ignores them, then clicking on the scrollbars of a non-active/non-selected part will not change the selection or activation state.

The default value is false (read: scrollbars are NOT ignored).

bool ignoreScrollBars () | ### ignoreScrollBars

[const]

See also: setIgnoreScrollBars

bool eventFilter ( QObject *obj, QEvent *ev ) | ### eventFilter

[virtual]

Reimplemented from QObject.

void addPart ( Part *part, bool setActive = true ) | ### addPart

[virtual]

Add a Part to the manager.

Sets it to the active part automatically if `setActive` is true (default ).

void removePart ( Part *part ) | ### removePart

[virtual]

Remove a part from the manager (this does not delete the object) .

Sets the active part to 0 if `part` is the activePart() .

void replacePart ( Part * oldPart, Part * newPart, bool setActive = true ) | ### replacePart

[virtual]

Replaces `oldPart` with `newPart`, and sets `newPart` as active if `setActive` is true. This is an optimised version of removePart + addPart

void setActivePart ( Part *part, QWidget *widget = 0L ) | ### setActivePart

[virtual]

Set the active part.

The active part receives activation events.

`widget` can be used to specify which widget was responsible for the activation. This is important if you have multiple views for a document/part , like in KOffice .

Part * activePart () | ### activePart

[const virtual]

Retrieve the active part.

QWidget * activeWidget () | ### activeWidget

[const virtual]

Retrieve the active widget of the current active part (see activePart ).

void setSelectedPart ( Part *part, QWidget *widget = 0L ) | ### setSelectedPart

[virtual]

Set the selected part.

The selected part receives selection events.

`widget` can be used to specify which widget was responsible for the selection. This is important if you have multiple views for a document/part , like in KOffice .

Part * selectedPart () | ### selectedPart

[const virtual]

Retrieve the current selected part.

QWidget * selectedWidget () | ### selectedWidget

[const virtual]

Retrieve the selected widget of the current selected part (see selectedPart ).

const QList<Part> * parts () | ### parts

[const]

Retrieve the list of parts being managed by the partmanager.

void addManagedTopLevelWidget ( const QWidget *topLevel ) | ### addManagedTopLevelWidget

Adds the `topLevel` widget to the list of managed toplevel widgets. Usually a PartManager only listens for events (for activation/selection) for one toplevel widget (and its children) , the one specified in the constructor. Sometimes however (like for example when using the KDE dockwidget library) , it is necessary to extend this.

void removeManagedTopLevelWidget ( const QWidget *topLevel ) | ### removeManagedTopLevelWidget

Removes the `topLevel` widget from the list of managed toplevel widgets.

See also: addManagedTopLevelWidget

void partAdded ( KParts::Part *part ) | ### partAdded

[signal]

Emitted when a new part has been added.

See also: addPart()

void partRemoved ( KParts::Part *part ) | ### partRemoved

[signal]

Emitted when a part has been removed.

See also: removePart()

void activePartChanged ( KParts::Part *newPart ) | ### activePartChanged

[signal]

Emitted when the active part has changed.

See also: setActivePart()

void setActiveInstance ( KInstance * instance ) | ### setActiveInstance

[protected virtual]

Changes the active instance when the active part changes. The active instance is used by KBugReport and KAboutDialog. Override if you really need to - usually you don't need to.

void slotObjectDestroyed () | ### slotObjectDestroyed

[protected slots slot]

Removes a part when it is destroyed.

void slotWidgetDestroyed () | ### slotWidgetDestroyed

[protected slots slot]

void slotManagedTopLevelWidgetDestroyed () | ### slotManagedTopLevelWidgetDestroyed

[protected slots slot]

Generated by: root@sparc.ports.openbsd.org on Wed May 2 09:43:28 2001, using kdoc 2.0a53.