partmanager.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __kpartmanager_h__
00021 #define __kpartmanager_h__
00022
00023 #include <qobject.h>
00024 #include <qwidget.h>
00025 #include <qptrlist.h>
00026
00027 class KInstance;
00028
00029 namespace KParts
00030 {
00031
00032 class Part;
00033
00034 class PartManagerPrivate;
00035
00047 class PartManager : public QObject
00048 {
00049 Q_OBJECT
00050 Q_ENUMS( SelectionPolicy )
00051 Q_PROPERTY( SelectionPolicy selectionPolicy READ selectionPolicy WRITE setSelectionPolicy )
00052 Q_PROPERTY( bool allowNestedParts READ allowNestedParts WRITE setAllowNestedParts )
00053 Q_PROPERTY( bool ignoreScrollBars READ ignoreScrollBars WRITE setIgnoreScrollBars )
00054 public:
00055
00056 enum SelectionPolicy { Direct, TriState };
00057
00065 PartManager( QWidget * parent, const char * name = 0L );
00074 PartManager( QWidget * topLevel, QObject *parent, const char *name = 0 );
00075 virtual ~PartManager();
00076
00080 void setSelectionPolicy( SelectionPolicy policy );
00084 SelectionPolicy selectionPolicy() const;
00085
00098 void setAllowNestedParts( bool allow );
00102 bool allowNestedParts() const;
00103
00112 void setIgnoreScrollBars( bool ignore );
00116 bool ignoreScrollBars() const;
00117
00123 void setActivationButtonMask( short int buttonMask );
00127 short int activationButtonMask() const;
00128
00132 virtual bool eventFilter( QObject *obj, QEvent *ev );
00133
00139 virtual void addPart( Part *part, bool setActive = true );
00140
00146 virtual void removePart( Part *part );
00147
00153 virtual void replacePart( Part * oldPart, Part * newPart, bool setActive = true );
00154
00163 virtual void setActivePart( Part *part, QWidget *widget = 0L );
00164
00168 virtual Part *activePart() const;
00169
00173 virtual QWidget *activeWidget() const;
00174
00183 virtual void setSelectedPart( Part *part, QWidget *widget = 0L );
00184
00188 virtual Part *selectedPart() const;
00189
00193 virtual QWidget *selectedWidget() const;
00194
00198 const QPtrList<Part> *parts() const;
00199
00207 void addManagedTopLevelWidget( const QWidget *topLevel );
00212 void removeManagedTopLevelWidget( const QWidget *topLevel );
00213
00214 signals:
00219 void partAdded( KParts::Part *part );
00224 void partRemoved( KParts::Part *part );
00229 void activePartChanged( KParts::Part *newPart );
00230
00231 protected:
00237 virtual void setActiveInstance( KInstance * instance );
00238
00239 protected slots:
00243 void slotObjectDestroyed();
00244
00248 void slotWidgetDestroyed();
00249
00253 void slotManagedTopLevelWidgetDestroyed();
00254 private:
00255 Part * findPartFromWidget( QWidget * widget, const QPoint &pos );
00256 Part * findPartFromWidget( QWidget * widget );
00257
00258 protected:
00259 virtual void virtual_hook( int id, void* data );
00260 private:
00261 PartManagerPrivate *d;
00262 };
00263
00264 }
00265
00266 #endif
00267
This file is part of the documentation for kdelibs Version 3.1.4.