partmanager.h
// -*- mode: c++; c-basic-offset: 2 -*-
/* This file is part of the KDE project
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 1999 David Faure <faure@kde.org>
This library 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.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kpartmanager_h__
#define __kpartmanager_h__
#include <qobject.h>
#include <qwidget.h>
#include <qptrlist.h>
#include <kdelibs_export.h>
class KInstance;
namespace KParts
{
class Part;
class PartManagerPrivate;
class KPARTS_EXPORT PartManager : public QObject
{
Q_OBJECT
Q_ENUMS( SelectionPolicy )
Q_PROPERTY( SelectionPolicy selectionPolicy READ selectionPolicy WRITE setSelectionPolicy )
Q_PROPERTY( bool allowNestedParts READ allowNestedParts WRITE setAllowNestedParts )
Q_PROPERTY( bool ignoreScrollBars READ ignoreScrollBars WRITE setIgnoreScrollBars )
public:
enum SelectionPolicy { Direct, TriState };
enum Reason { ReasonLeftClick = 100, ReasonMidClick, ReasonRightClick, NoReason };
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;
void setActivationButtonMask( short int buttonMask );
short int activationButtonMask() 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 QPtrList<Part> *parts() const;
void addManagedTopLevelWidget( const QWidget *topLevel );
void removeManagedTopLevelWidget( const QWidget *topLevel );
int reason() const;
signals:
void partAdded( KParts::Part *part );
void partRemoved( KParts::Part *part );
void activePartChanged( KParts::Part *newPart );
protected:
virtual void setActiveInstance( KInstance * instance );
protected slots:
void slotObjectDestroyed();
void slotWidgetDestroyed();
void slotManagedTopLevelWidgetDestroyed();
private:
Part * findPartFromWidget( QWidget * widget, const QPoint &pos );
Part * findPartFromWidget( QWidget * widget );
protected:
virtual void virtual_hook( int id, void* data );
private:
PartManagerPrivate *d;
};
}
#endif
KParts::Part
Base class for parts.
Definition: part.h:181
KInstance
KParts::PartManager::Reason
Reason
This extends QFocusEvent::Reason with the non-focus-event reasons for partmanager to activate a part...
Definition: partmanager.h:67
KParts::PartManager::SelectionPolicy
SelectionPolicy
Selection policy. The default policy of a PartManager is Direct.
Definition: partmanager.h:59
KParts::PartManager
The part manager is an object which knows about a collection of parts (even nested ones) and handles ...
Definition: partmanager.h:50

KDE Home | KDE Accessibility Home | Description of Access Keys