kparts Library API Documentation

partmanager.h

00001 // -*- mode: c++; c-basic-offset: 2 -*- 00002 /* This file is part of the KDE project 00003 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org> 00004 (C) 1999 David Faure <faure@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 #ifndef __kpartmanager_h__ 00022 #define __kpartmanager_h__ 00023 00024 #include <qobject.h> 00025 #include <qwidget.h> 00026 #include <qptrlist.h> 00027 00028 #include <kdelibs_export.h> 00029 00030 class KInstance; 00031 00032 namespace KParts 00033 { 00034 00035 class Part; 00036 00037 class PartManagerPrivate; 00038 00050 class KPARTS_EXPORT PartManager : public QObject 00051 { 00052 Q_OBJECT 00053 Q_ENUMS( SelectionPolicy ) 00054 Q_PROPERTY( SelectionPolicy selectionPolicy READ selectionPolicy WRITE setSelectionPolicy ) 00055 Q_PROPERTY( bool allowNestedParts READ allowNestedParts WRITE setAllowNestedParts ) 00056 Q_PROPERTY( bool ignoreScrollBars READ ignoreScrollBars WRITE setIgnoreScrollBars ) 00057 public: 00059 enum SelectionPolicy { Direct, TriState }; 00060 00067 enum Reason { ReasonLeftClick = 100, ReasonMidClick, ReasonRightClick, NoReason }; 00068 00076 PartManager( QWidget * parent, const char * name = 0L ); 00085 PartManager( QWidget * topLevel, QObject *parent, const char *name = 0 ); 00086 virtual ~PartManager(); 00087 00091 void setSelectionPolicy( SelectionPolicy policy ); 00095 SelectionPolicy selectionPolicy() const; 00096 00109 void setAllowNestedParts( bool allow ); 00113 bool allowNestedParts() const; 00114 00123 void setIgnoreScrollBars( bool ignore ); 00127 bool ignoreScrollBars() const; 00128 00134 void setActivationButtonMask( short int buttonMask ); 00138 short int activationButtonMask() const; 00139 00143 virtual bool eventFilter( QObject *obj, QEvent *ev ); 00144 00152 virtual void addPart( Part *part, bool setActive = true ); 00153 00159 virtual void removePart( Part *part ); 00160 00166 virtual void replacePart( Part * oldPart, Part * newPart, bool setActive = true ); 00167 00176 virtual void setActivePart( Part *part, QWidget *widget = 0L ); 00177 00181 virtual Part *activePart() const; 00182 00186 virtual QWidget *activeWidget() const; 00187 00196 virtual void setSelectedPart( Part *part, QWidget *widget = 0L ); 00197 00201 virtual Part *selectedPart() const; 00202 00206 virtual QWidget *selectedWidget() const; 00207 00211 const QPtrList<Part> *parts() const; 00212 00220 void addManagedTopLevelWidget( const QWidget *topLevel ); 00225 void removeManagedTopLevelWidget( const QWidget *topLevel ); 00226 00232 int reason() const; 00233 00234 signals: 00239 void partAdded( KParts::Part *part ); 00244 void partRemoved( KParts::Part *part ); 00249 void activePartChanged( KParts::Part *newPart ); 00250 00251 protected: 00257 virtual void setActiveInstance( KInstance * instance ); 00258 00259 protected slots: 00263 void slotObjectDestroyed(); 00264 00268 void slotWidgetDestroyed(); 00269 00273 void slotManagedTopLevelWidgetDestroyed(); 00274 private: 00275 Part * findPartFromWidget( QWidget * widget, const QPoint &pos ); 00276 Part * findPartFromWidget( QWidget * widget ); 00277 00278 protected: 00279 virtual void virtual_hook( int id, void* data ); 00280 private: 00281 PartManagerPrivate *d; 00282 }; 00283 00284 } 00285 00286 #endif 00287
KDE Logo
This file is part of the documentation for kparts Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:31:29 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003