kparts Library API Documentation

KParts::PartManager Class Reference

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

#include <partmanager.h>

Inheritance diagram for KParts::PartManager:

QObject List of all members.

Signals

void partAdded (KParts::Part *part)
 Emitted when a new part has been added.

void partRemoved (KParts::Part *part)
 Emitted when a part has been removed.

void activePartChanged (KParts::Part *newPart)
 Emitted when the active part has changed.


Public Methods

 PartManager (QWidget *parent, const char *name=0L)
 Constructs a part manager.

 PartManager (QWidget *topLevel, QObject *parent, const char *name=0)
 Constructs a part manager.

void setSelectionPolicy (SelectionPolicy policy)
 Sets the selection policy of the partmanager.

SelectionPolicy selectionPolicy () const
 Returns the current selection policy.

void setAllowNestedParts (bool allow)
 Specifies whether the partmanager should handle/allow nested parts or not.

bool allowNestedParts () const
void setIgnoreScrollBars (bool ignore)
 Specifies whether the partmanager should ignore mouse click events for scrollbars or not.

bool ignoreScrollBars () const
void setActivationButtonMask (short int buttonMask)
 Specifies which mouse buttons the partmanager should react upon.

short int activationButtonMask () const
virtual bool eventFilter (QObject *obj, QEvent *ev)
virtual void addPart (Part *part, bool setActive=true)
 Adds a part to the manager.

virtual void removePart (Part *part)
 Removes a part from the manager (this does not delete the object) .

virtual void replacePart (Part *oldPart, Part *newPart, bool setActive=true)
 Replaces oldPart with newPart, and sets newPart as active if setActive is true.

virtual void setActivePart (Part *part, QWidget *widget=0L)
 Sets the active part.

virtual PartactivePart () const
 Returns the active part.

virtual QWidgetactiveWidget () const
 Returns the active widget of the current active part (see activePart ).

virtual void setSelectedPart (Part *part, QWidget *widget=0L)
 Sets the selected part.

virtual PartselectedPart () const
 Returns the current selected part.

virtual QWidgetselectedWidget () const
 Returns the selected widget of the current selected part (see selectedPart ).

const QPtrList< Part > * parts () const
 Returns the list of parts being managed by the partmanager.

void addManagedTopLevelWidget (const QWidget *topLevel)
 Adds the topLevel widget to the list of managed toplevel widgets.

void removeManagedTopLevelWidget (const QWidget *topLevel)
 Removes the topLevel widget from the list of managed toplevel widgets.


Protected Slots

void slotObjectDestroyed ()
 Removes a part when it is destroyed.


Protected Methods

virtual void setActiveInstance (KInstance *instance)
 Changes the active instance when the active part changes.


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 KParts::PartManager. Those who want to merge GUIs use a KParts::MainWindow 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().

Definition at line 47 of file partmanager.h.


Constructor & Destructor Documentation

PartManager::PartManager QWidget   parent,
const char *    name = 0L
 

Constructs a part manager.

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

Definition at line 73 of file partmanager.cpp.

References addManagedTopLevelWidget().

PartManager::PartManager QWidget   topLevel,
QObject   parent,
const char *    name = 0
 

Constructs a part manager.

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

Definition at line 85 of file partmanager.cpp.

References addManagedTopLevelWidget().


Member Function Documentation

void PartManager::setSelectionPolicy SelectionPolicy    policy
 

Sets the selection policy of the partmanager.

Definition at line 112 of file partmanager.cpp.

PartManager::SelectionPolicy PartManager::selectionPolicy  
 

Returns the current selection policy.

Definition at line 117 of file partmanager.cpp.

void PartManager::setAllowNestedParts bool    allow
 

Specifies 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.

Definition at line 122 of file partmanager.cpp.

bool PartManager::allowNestedParts  
 

See also:
setAllowNestedParts

Definition at line 127 of file partmanager.cpp.

void PartManager::setIgnoreScrollBars bool    ignore
 

Specifies 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).

Definition at line 132 of file partmanager.cpp.

bool PartManager::ignoreScrollBars  
 

See also:
setIgnoreScrollBars

Definition at line 137 of file partmanager.cpp.

void PartManager::setActivationButtonMask short int    buttonMask
 

