kparts Library API Documentation

partmanager.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
00003              (C) 1999 David Faure <faure@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
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   // the default policy of a PartManager is Direct!
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 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:26:51 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001