Specifies which mouse buttons the partmanager should react upon.

By default it reacts on all mouse buttons (LMB/MMB/RMB).

Parameters:
mouseButtons  a combination of Qt::ButtonState values e.g. Qt::LeftButton | Qt::MidButton

Definition at line 142 of file partmanager.cpp.

short int PartManager::activationButtonMask  
 

See also:
setActivationButtonMask

Definition at line 147 of file partmanager.cpp.

void PartManager::addPart Part   part,
bool    setActive = true
[virtual]
 

Adds a part to the manager.

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

Definition at line 301 of file partmanager.cpp.

References QWidget::focusPolicy(), QObject::name(), partAdded(), setActivePart(), QWidget::setFocus(), KParts::Part::setManager(), QWidget::show(), and KParts::Part::widget().

Referenced by replacePart().

void PartManager::removePart Part   part [virtual]
 

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

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

Definition at line 332 of file partmanager.cpp.

References QObject::name(), partRemoved(), setActivePart(), KParts::Part::setManager(), and setSelectedPart().

Referenced by slotObjectDestroyed(), and KParts::Part::~Part().

void PartManager::replacePart Part   oldPart,
Part   newPart,
bool    setActive = true
[virtual]
 

Replaces oldPart with newPart, and sets newPart as active if setActive is true.

This is an optimised version of removePart + addPart

Definition at line 353 of file partmanager.cpp.

References addPart(), QObject::name(), partRemoved(), and KParts::Part::setManager().

void PartManager::setActivePart Part   part,
QWidget   widget = 0L
[virtual]
 

Sets 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 .

Definition at line 371 of file partmanager.cpp.

References activePartChanged(), QObject::connect(), QObject::destroyed(), QObject::disconnect(), QObject::inherits(), QObject::name(), QObject::parent(), QApplication::sendEvent(), setActiveInstance(), setSelectedPart(), and KParts::Part::widget().

Referenced by addPart(), and removePart().

Part * PartManager::activePart   [virtual]
 

Returns the active part.

Definition at line 453 of file partmanager.cpp.

QWidget * PartManager::activeWidget   [virtual]
 

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

Definition at line 458 of file partmanager.cpp.

void PartManager::setSelectedPart Part   part,
QWidget   widget = 0L
[virtual]
 

Sets 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 .

Definition at line 463 of file partmanager.cpp.

References QApplication::sendEvent(), and KParts::Part::widget().

Referenced by removePart(), and setActivePart().

Part * PartManager::selectedPart   [virtual]
 

Returns the current selected part.

Definition at line 492 of file partmanager.cpp.

QWidget * PartManager::selectedWidget   [virtual]
 

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

Definition at line 497 of file partmanager.cpp.

const QPtrList< Part > * PartManager::parts  
 

Returns the list of parts being managed by the partmanager.

Definition at line 516 of file partmanager.cpp.

void PartManager::addManagedTopLevelWidget const QWidget   topLevel
 

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.

Definition at line 521 of file partmanager.cpp.

References QObject::connect(), QObject::destroyed(), and QWidget::isTopLevel().

Referenced by PartManager().

void PartManager::removeManagedTopLevelWidget const QWidget   topLevel
 

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

See also:
addManagedTopLevelWidget

Definition at line 534 of file partmanager.cpp.

References QWidget::isTopLevel().

void KParts::PartManager::partAdded KParts::Part   part [signal]
 

Emitted when a new part has been added.

See also:
addPart()

Referenced by addPart().

void KParts::PartManager::partRemoved KParts::Part   part [signal]
 

Emitted when a part has been removed.

See also:
removePart()

Referenced by removePart(), and replacePart().

void KParts::PartManager::activePartChanged KParts::Part   newPart [signal]
 

Emitted when the active part has changed.

See also:
setActivePart()

Referenced by setActivePart().

void PartManager::setActiveInstance KInstance   instance [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.

Definition at line 447 of file partmanager.cpp.

References KNotifyClient::instance().

Referenced by setActivePart().

void PartManager::slotObjectDestroyed   [protected, slot]
 

Removes a part when it is destroyed.

Definition at line 502 of file partmanager.cpp.

References removePart(), and QObject::sender().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:46 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001